joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.83k stars 383 forks source link

Compile in Haiku #3537

Open supin96 opened 2 years ago

supin96 commented 2 years ago

Question

I can't compile DOSBox-X in Haiku. I have problem: drives.cpp:261:22: error: 'struct dirent' has no member named 'd_type' 261 | if (dir->d_type == DT_REG) | ^~ drives.cpp:261:32: error: 'DT_REG' was not declared in this scope 261 | if (dir->d_type == DT_REG) | ^~

Have you checked that no similar question(s) exist?

Code of Conduct & Contributing Guidelines

joncampbell123 commented 2 years ago

Does Haiku OS have an #ifdef that code can use to specialize for it?

I was not aware of this, but Linux readdir appears to provide d_type.

The correct case for Haiku OS is to readdir() and then stat() the d->d_name to determine if it's a normal file.

supin96 commented 2 years ago

Haiku OS have #ifdef HAIKU.

egrath commented 1 year ago

When building on Haiku R1/beta4 with the following command ./configure --enable-sdl2; make the compile stage finishes, but linking the application quits with unresolved dependencies, similar to:

/boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: dos/libdos.a(drive_physfs.o): in function `__PHYSFS_platformCalcBaseDir':
/boot/home/tmp/dosbox/src/src/dos/../libs/physfs/physfs_platform_haiku.cpp:154: undefined reference to `BEntry::BEntry(char const*, bool)'

Appending -lbe to LIBS in src/Makefile fixes this issue:

LIBS =  -L/packages/libsdl2-2.0.20-3/.self/develop/lib -lSDL2 -lGL -lnetwork -lbsd -L/packages/freetype_bootstrap-2.12.1-1/.self/develop/lib -lfreetype -lSDL_net -lz -lpng -lz -liconv -lbe
Torinde commented 1 year ago

@amol- , can you add that to your fix?

amol- commented 1 year ago

Oh, nice catch. I did build DosboxX with SDL2, but I might have missed it somehow. I'll open a PR to get this fixed.

Also there is more work that I plan to do on SDL2 for Haiku, as there are currently major issues when using SDL2. Right now SDL1 should be used on Haiku