commanderx16 / x16-emulator

Emulator for the Commander X16 8-bit computer
383 stars 60 forks source link

Support rom.bin paths relative to x16emu binary location #227

Open thorpej opened 4 years ago

thorpej commented 4 years ago

I just added x16-rom and x16-emulator packages to NetBSD's cross-platform "pkgsrc" packaging system (see http://pkgsrc.org/). One of the conventions of that system is that shared data files are not located with binaries, but rather in a separate "share" file hierarchy. As such, I made a small change to allow the default "rom.bin" file to be in a location relative to that of the x16emu binary, rather than in the same directory. This is enabled by setting the 'ROM_RELATIVE_PATH' variable in the gmake environment. In pkgsrc package Makefiles, this is done like so:

MAKE_ENV+= ROM_RELATIVE_PATH=../share/x16/

...which would make the default locations for those files:

/usr/pkg/bin/x16emu /usr/pkg/share/x16/rom.bin

Attached are the two small patches (for Makefile and main.c) that make this work.

Behavior outside of the pkgsrc build system is unchanged. patches.zip

nigels-com commented 4 years ago

Any particular rationale for a relative path? Could it be simply X16_ROM_PATH?

thorpej commented 4 years ago

The original doesn't hard-code the path. If you all prefer a hard-coded path define, it makes no difference to me; I will simply adjust the pkgsrc package for that when I update it.

juju2143 commented 4 years ago

On Arch Linux, I've been patching main.c directly to refer to /usr/share/x16-rom instead and it works so far. Would be nice to have a compile-time option for that.