1 | #!/bin/bash |
1 | #!/bin/bash |
|
|
2 | |
|
|
3 | # this gem of a hack gathers all files required by the client for the platform |
|
|
4 | # by deep magic, it works on osx, linux and windows. on MY osx, linux |
|
|
5 | # and windows, that is. |
2 | |
6 | |
3 | STRIP="strip" |
7 | STRIP="strip" |
4 | LIBEXT=so |
8 | LIBEXT=so |
5 | LIB0=so.? |
9 | LIB0=so.? |
6 | SO=so |
10 | SO=so |
7 | SYSLIB=/usr/lib |
11 | SYSLIB=/usr/lib |
8 | MAKE=make |
12 | MAKE=make |
9 | ARCHNAME=x86 |
13 | ARCHNAME=x86 |
10 | GENPACK_ENVVARS= |
14 | GENPACK_ENVVARS="LD_LIBRARY_PATH=." |
|
|
15 | EXTRA_EXTRACT= |
11 | |
16 | |
12 | umask 022 |
17 | umask 022 |
13 | |
18 | |
14 | if [ "$(uname -s)" = CYGWIN_NT-5.0 ]; then |
19 | if [ "$(uname -s)" = CYGWIN_NT-5.0 ]; then |
15 | . ~/.setenv |
20 | . ~/.setenv |
16 | |
21 | |
17 | OS=windows |
22 | OS=windows |
18 | URLADER=.exe |
23 | URLADER=windows-x86 |
19 | unset PANGO |
24 | unset PANGO |
20 | PERL=/c/perl/bin/perl |
25 | PERL=/c/perl/bin/perl |
21 | MAKE=nmake |
26 | MAKE=nmake |
22 | SYSLIB=/c/gtk/bin |
27 | SYSLIB=/c/gtk/bin |
23 | LIBEXT=dll |
28 | LIBEXT=dll |
24 | LIB0=dll |
29 | LIB0=dll |
25 | SO=dll |
30 | SO=dll |
26 | STRIP=":" # stripping the perl library kills it, and apparently, everythignis always stripped |
31 | STRIP=":" # stripping the perl library kills it, and apparently, everythignis always stripped |
|
|
32 | EXTRA_EXTRACT="-MWin32::GUI::SplashScreen" |
27 | |
33 | |
28 | # fontconfig apparently ignores env vars and always looks at ./etc/fonts/fonts.conf, |
34 | # fontconfig apparently ignores env vars and always looks at ./etc/fonts/fonts.conf, |
29 | # but only if . isn't actually called bin or lib. hope for the best. |
35 | # but only if . isn't actually called bin or lib. hope for the best. |
30 | GENPACK_ENVVARS="FONTCONFIG_PATH=pm/Deliantra/Client/private/resources/fonts FONTCONFIG_FILE=fonts.conf" |
36 | GENPACK_ENVVARS="FONTCONFIG_PATH=pm/Deliantra/Client/private/resources/fonts FONTCONFIG_FILE=fonts.conf" |
31 | |
37 | |
… | |
… | |
33 | /c/gtk/bin/pango-querymodules # empty output usually |
39 | /c/gtk/bin/pango-querymodules # empty output usually |
34 | } |
40 | } |
35 | |
41 | |
36 | elif [ "$(uname -s)" = Darwin ]; then |
42 | elif [ "$(uname -s)" = Darwin ]; then |
37 | OS=darwin |
43 | OS=darwin |
38 | URLADER=-osx105 |
44 | URLADER=darwin-x86 |
39 | PANGO=1.6.0 |
45 | PANGO=1.6.0 |
40 | PERL=/opt/local/bin/perl |
46 | PERL=/opt/local/bin/perl |
|
|
47 | GENPACK_ENVVARS="DYLD_LIBRARY_PATH=." |
41 | |
48 | |
42 | SYSLIB=/opt/local/lib |
49 | SYSLIB=/opt/local/lib |
43 | LIB0=dylib |
50 | LIB0=dylib |
44 | SO=bundle |
51 | SO=bundle |
45 | STRIP="strip -x" |
52 | STRIP="strip -x" |
46 | elif [ $(arch) = i686 ]; then |
53 | elif [ $(arch) = i686 ]; then |
47 | OS=linux |
54 | OS=linux |
48 | URLADER=-x86 |
55 | URLADER=linux-x86 |
49 | PANGO=1.5.0 |
56 | PANGO=1.5.0 |
50 | PERL=/usr/bin/perl |
57 | PERL=/usr/bin/perl |
51 | else |
58 | else |
52 | OS=linux |
59 | OS=linux |
53 | URLADER=-amd64 |
60 | URLADER=linux-amd64 |
54 | PANGO=1.5.0 |
61 | PANGO=1.5.0 |
55 | PERL=/usr/bin/perl |
62 | PERL=/usr/bin/perl |
56 | ARCHNAME=amd64 |
63 | ARCHNAME=amd64 |
57 | fi |
64 | fi |
58 | |
65 | |
59 | export DIST="$(pwd)/dist/$OS-$ARCHNAME" |
66 | DISTf="dist/$OS-$ARCHNAME" |
|
|
67 | export DIST="$(pwd)/$DISTf" |
60 | |
68 | |
61 | rm -rf "$DIST" |
69 | eval $("$PERL" -V:sitebinexp:) |
62 | mkdir -p "$DIST" |
|
|
63 | |
70 | |
64 | #PERL=/opt/perl |
71 | "$PERL" "$sitebinexp"/perl-libextractor --exedir . --dlldir . --bindir pm/bin --libdir pm \ |
65 | #PANGO=1.6.0 |
72 | --perl --core-support --script deliantra $EXTRA_EXTRACT \ |
66 | |
73 | --runtime-only \ |
67 | export EV_EVENTFD=0 |
74 | --copy "$DISTf" |
68 | export EV_INOTIFY=0 |
|
|
69 | export EV_SIGNALFD=0 |
|
|
70 | |
|
|
71 | if false; then |
|
|
72 | # for mod in common-sense AnyEvent EV JSON-XS Deliantra Compress-LZF BDB Guard CFPlus; do |
|
|
73 | for mod in CFPlus; do |
|
|
74 | ( |
|
|
75 | cd /root/src/$mod |
|
|
76 | $PERL Makefile.PL </dev/null |
|
|
77 | $MAKE clean |
|
|
78 | $PERL Makefile.PL </dev/null |
|
|
79 | $MAKE install || exit |
|
|
80 | $MAKE clean |
|
|
81 | ) |
|
|
82 | done |
|
|
83 | fi |
|
|
84 | |
75 | |
85 | cat <<EOF >"$DIST"/pango.rc |
76 | cat <<EOF >"$DIST"/pango.rc |
86 | [Pango] |
77 | [Pango] |
87 | ModuleFiles = pango.modules |
78 | ModuleFiles = pango.modules |
88 | EOF |
79 | EOF |
… | |
… | |
91 | exec 5>"$DIST"/pango.modules |
82 | exec 5>"$DIST"/pango.modules |
92 | pango-querymodules | grep ^/ | while read lib rest; do |
83 | pango-querymodules | grep ^/ | while read lib rest; do |
93 | base=$(basename "$lib") |
84 | base=$(basename "$lib") |
94 | [ "$base" = pango-basic-x.$LIBEXT ] && continue |
85 | [ "$base" = pango-basic-x.$LIBEXT ] && continue |
95 | cp -p "$lib" "$DIST"/. |
86 | cp -p "$lib" "$DIST"/. |
96 | echo "$base $rest" >&5 |
87 | echo "./$base $rest" >&5 # using ./ seems to help pango not to rummage around in /usr/lib etc. |
97 | done |
88 | done |
98 | ) |
89 | ) |
99 | |
90 | |
100 | ############################################################################# |
91 | ############################################################################# |
101 | |
92 | |
… | |
… | |
104 | eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp) |
95 | eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp) |
105 | |
96 | |
106 | mkdir -p "$DIST"/pm/bin |
97 | mkdir -p "$DIST"/pm/bin |
107 | cp "$sitebinexp"/deliantra "$DIST"/pm/bin/ |
98 | cp "$sitebinexp"/deliantra "$DIST"/pm/bin/ |
108 | cp -p util/run "$DIST" |
99 | cp -p util/run "$DIST" |
109 | |
|
|
110 | ( |
|
|
111 | exec <util/modules.dep |
|
|
112 | |
|
|
113 | # while read type name; do |
|
|
114 | # if [ "$type" = d ]; then |
|
|
115 | # # not implemented |
|
|
116 | # dir=$(echo "$name" | sed -e s%::%/%g) |
|
|
117 | # for lib in "$sitearchexp" "$sitelib" "$vendorarchexp" "$vendorlibexp" "$archlibexp" "$privlibexp"; do |
|
|
118 | # if [ -e "$lib/auto/$dir/.packlist" ]; then |
|
|
119 | # cat "$lib/auto/$dir/.packlist" |
|
|
120 | # fi |
|
|
121 | # echo "x $lib $dir" |
|
|
122 | # done |
|
|
123 | # elif [ $type = m ]; then |
|
|
124 | # : |
|
|
125 | # else |
|
|
126 | # echo "unknown type $type ($name)" |
|
|
127 | # exit 1 |
|
|
128 | # fi |
|
|
129 | # done |
|
|
130 | mkdir -p "$DIST"/pm |
|
|
131 | |
|
|
132 | export OSDIST="$DIST" |
|
|
133 | [ "$OS" = windows ] && OSDIST=$(cygpath -w "$OSDIST") |
|
|
134 | |
|
|
135 | $PERL -e ' |
|
|
136 | use Config; |
|
|
137 | use File::Glob qw(:glob); |
|
|
138 | use File::Copy; |
|
|
139 | use File::Path; |
|
|
140 | use File::Basename; |
|
|
141 | |
|
|
142 | my @path = do { |
|
|
143 | my %seen; |
|
|
144 | grep !$seen{$_}++, grep length, map $Config{$_}, qw( |
|
|
145 | sitearchexp |
|
|
146 | sitelib |
|
|
147 | vendorarchexp |
|
|
148 | vendorlibexp |
|
|
149 | archlibexp |
|
|
150 | privlibexp |
|
|
151 | ) |
|
|
152 | }; |
|
|
153 | |
|
|
154 | while (<>) { |
|
|
155 | s/\015?\012$//; |
|
|
156 | next if /^(#|$)/; |
|
|
157 | s/\.dynob$/.'$SO'/; |
|
|
158 | |
|
|
159 | my $found; |
|
|
160 | for my $lib (@path) { |
|
|
161 | chdir $lib || next; |
|
|
162 | |
|
|
163 | my @glob = File::Glob::bsd_glob $_, 0; # explicit 0 needed |
|
|
164 | |
|
|
165 | if (@glob) { |
|
|
166 | ++$found; |
|
|
167 | |
|
|
168 | for (@glob) { |
|
|
169 | if (-d $_) { |
|
|
170 | system "rsync", "-aR", $_, "$ENV{DIST}/pm/."; |
|
|
171 | } else { |
|
|
172 | File::Path::make_path "$ENV{OSDIST}/pm/" . dirname $_; |
|
|
173 | File::Copy::syscopy "$_", "$ENV{OSDIST}/pm/$_" |
|
|
174 | or die "$ENV{OSDIST}/pm/$_: $!"; |
|
|
175 | |
|
|
176 | if (s/\.pm$//) { |
|
|
177 | $auto = "auto/$_"; |
|
|
178 | |
|
|
179 | for my $glob ("*.'$SO'", "autosplit.ix", "*.al") { |
|
|
180 | for (bsd_glob "$auto/$glob", 0) { |
|
|
181 | File::Path::make_path "$ENV{OSDIST}/pm/" . dirname $_; |
|
|
182 | File::Copy::syscopy "$_", "$ENV{OSDIST}/pm/$_"; |
|
|
183 | } |
|
|
184 | } |
|
|
185 | } |
|
|
186 | } |
|
|
187 | } |
|
|
188 | |
|
|
189 | last; |
|
|
190 | } |
|
|
191 | } |
|
|
192 | |
|
|
193 | warn "$_: not found\n" |
|
|
194 | unless $found; |
|
|
195 | } |
|
|
196 | ' |
|
|
197 | ) || exit |
|
|
198 | |
100 | |
199 | ############################################################################# |
101 | ############################################################################# |
200 | |
102 | |
201 | if [ "$OS" = windows ]; then |
103 | if [ "$OS" = windows ]; then |
202 | libdeps() { |
104 | libdeps() { |
… | |
… | |
234 | } |
136 | } |
235 | |
137 | |
236 | ( |
138 | ( |
237 | cd "$DIST" |
139 | cd "$DIST" |
238 | |
140 | |
239 | # # patch braindamaged pango |
|
|
240 | if [ "$OS" != windows ]; then |
|
|
241 | perl -pe 's{/u(?=sr/lib(32)?/pango)}{/\x00}g; s{\Q'$PANGO'\E\x00}{y.t.u\x00}g' <$SYSLIB/libpango-1.0.$LIB0 >libpango-1.0.$LIB0 |
|
|
242 | chmod 755 libpango-1.0.$LIB0 |
|
|
243 | fi |
|
|
244 | |
|
|
245 | if [ "$OS" = windows ]; then |
141 | if [ "$OS" = windows ]; then |
246 | cp -p $SYSLIB/libvorbisfile-3.dll $SYSLIB/mikmod.dll $SYSLIB/libpng12-0.dll . |
142 | cp -p $SYSLIB/libvorbisfile-3.dll $SYSLIB/mikmod.dll $SYSLIB/libpng12-0.dll . |
247 | cp /root/src/CFPlus/util/splash.bmp . |
143 | cp /root/src/CFPlus/util/splash.bmp . |
248 | chmod -R u+rwX pm/auto |
144 | chmod -R u+rwX pm/auto |
|
|
145 | |
|
|
146 | # convert perl to a non-console-app |
|
|
147 | $PERL -MWin32::Exe -e '$e = new Win32::Exe"perl.exe"; $e->set_subsystem_windows; $e->write' |
|
|
148 | |
249 | else |
149 | else |
250 | for lib in mikmod vorbisfile; do |
150 | for lib in mikmod vorbisfile; do |
251 | cp -p $SYSLIB/lib$lib.$LIB0 . |
151 | cp -p $SYSLIB/lib$lib.$LIB0 . |
252 | chmod 755 lib$lib.$LIB0 |
152 | chmod 755 lib$lib.$LIB0 |
253 | done |
153 | done |
254 | fi |
154 | fi |
255 | |
|
|
256 | cp -p "$PERL" . |
|
|
257 | |
155 | |
258 | for so in $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl; do |
156 | for so in $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl; do |
259 | add_deps "$so" |
157 | add_deps "$so" |
260 | done |
158 | done |
261 | |
159 | |
… | |
… | |
264 | for lib in \ |
162 | for lib in \ |
265 | dl c m rt pthread nsl crypt \ |
163 | dl c m rt pthread nsl crypt \ |
266 | X11 Xext Xau Xdmcp ICE SM Xrandr Xrender Xxf86vm drm GL \ |
164 | X11 Xext Xau Xdmcp ICE SM Xrandr Xrender Xxf86vm drm GL \ |
267 | z |
165 | z |
268 | do |
166 | do |
269 | rm -f lib"$lib".$SO0 |
167 | rm -f lib"$lib".$LIB0 |
270 | done |
168 | done |
|
|
169 | |
|
|
170 | if [ "$OS" != windows ]; then |
|
|
171 | # patch braindamaged pango |
|
|
172 | |
|
|
173 | if [ "$OS" != darwin ]; then |
|
|
174 | set libpango-1.0.$LIB0 |
|
|
175 | perl -pe 's{/u(?=sr/lib(32)?/pango)}{.\x00}g;' <"$1" >"$1~" && mv "$1~" "$1" |
|
|
176 | else |
|
|
177 | set lib*pango-1.0.0.dylib |
|
|
178 | perl -pe 's{/o(?=pt/local/.../pango)}{.\x00}g;' <"$1" >"$1~" && mv "$1~" "$1" |
|
|
179 | fi |
|
|
180 | chmod 755 "$1" |
|
|
181 | fi |
271 | |
182 | |
272 | if [ "$OS" = darwin ]; then |
183 | if [ "$OS" = darwin ]; then |
273 | # "dll hell" is most severe on os x, because apple |
184 | # "dll hell" is most severe on os x, because apple |
274 | # does not generally give a shit for backwards compatibility, |
185 | # does not generally give a shit for backwards compatibility, |
275 | # alwayss ships outdated libraries and often provides libraries |
186 | # alwayss ships outdated libraries and often provides libraries |
… | |
… | |
307 | patchlibs "$lib" |
218 | patchlibs "$lib" |
308 | mv "$lib" "libdeliantra-$stem.dylib" |
219 | mv "$lib" "libdeliantra-$stem.dylib" |
309 | done |
220 | done |
310 | fi |
221 | fi |
311 | |
222 | |
312 | [ "$OS" = linux ] && chrpath -d perl # debian perls have an rpath. really. |
223 | [ "$OS" = linux ] && chrpath -d perl $(find pm -name "*.so") # debian perls have an rpath, many modules too |
313 | $STRIP $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl |
224 | $STRIP $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl |
|
|
225 | |
|
|
226 | : >timidity.cfg |
314 | ) |
227 | ) |
315 | |
228 | |
316 | printf -- urlader$URLADER >"$DIST".urlader |
229 | cat >"$DIST".vars <<EOF |
|
|
230 | G_URLADER="$URLADER" |
|
|
231 | G_OS="$OS" |
|
|
232 | G_ARCHNAME="$ARCHNAME" |
|
|
233 | G_ENVVARS="$GENPACK_ENVVARS" |
|
|
234 | G_COMMAND="./perl run" |
|
|
235 | EOF |
317 | |
236 | |
318 | echo >"$DIST".genpack genpack deliantra_S-$OS-"$ARCHNAME" '"$EXE_VER"' '"$1"' $GENPACK_ENVVARS./perl run |
|
|
319 | |
|
|
320 | exit |
|
|
321 | |
|
|
322 | |
|
|
323 | tar cf deliantra-gnu-linux-$ARCHNAME.tar deliantra-gnu-linux-$ARCHNAME |
|
|
324 | gzip -9vf deliantra-gnu-linux-$ARCHNAME.tar |
|
|
325 | todata deliantra-gnu-linux-$ARCHNAME.tar.gz |
|
|
326 | |
|
|