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.6 by root, Fri Dec 30 23:43:25 2011 UTC vs.
Revision 1.12 by root, Thu Jan 26 20:11:14 2012 UTC

1#!/bin/bash 1#!/bin/bash
2 2
3# this gem of a hack gathers all fiels required by the client for the platform 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 4# by deep magic, it works on osx, linux and windows. on MY osx, linux
5# and windows, that is. 5# and windows, that is.
6 6
7STRIP="strip" 7STRIP="strip"
8LIBEXT=so 8LIBEXT=so
17 17
18if [ "$(uname -s)" = CYGWIN_NT-5.0 ]; then 18if [ "$(uname -s)" = CYGWIN_NT-5.0 ]; then
19 . ~/.setenv 19 . ~/.setenv
20 20
21 OS=windows 21 OS=windows
22 URLADER=windowx-x86 22 URLADER=windows-x86
23 unset PANGO 23 unset PANGO
24 PERL=/c/perl/bin/perl 24 PERL=/c/perl/bin/perl
25 MAKE=nmake 25 MAKE=nmake
26 SYSLIB=/c/gtk/bin 26 SYSLIB=/c/gtk/bin
27 LIBEXT=dll 27 LIBEXT=dll
61 ARCHNAME=amd64 61 ARCHNAME=amd64
62fi 62fi
63 63
64export DIST="$(pwd)/dist/$OS-$ARCHNAME" 64export DIST="$(pwd)/dist/$OS-$ARCHNAME"
65 65
66rm -rf "$DIST" 66eval $($PERL -V:sitebinexp:)
67mkdir -p "$DIST"
68 67
69#PERL=/opt/perl 68"$sitebinexp"/perl-libextractor --exedir . --dlldir . --bindir pm/bin --libdir pm \
70#PANGO=1.6.0 69 --perl --core-support --script deliantra \
71 70 --runtime-only --strip \
72export EV_EVENTFD=0 71 --copy "$DIST"
73export EV_INOTIFY=0
74export EV_SIGNALFD=0
75
76if true; then
77 for mod in deliantra/Deliantra deliantra/Deliantra-Client; do
78# for mod in common-sense AnyEvent EV JSON-XS deliantra/Deliantra Compress-LZF BDB Guard deliantra/Deliantra-Client; do
79# for mod in CFPlus; do
80 (
81 cd /root/src/$mod || exit
82 cvs update -AdP
83 rm -rf blib
84 $PERL Makefile.PL </dev/null >/dev/null
85 $MAKE clean >/dev/null
86 $PERL Makefile.PL </dev/null >/dev/null
87 if ! $MAKE install >log 2>&1; then
88 echo
89 echo error while building $mod
90 cat log
91 exit
92 fi
93 rm -f log
94 $MAKE clean >/dev/null
95 ) || exit
96 done
97fi
98 72
99cat <<EOF >"$DIST"/pango.rc 73cat <<EOF >"$DIST"/pango.rc
100[Pango] 74[Pango]
101ModuleFiles = pango.modules 75ModuleFiles = pango.modules
102EOF 76EOF
105 exec 5>"$DIST"/pango.modules 79 exec 5>"$DIST"/pango.modules
106 pango-querymodules | grep ^/ | while read lib rest; do 80 pango-querymodules | grep ^/ | while read lib rest; do
107 base=$(basename "$lib") 81 base=$(basename "$lib")
108 [ "$base" = pango-basic-x.$LIBEXT ] && continue 82 [ "$base" = pango-basic-x.$LIBEXT ] && continue
109 cp -p "$lib" "$DIST"/. 83 cp -p "$lib" "$DIST"/.
110 echo "$base $rest" >&5 84 echo "./$base $rest" >&5 # using ./ seems to help pango not to rummage around in /usr/lib etc.
111 done 85 done
112) 86)
113 87
114############################################################################# 88#############################################################################
115 89
118eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp) 92eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp)
119 93
120mkdir -p "$DIST"/pm/bin 94mkdir -p "$DIST"/pm/bin
121cp "$sitebinexp"/deliantra "$DIST"/pm/bin/ 95cp "$sitebinexp"/deliantra "$DIST"/pm/bin/
122cp -p util/run "$DIST" 96cp -p util/run "$DIST"
123
124(
125 exec <util/modules.dep
126
127# while read type name; do
128# if [ "$type" = d ]; then
129# # not implemented
130# dir=$(echo "$name" | sed -e s%::%/%g)
131# for lib in "$sitearchexp" "$sitelib" "$vendorarchexp" "$vendorlibexp" "$archlibexp" "$privlibexp"; do
132# if [ -e "$lib/auto/$dir/.packlist" ]; then
133# cat "$lib/auto/$dir/.packlist"
134# fi
135# echo "x $lib $dir"
136# done
137# elif [ $type = m ]; then
138# :
139# else
140# echo "unknown type $type ($name)"
141# exit 1
142# fi
143# done
144 mkdir -p "$DIST"/pm
145
146 export OSDIST="$DIST"
147 [ "$OS" = windows ] && OSDIST=$(cygpath -w "$OSDIST")
148
149 $PERL -e '
150 use Config;
151 use File::Glob qw(:glob);
152 use File::Copy;
153 use File::Path;
154 use File::Basename;
155
156 my @path = do {
157 my %seen;
158 grep !$seen{$_}++, grep length, map $Config{$_}, qw(
159 sitearchexp
160 sitelib
161 vendorarchexp
162 vendorlibexp
163 archlibexp
164 privlibexp
165 )
166 };
167
168 while (<>) {
169 s/\015?\012$//;
170 next if /^(#|$)/;
171 s/\.dynob$/.'$SO'/;
172
173 my $found;
174 for my $lib (@path) {
175 chdir $lib || next;
176
177 my @glob = File::Glob::bsd_glob $_, 0; # explicit 0 needed
178
179 if (@glob) {
180 ++$found;
181
182 for (@glob) {
183 if (-d $_) {
184 system "rsync", "-aR", $_, "$ENV{DIST}/pm/.";
185 } else {
186 File::Path::mkpath "$ENV{OSDIST}/pm/" . dirname $_;
187 File::Copy::syscopy "$_", "$ENV{OSDIST}/pm/$_"
188 or die "$ENV{OSDIST}/pm/$_: $!";
189
190 if (s/\.pm$//) {
191 $auto = "auto/$_";
192
193 for my $glob ("*.'$SO'", "autosplit.ix", "*.al") {
194 for (bsd_glob "$auto/$glob", 0) {
195 File::Path::mkpath "$ENV{OSDIST}/pm/" . dirname $_;
196 File::Copy::syscopy "$_", "$ENV{OSDIST}/pm/$_";
197 }
198 }
199 }
200 }
201 }
202
203 last;
204 }
205 }
206
207 warn "$_: not found\n"
208 unless $found;
209 }
210 '
211) || exit
212 97
213############################################################################# 98#############################################################################
214 99
215if [ "$OS" = windows ]; then 100if [ "$OS" = windows ]; then
216 libdeps() { 101 libdeps() {
248} 133}
249 134
250( 135(
251 cd "$DIST" 136 cd "$DIST"
252 137
253 cp -p "$PERL" .
254
255 if [ "$OS" = windows ]; then 138 if [ "$OS" = windows ]; then
256 cp -p $SYSLIB/libvorbisfile-3.dll $SYSLIB/mikmod.dll $SYSLIB/libpng12-0.dll . 139 cp -p $SYSLIB/libvorbisfile-3.dll $SYSLIB/mikmod.dll $SYSLIB/libpng12-0.dll .
257 cp /root/src/CFPlus/util/splash.bmp . 140 cp /root/src/CFPlus/util/splash.bmp .
258 chmod -R u+rwX pm/auto 141 chmod -R u+rwX pm/auto
259 142
281 rm -f lib"$lib".$LIB0 164 rm -f lib"$lib".$LIB0
282 done 165 done
283 166
284 if [ "$OS" != windows ]; then 167 if [ "$OS" != windows ]; then
285 # patch braindamaged pango 168 # patch braindamaged pango
169
170 if [ "$OS" != darwin ]; then
286 set libpango-1.0.$LIB0 171 set libpango-1.0.$LIB0
287 perl -pe 's{/u(?=sr/lib(32)?/pango)}{/\x00}g; s{\Q'$PANGO'\E\x00}{y.t.u\x00}g' <"$1" >"$1~" && mv "$1~" "$1" 172 perl -pe 's{/u(?=sr/lib(32)?/pango)}{.\x00}g;' <"$1" >"$1~" && mv "$1~" "$1"
173 else
174 set lib*pango-1.0.0.dylib
175 perl -pe 's{/o(?=pt/local/.../pango)}{.\x00}g;' <"$1" >"$1~" && mv "$1~" "$1"
176 fi
288 chmod 755 "$1" 177 chmod 755 "$1"
289 fi 178 fi
290 179
291 if [ "$OS" = darwin ]; then 180 if [ "$OS" = darwin ]; then
292 # "dll hell" is most severe on os x, because apple 181 # "dll hell" is most severe on os x, because apple
326 patchlibs "$lib" 215 patchlibs "$lib"
327 mv "$lib" "libdeliantra-$stem.dylib" 216 mv "$lib" "libdeliantra-$stem.dylib"
328 done 217 done
329 fi 218 fi
330 219
331 [ "$OS" = linux ] && chrpath -d perl # debian perls have an rpath. really. 220 [ "$OS" = linux ] && chrpath -d perl $(find pm -name "*.so") # debian perls have an rpath, many modules too
332 $STRIP $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl 221 $STRIP $(find . -name "*.$SO" -o -name "*.$LIBEXT" -o -name "*.$LIB0") perl
222
223 : >timidity.cfg
333) 224)
334 225
335cat >"$DIST".vars <<EOF 226cat >"$DIST".vars <<EOF
336G_URLADER="$URLADER" 227G_URLADER="$URLADER"
337G_OS="$OS" 228G_OS="$OS"
338G_ARCHNAME="$ARCHNAME" 229G_ARCHNAME="$ARCHNAME"
339G_ENVVARS="$GENPACK_ENVVARS" 230G_ENVVARS="$GENPACK_ENVVARS"
340G_ARGS="./perl run" 231G_COMMAND="./perl run"
341EOF 232EOF
342 233

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines