add code to compile compat.so to provide *_chk functions for musl
[rofl0r-df-libgraphics.git] / dist / df
blobf1f39d16df1e7ebf0a8f57f9e1e016ae97c9c815
1 #!/bin/sh
3 # this is a DF launcher, replacing the one that ships with DF.
4 # it's purpose is to launch DF through musl's libc.so, because the DF
5 # binary has GLIBC's dynlinker hardcoded as interpreter.
6 # additionally it launches DF through launch-without-heap-randomization.elf.
7 # it turned out that the way musl's malloc work, DF will crash pretty rapidly
8 # if heap randomization is enabled (linux default).
9 # launch-without-heap-randomization.elf will turn that off.
10 # you can compile it from launch-without-heap-randomization.c:
11 # gcc launch-without-heap-randomization.c -o launch-without-heap-randomization.elf
13 DF_DIR=$(dirname "$0")
14 cd "${DF_DIR}"
15 export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch.
16 #export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing.
18 if [ $(uname -m) = "x86_64" ] ; then
19 [ -e "libs/libc.so" ] && [ -z "$LIB32DIR" ] && LIB32DIR=./libs
20 [ -z "$LIB32DIR" ] && LIB32DIR=/lib32
21 INTERPRETER="$LIB32DIR"/libc.so
22 if [ ! -e "$INTERPRETER" ] ; then
23 cat << EOF
24 error: the interpreter $INTERPRETER was not found
25 put the required 32bit libraries into $LIB32DIR or change
26 the environment variable LIB32DIR to point there.
28 required:
29 libc.so (musl)
30 libncursesw.so.5
31 libSDL_image-1.2.so.0
32 libz.so.1
33 libSDL_ttf-2.0.so.0
34 libSDL-1.2.so.0 (must be compiled with sabotage's pthread stacksize patch)
35 libstdc++.so.6 (supplied)
36 libgcc_s.so.1 (supplied)
38 optional for sound support:
39 libopenal.so
40 libsndfile.so
42 those 2 depend on other libs themselfes:
43 libvorbis, libogg, alsa-lib and possibly more.
45 EOF
46 exit 1
48 else
49 INTERPRETER=/lib/libc.so
51 [ -n "$LIB32DIR" ] && export LD_LIBRARY_PATH="$LIB32DIR"
52 ./launch-without-heap-randomization.elf $INTERPRETER ./libs/Dwarf_Fortress $* # Go, go, go! :)