diff --git a/srcpkgs/foobillard++/patches/data-dir.patch b/srcpkgs/foobillard++/patches/data-dir.patch new file mode 100644 index 00000000000..986b1e14a34 --- /dev/null +++ b/srcpkgs/foobillard++/patches/data-dir.patch @@ -0,0 +1,43 @@ +diff --git src/sys_stuff.c src/sys_stuff.c +index 8f65f6b..7b905cf 100644 +--- src/sys_stuff.c ++++ src/sys_stuff.c +@@ -756,37 +756,18 @@ void sys_main_loop(void) { + * Find the program's "data" directory and chdir into it * + ***********************************************************************/ + +-static char data_dir[512]; ++static char data_dir[512] = "/usr/share/foobillardplus"; + + void enter_data_dir() { + int success = 1; + + #ifdef POSIX +- char proc_exe[20]; +- char *slash_pos; + #endif + + do { + success = 0; + + #ifdef POSIX +- snprintf(proc_exe, sizeof(proc_exe), "/proc/%d/exe", getpid()); +- if (readlink(proc_exe, data_dir, sizeof(data_dir)) < 0) { +- perror("readlink failed"); +- break; +- } +- +- // Remove program name +- slash_pos = strrchr(data_dir, '/'); +- if (!slash_pos) break; +- *slash_pos = '\0'; +- +- // Go one dir up +- slash_pos = strrchr(data_dir, '/'); +- if (!slash_pos) break; +- +- // Add "/data" +- strncpy(slash_pos, "/data", sizeof(data_dir) - (slash_pos - data_dir)); + #else + /* ### TODO ### Get the working directory of the program + * Mac OS X: _NSGetExecutablePath() (man 3 dyld) diff --git a/srcpkgs/foobillard++/template b/srcpkgs/foobillard++/template index 6d73a67f4ed..98923393e99 100644 --- a/srcpkgs/foobillard++/template +++ b/srcpkgs/foobillard++/template @@ -1,29 +1,30 @@ # Template file for 'foobillard++' +# often segfaults at launch on musl, but not marking broken yet pkgname=foobillard++ version=3.42beta -revision=3 +revision=4 wrksrc=foobillardplus-${version} build_style=gnu-configure configure_args="--enable-standard" -homepage="http://foobillardplus.sourceforge.net/" -distfiles="${SOURCEFORGE_SITE}/foobillardplus/foobillardplus-$version.tar.gz" hostmakedepends="automake pkg-config" makedepends="libICE-devel freetype-devel libpng-devel glu-devel SDL_mixer-devel SDL_net-devel" depends="desktop-file-utils" -short_desc="An OpenGL billard game - fork of foobillard" +short_desc="OpenGL billard game - fork of foobillard" maintainer="Orphaned " -license="GPL-2" +license="GPL-2.0-only" +homepage="http://foobillardplus.sourceforge.net/" +distfiles="${SOURCEFORGE_SITE}/foobillardplus/foobillardplus-$version.tar.gz" checksum=e276b70674a7d788c45eeff89f1f5db5d48d871a1ab92103813d424a3761e1d9 CFLAGS+=" -fgnu89-inline" pre_configure() { autoreconf -fi - sed -i 's|$prefix/foobillardplus|$prefix|' configure - sed -i 's|$prefix/data|$prefix/share/foobillardplus|' configure - sed -i 's|"/data"|"/share/foobillardplus"|' src/language.c - sed -i 's|/opt/foobillardplus/bin/||' foobillardplus.desktop - sed -i 's|/opt/foobillardplus/||' foobillardplus.desktop + vsed -i 's|$prefix/foobillardplus|$prefix|' configure + vsed -i 's|$prefix/data|$prefix/share/foobillardplus|' configure + vsed -i 's|/opt/foobillardplus/bin/||' foobillardplus.desktop + vsed -i 's|/opt/foobillardplus/||' foobillardplus.desktop } + do_install() { vbin src/foobillardplus vmkdir usr/share/foobillardplus