ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/util/gatherer
(Generate patch)

Comparing deliantra/Deliantra-Client/util/gatherer (file contents):
Revision 1.1 by root, Fri Dec 30 04:17:19 2011 UTC vs.
Revision 1.13 by root, Fri Jan 27 01:43:03 2012 UTC

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
3STRIP="strip" 7STRIP="strip"
4LIBEXT=so 8LIBEXT=so
5LIB0=so.? 9LIB0=so.?
6SO=so 10SO=so
7SYSLIB=/usr/lib 11SYSLIB=/usr/lib
8MAKE=make 12MAKE=make
9ARCHNAME=x86 13ARCHNAME=x86
10GENPACK_ENVVARS= 14GENPACK_ENVVARS="LD_LIBRARY_PATH=."
11 15
12umask 022 16umask 022
13 17
14if [ "$(uname -s)" = CYGWIN_NT-5.0 ]; then 18if [ "$(uname -s)" = CYGWIN_NT-5.0 ]; then
15 . ~/.setenv 19 . ~/.setenv
16 20
17 OS=windows 21 OS=windows
18 URLADER=.exe 22 URLADER=windows-x86
19 unset PANGO 23 unset PANGO
20 PERL=/c/perl/bin/perl 24 PERL=/c/perl/bin/perl
21 MAKE=nmake 25 MAKE=nmake
22 SYSLIB=/c/gtk/bin 26 SYSLIB=/c/gtk/bin
23 LIBEXT=dll 27 LIBEXT=dll
33 /c/gtk/bin/pango-querymodules # empty output usually 37 /c/gtk/bin/pango-querymodules # empty output usually
34 } 38 }
35 39
36elif [ "$(uname -s)" = Darwin ]; then 40elif [ "$(uname -s)" = Darwin ]; then
37 OS=darwin 41 OS=darwin
38 URLADER=-osx105 42 URLADER=darwin-x86
39 PANGO=1.6.0 43 PANGO=1.6.0
40 PERL=/opt/local/bin/perl 44 PERL=/opt/local/bin/perl
45 GENPACK_ENVVARS="DYLD_LIBRARY_PATH=."
41 46
42 SYSLIB=/opt/local/lib 47 SYSLIB=/opt/local/lib
43 LIB0=dylib 48 LIB0=dylib
44 SO=bundle 49 SO=bundle
45 STRIP="strip -x" 50 STRIP="strip -x"
46elif [ $(arch) = i686 ]; then 51elif [ $(arch) = i686 ]; then
47 OS=linux 52 OS=linux
48 URLADER=-x86 53 URLADER=linux-x86
49 PANGO=1.5.0 54 PANGO=1.5.0
50 PERL=/usr/bin/perl 55 PERL=/usr/bin/perl
51else 56else
52 OS=linux 57 OS=linux
53 URLADER=-amd64 58 URLADER=linux-amd64
54 PANGO=1.5.0 59 PANGO=1.5.0
55 PERL=/usr/bin/perl 60 PERL=/usr/bin/perl
56 ARCHNAME=amd64 61 ARCHNAME=amd64
57fi 62fi
58 63
59export DIST="$(pwd)/dist/$OS-$ARCHNAME" 64DISTf="dist/$OS-$ARCHNAME"
65export DIST="$(pwd)/$DISTf"
60 66
61rm -rf "$DIST" 67eval $("$PERL" -V:sitebinexp:)
62mkdir -p "$DIST"
63 68
64#PERL=/opt/perl 69"$PERL" "$sitebinexp"/perl-libextractor --exedir . --dlldir . --bindir pm/bin --libdir pm \
65#PANGO=1.6.0 70 --perl --core-support --script deliantra \
66 71 --runtime-only --strip \
67export EV_EVENTFD=0 72 --copy "$DISTf"
68export EV_INOTIFY=0
69export EV_SIGNALFD=0
70
71if 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
83fi
84 73
85cat <<EOF >"$DIST"/pango.rc 74cat <<EOF >"$DIST"/pango.rc
86[Pango] 75[Pango]
87ModuleFiles = pango.modules 76ModuleFiles = pango.modules
88EOF 77EOF
91 exec 5>"$DIST"/pango.modules 80 exec 5>"$DIST"/pango.modules
92 pango-querymodules | grep ^/ | while read lib rest; do 81 pango-querymodules | grep ^/ | while read lib rest; do
93 base=$(basename "$lib") 82 base=$(basename "$lib")
94 [ "$base" = pango-basic-x.$LIBEXT ] && continue 83 [ "$base" = pango-basic-x.$LIBEXT ] && continue
95 cp -p "$lib" "$DIST"/. 84 cp -p "$lib" "$DIST"/.
96 echo "$base $rest" >&5 85 echo "./$base $rest" >&5 # using ./ seems to help pango not to rummage around in /usr/lib etc.
97 done 86 done
98) 87)
99 88
100############################################################################# 89#############################################################################
101 90
104eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp) 93eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp)
105 94
106mkdir -p "$DIST"/pm/bin 95mkdir -p "$DIST"/pm/bin
107cp "$sitebinexp"/deliantra "$DIST"/pm/bin/ 96cp "$sitebinexp"/deliantra "$DIST"/pm/bin/
108cp -p util/run "$DIST" 97cp -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 98
199############################################################################# 99#############################################################################
200 100
201if [ "$OS" = windows ]; then 101if [ "$OS" = windows ]; then
202 libdeps() { 102 libdeps() {
234} 134}
235 135
236( 136(
237 cd "$DIST" 137 cd "$DIST"
238 138
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 139 if [ "$OS" = windows ]; then
246 cp -p $SYSLIB/libvorbisfile-3.dll $SYSLIB/mikmod.dll $SYSLIB/libpng12-0.dll . 140 cp -p $SYSLIB/libvorbisfile-3.dll $SYSLIB/mikmod.dll $SYSLIB/libpng12-0.dll .
247 cp /root/src/CFPlus/util/splash.bmp . 141 cp /root/src/CFPlus/util/splash.bmp .
248 chmod -R u+rwX pm/auto 142 chmod -R u+rwX pm/auto
143
144 # convert perl to a non-console-app
145 $PERL -MWin32::Exe -e '$e = new Win32::Exe"perl.exe"; $e->set_subsystem_windows; $e->write'
146
249 else 147 else
250 for lib in mikmod vorbisfile; do 148 for lib in mikmod vorbisfile; do
251 cp -p $SYSLIB/lib$lib.$LIB0 . 149 cp -p $SYSLIB/lib$lib.$LIB0 .
252 chmod 755 lib$lib.$LIB0 150 chmod 755 lib$lib.$LIB0
253 done 151 done
254 fi 152 fi
255
256 cp -p "$PERL" .
257 153
258 for so in $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl; do 154 for so in $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl; do
259 add_deps "$so" 155 add_deps "$so"
260 done 156 done
261 157
264 for lib in \ 160 for lib in \
265 dl c m rt pthread nsl crypt \ 161 dl c m rt pthread nsl crypt \
266 X11 Xext Xau Xdmcp ICE SM Xrandr Xrender Xxf86vm drm GL \ 162 X11 Xext Xau Xdmcp ICE SM Xrandr Xrender Xxf86vm drm GL \
267 z 163 z
268 do 164 do
269 rm -f lib"$lib".$SO0 165 rm -f lib"$lib".$LIB0
270 done 166 done
167
168 if [ "$OS" != windows ]; then
169 # patch braindamaged pango
170
171 if [ "$OS" != darwin ]; then
172 set libpango-1.0.$LIB0
173 perl -pe 's{/u(?=sr/lib(32)?/pango)}{.\x00}g;' <"$1" >"$1~" && mv "$1~" "$1"
174 else
175 set lib*pango-1.0.0.dylib
176 perl -pe 's{/o(?=pt/local/.../pango)}{.\x00}g;' <"$1" >"$1~" && mv "$1~" "$1"
177 fi
178 chmod 755 "$1"
179 fi
271 180
272 if [ "$OS" = darwin ]; then 181 if [ "$OS" = darwin ]; then
273 # "dll hell" is most severe on os x, because apple 182 # "dll hell" is most severe on os x, because apple
274 # does not generally give a shit for backwards compatibility, 183 # does not generally give a shit for backwards compatibility,
275 # alwayss ships outdated libraries and often provides libraries 184 # alwayss ships outdated libraries and often provides libraries
307 patchlibs "$lib" 216 patchlibs "$lib"
308 mv "$lib" "libdeliantra-$stem.dylib" 217 mv "$lib" "libdeliantra-$stem.dylib"
309 done 218 done
310 fi 219 fi
311 220
312 [ "$OS" = linux ] && chrpath -d perl # debian perls have an rpath. really. 221 [ "$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 222 $STRIP $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl
223
224 : >timidity.cfg
314) 225)
315 226
316printf -- urlader$URLADER >"$DIST".urlader 227cat >"$DIST".vars <<EOF
228G_URLADER="$URLADER"
229G_OS="$OS"
230G_ARCHNAME="$ARCHNAME"
231G_ENVVARS="$GENPACK_ENVVARS"
232G_COMMAND="./perl run"
233EOF
317 234
318echo >"$DIST".genpack genpack deliantra_S-$OS-"$ARCHNAME" '"$EXE_VER"' '"$1"' $GENPACK_ENVVARS./perl run
319
320exit
321
322
323tar cf deliantra-gnu-linux-$ARCHNAME.tar deliantra-gnu-linux-$ARCHNAME
324gzip -9vf deliantra-gnu-linux-$ARCHNAME.tar
325todata deliantra-gnu-linux-$ARCHNAME.tar.gz
326

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines