-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support KolibriOS #4663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support KolibriOS #4663
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. Have some notes/questions.
It's not critical so can be skipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks quite good to me regarding what can be done.
The toolchain quality is so low that I wonder if we can name it like that...
Sadly, this forces us to add cruft to our configure script.
I would have proposed to reject this platform if you would not have spent so much time on it.
I will try to make a build and test my ideas later today.
|
||
namespace { | ||
|
||
// opendir/readdir are buggy. And they encourage using syscalls. Whatever |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. The libc doesn't even work...
.path = path | ||
}; | ||
|
||
asm volatile ("int $0x40" : "=a" (error_code), "=b" (num_read) : "a" (70), "b" (&request) : "memory"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _ksys70 function seems to do this. This would avoid using asm here.
But note they don't provide a wrapper for subfunction 1...
#include <kos32sys.h> | ||
#include <stdio.h> | ||
|
||
/* This is just a small wrapper so that the main scummvm is loaded as dll. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the explanation you put in your commit message here as well?
configure
Outdated
append_var DEFINES "-U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -DKOLIBRIOS=1 -D_POSIX_C_SOURCE=1 -D_XOPEN_SOURCE=1" | ||
append_var CXXFLAGS "-I${KOS32_SDK_DIR}/sources/newlib/libc/include -I${KOS32_SDK_DIR}/sources/zlib -I${KOS32_SDK_DIR}/sources/libstdc++-v3/include -fno-ident -fomit-frame-pointer" | ||
append_var LDFLAGS "-nostdlib -shared -Wl,-shared -Wl,-s -Wl,-T${KOS32_SDK_DIR}/sources/newlib/dll.lds -Wl,--entry,_DllStartup -Wl,--image-base,0 -L${KOS32_SDK_DIR}/lib -L/home/autobuild/tools/win32/mingw32/lib -L/home/autobuild/tools/win32/lib" | ||
append_var SYSLIBS "-ldll -lstdc++ -lsupc++ -lgcc -lc.dll -Dmain=xmain" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So basically, kos32-g++ is not a proper C++ compiler...
I would try to add a -specs=file
to CXXFLAGS. This is exactly the purpose of this file: specifying the system libraries needed.
Normally, GCC has the correct spec file bundled in.
More info on this here.
configure
Outdated
append_var DEFINES "-DUNCACHED_PLUGINS" | ||
_mak_plugins=' | ||
PLUGIN_EXTRA_DEPS = $(EXECUTABLE) | ||
PLUGIN_LDFLAGS += -nostdlib -shared -Wl,--entry,_DllStartup -Wl,-q,--retain-symbols-file,$(srcdir)/backends/plugins/elf/plugin.syms -Wl,--enable-auto-import -shared ./libscummvm.a -ldll -lstdc++ -lsupc++ -lgcc -lc.dll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we already link scummvm with libstdc++ and so on, I suspect we will end up with several stdc++ implementations running at once which may not share their internal state.
configure
Outdated
fi | ||
if test "$_jpeg" = yes ; then | ||
append_var LIBS "$JPEG_LIBS -ljpeg" | ||
if test "$_host_os" = kolibrios; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this check everywhere and as it's only a matter of adding a suffix, maybe it's easier to create a _libext
variable set to .dll
in the case of KOS and append it everytime we use the -l
flag?
This would not work if the library is not for a DLL.
Another way would be to add -ljpeg
to JPEG_LIBS
when handling --with-jpeg-prefix=
, setting it in KOS case with whatever is works with the toolchain.
Just before checking presence, add:
if [ -z "$JPEG_LIBS" ]; then
JPEG_LIBS=-ljpeg
fi
and remove -ljpeg in cc_check and in append_var.
Exporting symbols from main binary is cumbersome on KolibriOS but importing from another dll is fine. So we make scummvm core into a dll and add a thin launcher for it.
I managed to do something somewhat cleaner. |
Thank you! |
No description provided.