diff --git a/x11-packages/dosbox-x/build.sh b/x11-packages/dosbox-x/build.sh new file mode 100644 index 0000000000..3d14db6bdd --- /dev/null +++ b/x11-packages/dosbox-x/build.sh @@ -0,0 +1,29 @@ +TERMUX_PKG_HOMEPAGE=https://dosbox-x.com/ +TERMUX_PKG_DESCRIPTION="A cross-platform DOS emulator based on the DOSBox project" +TERMUX_PKG_LICENSE="GPL-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=0.84.3 +TERMUX_PKG_SRCURL=https://github.com/joncampbell123/dosbox-x/archive/refs/tags/dosbox-x-v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=6c807e72ece5de6b038e5ff3a7f1bc2e3bd61901548ed027192f58ff19585881 +TERMUX_PKG_DEPENDS="dosbox-x-data, fluidsynth, freetype, libc++, libiconv, libpcap, libpng, libslirp, libx11, libxkbfile, libxrandr, mesa, sdl2, sdl2-net, zlib" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +ac_cv_path_SDL2_CONFIG=$TERMUX_PREFIX/bin/sdl2-config +--enable-sdl2 +--disable-alsa-midi +--disable-dynamic-x86 +--disable-fpu-x86 +--disable-unaligned-memory +--disable-avcodec +" + +termux_step_post_get_source() { + sed -i 's:/tmp/tinyfd:'"$TERMUX_PREFIX"'\0:g' \ + src/libs/tinyfiledialogs/tinyfiledialogs.c +} + +termux_step_pre_configure() { + autoreconf -fi + + LDFLAGS+=" -liconv" +} diff --git a/x11-packages/dosbox-x/dosbox-x-data.subpackage.sh b/x11-packages/dosbox-x/dosbox-x-data.subpackage.sh new file mode 100644 index 0000000000..8d45e865ad --- /dev/null +++ b/x11-packages/dosbox-x/dosbox-x-data.subpackage.sh @@ -0,0 +1,3 @@ +TERMUX_SUBPKG_DESCRIPTION="Platform-independent data for dosbox-x" +TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true +TERMUX_SUBPKG_INCLUDE="share/dosbox-x/" diff --git a/x11-packages/dosbox-x/fix-hardcoded-paths.patch b/x11-packages/dosbox-x/fix-hardcoded-paths.patch new file mode 100644 index 0000000000..720864db6b --- /dev/null +++ b/x11-packages/dosbox-x/fix-hardcoded-paths.patch @@ -0,0 +1,104 @@ +--- a/src/gui/midi_synth.h ++++ b/src/gui/midi_synth.h +@@ -162,16 +162,16 @@ + #else + // Default on "other" platforms according to fluidsynth docs + // This works on RH and Fedora, if a soundfont is installed +- if (FILE *file = fopen("/usr/share/soundfonts/default.sf2", "r")) { ++ if (FILE *file = fopen("@TERMUX_PREFIX@/share/soundfonts/default.sf2", "r")) { + fclose(file); +- sf = "/usr/share/soundfonts/default.sf2"; ++ sf = "@TERMUX_PREFIX@/share/soundfonts/default.sf2"; + // Ubuntu and Debian don't have a default.sf2... +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/FluidR3_GM.sf2", "r")) { ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/FluidR3_GM.sf2"; +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2"; ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/GeneralUser_GS.sf2"; ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2"; + } else { + LOG_MSG("MIDI:synth: Specify .SF2 sound font file with midiconfig="); + return false; +@@ -338,16 +338,16 @@ + #else + // Default on "other" platforms according to fluidsynth docs + // This works on RH and Fedora, if a soundfont is installed +- if (FILE *file = fopen("/usr/share/soundfonts/default.sf2", "r")) { ++ if (FILE *file = fopen("@TERMUX_PREFIX@/share/soundfonts/default.sf2", "r")) { + fclose(file); +- sf = "/usr/share/soundfonts/default.sf2"; ++ sf = "@TERMUX_PREFIX@/share/soundfonts/default.sf2"; + // Ubuntu and Debian don't have a default.sf2... +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/FluidR3_GM.sf2", "r")) { ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/FluidR3_GM.sf2"; +- } else if (FILE *file = fopen("/usr/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/FluidR3_GM.sf2"; ++ } else if (FILE *file = fopen("@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2", "r")) { + fclose(file); +- sf = "/usr/share/sounds/sf2/GeneralUser_GS.sf2"; ++ sf = "@TERMUX_PREFIX@/share/sounds/sf2/GeneralUser_GS.sf2"; + } else { + LOG_MSG("MIDI:fluidsynth: SoundFont not specified, and no system SoundFont found"); + return false; +--- a/src/hardware/parport/printer.cpp ++++ b/src/hardware/parport/printer.cpp +@@ -399,7 +399,7 @@ + } + basedir = std::string(windir) + "\\fonts\\"; + #else +- basedir = "/usr/share/fonts/"; ++ basedir = "@TERMUX_PREFIX@/share/fonts/"; + #endif + switch (LQtypeFace) + { +--- a/src/misc/cross.cpp ++++ b/src/misc/cross.cpp +@@ -131,9 +131,9 @@ + // Let's check if the above exists, otherwise use RESDIR + struct stat info; + if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) +- in = "/usr/local/share/dosbox-x"; ++ in = "@TERMUX_PREFIX@/local/share/dosbox-x"; + if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) +- in = "/usr/share/dosbox-x"; ++ in = "@TERMUX_PREFIX@/share/dosbox-x"; + if ((stat(in.c_str(), &info) != 0) || (!(info.st_mode & S_IFDIR))) { + //LOG_MSG("XDG_DATA_HOME (%s) does not exist. Using %s", in.c_str(), RESDIR); + in = RESDIR; +--- a/src/output/output_ttf.cpp ++++ b/src/output/output_ttf.cpp +@@ -389,7 +389,7 @@ + } + } + #elif defined(LINUX) +- strcpy(fontdir, "/usr/share/fonts/"); ++ strcpy(fontdir, "@TERMUX_PREFIX@/share/fonts/"); + #elif defined(MACOSX) + strcpy(fontdir, "/Library/Fonts/"); + #else +@@ -406,7 +406,7 @@ + #if defined(LINUX) || defined(MACOSX) + if (!ttf_fh) { + #if defined(LINUX) +- strcpy(fontdir, "/usr/share/fonts/truetype/"); ++ strcpy(fontdir, "@TERMUX_PREFIX@/share/fonts/truetype/"); + #else + strcpy(fontdir, "/System/Library/Fonts/"); + #endif +--- a/vs/sdl/src/cdrom/linux/SDL_syscdrom.c ++++ b/vs/sdl/src/cdrom/linux/SDL_syscdrom.c +@@ -68,7 +68,7 @@ + #ifdef MNTTAB + #define _PATH_MNTTAB MNTTAB + #else +-#define _PATH_MNTTAB "/etc/fstab" ++#define _PATH_MNTTAB "@TERMUX_PREFIX@/etc/fstab" + #endif + #endif /* !_PATH_MNTTAB */ + diff --git a/x11-packages/dosbox-x/src-libs-porttalk-porttalk.cpp.patch b/x11-packages/dosbox-x/src-libs-porttalk-porttalk.cpp.patch new file mode 100644 index 0000000000..9d2eebaca4 --- /dev/null +++ b/x11-packages/dosbox-x/src-libs-porttalk-porttalk.cpp.patch @@ -0,0 +1,11 @@ +--- a/src/libs/porttalk/porttalk.cpp ++++ b/src/libs/porttalk/porttalk.cpp +@@ -236,7 +236,7 @@ + } + #endif + +-#ifdef LINUX ++#if defined LINUX && !defined __ANDROID__ + # if defined(__i386__) || defined(__amd64__) || defined(__x86_64__) + // This Linux ioperm only works up to port 0x3FF + #include