]> git.xonotic.org Git - xonotic/netradiant.git/blob - oldstuff/install-dylibs.sh
easy-builder: use make directly because cmake on macOS does not return error code...
[xonotic/netradiant.git] / oldstuff / install-dylibs.sh
1 #!/bin/sh
2
3 set -ex
4
5 : ${OTOOL:=otool}
6 : ${CP:=cp}
7 : ${INSTALLDIR:=.}
8 : ${EXE:=ppc}
9 : ${MACLIBDIR:=/sw/lib}
10 : ${CAT:=cat}
11
12
13 finkgetdeps()
14 {
15         otool -L "$1" | grep "$MACLIBDIR" | while read -r LIB STUFF; do
16                 [ -z "${LIB##*:}" ] && continue # first line
17                 [ -f "$INSTALLDIR/${LIB##*/}" ] && continue
18                 cp -vL "$LIB" "$INSTALLDIR"
19                 finkgetdeps "$LIB"
20         done
21 }
22
23
24 finkgetdeps "$INSTALLDIR/radiant.$EXE"
25 echo Warning: this only works if only ONE version of gtk-2.0 and pango is installed
26
27 getlib()
28 {
29         LAST=
30         for LIB in "$@"; do
31                 [ -f "$LIB" ] || continue
32                 LAST=$LIB
33         done
34         cp -L "$LAST" "$INSTALLDIR"
35         finkgetdeps "$LAST"
36 }
37
38 getlib "$MACLIBDIR"/gtk-2.0/*/loaders/libpixbufloader-bmp.so "$MACLIBDIR"/gdk-pixbuf-2.0/*/loaders/libpixbufloader-bmp.so
39 getlib "$MACLIBDIR"/pango/*/modules/pango-basic-fc.so
40 getlib "$MACLIBDIR"/pango/*/modules/pango-basic-x.so
41
42 #cp -L "$MACLIBDIR"/../etc/fonts/fonts.conf "$INSTALLDIR"
43 #cp -L "$MACLIBDIR"/../etc/fonts/fonts.dtd "$INSTALLDIR"
44 #cp -L "$MACLIBDIR"/../etc/gtk-2.0/gdk-pixbuf.loaders "$INSTALLDIR"
45 #cp -L "$MACLIBDIR"/../etc/pango/pangorc "$INSTALLDIR"
46
47 $CAT > "$INSTALLDIR/../netradiant.sh" <<EOF
48 #!/bin/sh
49
50 MY_DIRECTORY="\${0%/*}" # cut off the script name
51 MY_DIRECTORY="\${MY_DIRECTORY%/*}" # cut off MacOS
52 MY_DIRECTORY="\${MY_DIRECTORY%/*}" # cut off Contents
53
54 export DYLD_LIBRARY_PATH="\$MY_DIRECTORY/Contents/MacOS/install"
55 export PANGO_RC_FILE="\$MY_DIRECTORY/Contents/MacOS/install/pangorc"
56 export GDK_PIXBUF_MODULE_FILE="\$MY_DIRECTORY/Contents/MacOS/install/gdk-pixbuf.loaders"
57 export FONTCONFIG_FILE="\$MY_DIRECTORY/Contents/MacOS/install/fonts.conf"
58
59 cd "\$MY_DIRECTORY/Contents/MacOS/install"
60 if [ -x /usr/bin/open-x11 ]; then
61         env LC_ALL="en_US.UTF-8" /usr/bin/open-x11 ./radiant.$EXE "$@" &
62 else
63         env LC_ALL="en_US.UTF-8" ./radiant.$EXE "$@" &
64 fi
65 EOF
66
67 chmod 755 "$INSTALLDIR/../netradiant.sh"
68