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=." |
11 | |
15 | |
12 | umask 022 |
16 | umask 022 |
13 | |
17 | |
14 | if [ "$(uname -s)" = CYGWIN_NT-5.0 ]; then |
18 | if [ "$(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 | |
36 | elif [ "$(uname -s)" = Darwin ]; then |
40 | elif [ "$(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" |
46 | elif [ $(arch) = i686 ]; then |
51 | elif [ $(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 |
51 | else |
56 | else |
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 |
57 | fi |
62 | fi |
58 | |
63 | |
59 | export DIST="$(pwd)/dist/$OS-$ARCHNAME" |
64 | DISTf="dist/$OS-$ARCHNAME" |
|
|
65 | export DIST="$(pwd)/$DISTf" |
60 | |
66 | |
61 | rm -rf "$DIST" |
67 | eval $("$PERL" -V:sitebinexp:) |
62 | mkdir -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 \ |
67 | export EV_EVENTFD=0 |
72 | --copy "$DISTf" |
68 | export EV_INOTIFY=0 |
|
|
69 | export EV_SIGNALFD=0 |
|
|
70 | |
|
|
71 | if true; then |
|
|
72 | for mod in Deliantra CFPlus; do |
|
|
73 | # for mod in common-sense AnyEvent EV JSON-XS Deliantra Compress-LZF BDB Guard CFPlus; do |
|
|
74 | # for mod in CFPlus; do |
|
|
75 | ( |
|
|
76 | cd /root/src/$mod |
|
|
77 | cvs update -qAdP |
|
|
78 | $PERL Makefile.PL </dev/null >/dev/null |
|
|
79 | $MAKE clean >/dev/null |
|
|
80 | $PERL Makefile.PL </dev/null >/dev/null |
|
|
81 | if ! $MAKE install >log 2>&1; then |
|
|
82 | cat log |
|
|
83 | exit |
|
|
84 | fi |
|
|
85 | rm -f log |
|
|
86 | $MAKE clean >/dev/null |
|
|
87 | ) |
|
|
88 | done |
|
|
89 | fi |
|
|
90 | |
73 | |
91 | cat <<EOF >"$DIST"/pango.rc |
74 | cat <<EOF >"$DIST"/pango.rc |
92 | [Pango] |
75 | [Pango] |
93 | ModuleFiles = pango.modules |
76 | ModuleFiles = pango.modules |
94 | EOF |
77 | EOF |
… | |
… | |
97 | exec 5>"$DIST"/pango.modules |
80 | exec 5>"$DIST"/pango.modules |
98 | pango-querymodules | grep ^/ | while read lib rest; do |
81 | pango-querymodules | grep ^/ | while read lib rest; do |
99 | base=$(basename "$lib") |
82 | base=$(basename "$lib") |
100 | [ "$base" = pango-basic-x.$LIBEXT ] && continue |
83 | [ "$base" = pango-basic-x.$LIBEXT ] && continue |
101 | cp -p "$lib" "$DIST"/. |
84 | cp -p "$lib" "$DIST"/. |
102 | echo "$base $rest" >&5 |
85 | echo "./$base $rest" >&5 # using ./ seems to help pango not to rummage around in /usr/lib etc. |
103 | done |
86 | done |
104 | ) |
87 | ) |
105 | |
88 | |
106 | ############################################################################# |
89 | ############################################################################# |
107 | |
90 | |
… | |
… | |
110 | eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp) |
93 | eval $($PERL -V:sitebinexp -V:sitearchexp -V:sitelib -V:vendorarchexp -V:vendorlibexp -V:archlibexp -V:privlibexp) |
111 | |
94 | |
112 | mkdir -p "$DIST"/pm/bin |
95 | mkdir -p "$DIST"/pm/bin |
113 | cp "$sitebinexp"/deliantra "$DIST"/pm/bin/ |
96 | cp "$sitebinexp"/deliantra "$DIST"/pm/bin/ |
114 | cp -p util/run "$DIST" |
97 | cp -p util/run "$DIST" |
115 | |
|
|
116 | ( |
|
|
117 | exec <util/modules.dep |
|
|
118 | |
|
|
119 | # while read type name; do |
|
|
120 | # if [ "$type" = d ]; then |
|
|
121 | # # not implemented |
|
|
122 | # dir=$(echo "$name" | sed -e s%::%/%g) |
|
|
123 | # for lib in "$sitearchexp" "$sitelib" "$vendorarchexp" "$vendorlibexp" "$archlibexp" "$privlibexp"; do |
|
|
124 | # if [ -e "$lib/auto/$dir/.packlist" ]; then |
|
|
125 | # cat "$lib/auto/$dir/.packlist" |
|
|
126 | # fi |
|
|
127 | # echo "x $lib $dir" |
|
|
128 | # done |
|
|
129 | # elif [ $type = m ]; then |
|
|
130 | # : |
|
|
131 | # else |
|
|
132 | # echo "unknown type $type ($name)" |
|
|
133 | # exit 1 |
|
|
134 | # fi |
|
|
135 | # done |
|
|
136 | mkdir -p "$DIST"/pm |
|
|
137 | |
|
|
138 | export OSDIST="$DIST" |
|
|
139 | [ "$OS" = windows ] && OSDIST=$(cygpath -w "$OSDIST") |
|
|
140 | |
|
|
141 | $PERL -e ' |
|
|
142 | use Config; |
|
|
143 | use File::Glob qw(:glob); |
|
|
144 | use File::Copy; |
|
|
145 | use File::Path; |
|
|
146 | use File::Basename; |
|
|
147 | |
|
|
148 | my @path = do { |
|
|
149 | my %seen; |
|
|
150 | grep !$seen{$_}++, grep length, map $Config{$_}, qw( |
|
|
151 | sitearchexp |
|
|
152 | sitelib |
|
|
153 | vendorarchexp |
|
|
154 | vendorlibexp |
|
|
155 | archlibexp |
|
|
156 | privlibexp |
|
|
157 | ) |
|
|
158 | }; |
|
|
159 | |
|
|
160 | while (<>) { |
|
|
161 | s/\015?\012$//; |
|
|
162 | next if /^(#|$)/; |
|
|
163 | s/\.dynob$/.'$SO'/; |
|
|
164 | |
|
|
165 | my $found; |
|
|
166 | for my $lib (@path) { |
|
|
167 | chdir $lib || next; |
|
|
168 | |
|
|
169 | my @glob = File::Glob::bsd_glob $_, 0; # explicit 0 needed |
|
|
170 | |
|
|
171 | if (@glob) { |
|
|
172 | ++$found; |
|
|
173 | |
|
|
174 | for (@glob) { |
|
|
175 | if (-d $_) { |
|
|
176 | system "rsync", "-aR", $_, "$ENV{DIST}/pm/."; |
|
|
177 | } else { |
|
|
178 | File::Path::mkpath "$ENV{OSDIST}/pm/" . dirname $_; |
|
|
179 | File::Copy::syscopy "$_", "$ENV{OSDIST}/pm/$_" |
|
|
180 | or die "$ENV{OSDIST}/pm/$_: $!"; |
|
|
181 | |
|
|
182 | if (s/\.pm$//) { |
|
|
183 | $auto = "auto/$_"; |
|
|
184 | |
|
|
185 | for my $glob ("*.'$SO'", "autosplit.ix", "*.al") { |
|
|
186 | for (bsd_glob "$auto/$glob", 0) { |
|
|
187 | File::Path::mkpath "$ENV{OSDIST}/pm/" . dirname $_; |
|
|
188 | File::Copy::syscopy "$_", "$ENV{OSDIST}/pm/$_"; |
|
|
189 | } |
|
|
190 | } |
|
|
191 | } |
|
|
192 | } |
|
|
193 | } |
|
|
194 | |
|
|
195 | last; |
|
|
196 | } |
|
|
197 | } |
|
|
198 | |
|
|
199 | warn "$_: not found\n" |
|
|
200 | unless $found; |
|
|
201 | } |
|
|
202 | ' |
|
|
203 | ) || exit |
|
|
204 | |
98 | |
205 | ############################################################################# |
99 | ############################################################################# |
206 | |
100 | |
207 | if [ "$OS" = windows ]; then |
101 | if [ "$OS" = windows ]; then |
208 | libdeps() { |
102 | libdeps() { |
… | |
… | |
240 | } |
134 | } |
241 | |
135 | |
242 | ( |
136 | ( |
243 | cd "$DIST" |
137 | cd "$DIST" |
244 | |
138 | |
245 | cp -p "$PERL" . |
|
|
246 | |
|
|
247 | if [ "$OS" = windows ]; then |
139 | if [ "$OS" = windows ]; then |
248 | 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 . |
249 | cp /root/src/CFPlus/util/splash.bmp . |
141 | cp /root/src/CFPlus/util/splash.bmp . |
250 | chmod -R u+rwX pm/auto |
142 | chmod -R u+rwX pm/auto |
251 | |
143 | |
252 | # convert perl to a non-console-app |
144 | # convert perl to a non-console-app |
253 | $PERL -MWin32::Exe -e '$e = new Win32::Exe"perl.exe"; $e->set_subsystem_windows; $e->write' |
145 | $PERL -MWin32::Exe -e '$e = new Win32::Exe"perl.exe"; $e->set_subsystem_windows; $e->write' |
254 | |
146 | |
255 | else |
147 | else |
256 | # patch braindamaged pango |
|
|
257 | 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 |
|
|
258 | chmod 755 libpango-1.0.$LIB0 |
|
|
259 | |
|
|
260 | for lib in mikmod vorbisfile; do |
148 | for lib in mikmod vorbisfile; do |
261 | cp -p $SYSLIB/lib$lib.$LIB0 . |
149 | cp -p $SYSLIB/lib$lib.$LIB0 . |
262 | chmod 755 lib$lib.$LIB0 |
150 | chmod 755 lib$lib.$LIB0 |
263 | done |
151 | done |
264 | fi |
152 | fi |
… | |
… | |
272 | for lib in \ |
160 | for lib in \ |
273 | dl c m rt pthread nsl crypt \ |
161 | dl c m rt pthread nsl crypt \ |
274 | X11 Xext Xau Xdmcp ICE SM Xrandr Xrender Xxf86vm drm GL \ |
162 | X11 Xext Xau Xdmcp ICE SM Xrandr Xrender Xxf86vm drm GL \ |
275 | z |
163 | z |
276 | do |
164 | do |
277 | rm -f lib"$lib".$SO0 |
165 | rm -f lib"$lib".$LIB0 |
278 | 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 |
279 | |
180 | |
280 | if [ "$OS" = darwin ]; then |
181 | if [ "$OS" = darwin ]; then |
281 | # "dll hell" is most severe on os x, because apple |
182 | # "dll hell" is most severe on os x, because apple |
282 | # does not generally give a shit for backwards compatibility, |
183 | # does not generally give a shit for backwards compatibility, |
283 | # alwayss ships outdated libraries and often provides libraries |
184 | # alwayss ships outdated libraries and often provides libraries |
… | |
… | |
315 | patchlibs "$lib" |
216 | patchlibs "$lib" |
316 | mv "$lib" "libdeliantra-$stem.dylib" |
217 | mv "$lib" "libdeliantra-$stem.dylib" |
317 | done |
218 | done |
318 | fi |
219 | fi |
319 | |
220 | |
320 | [ "$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 |
321 | $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 |
322 | ) |
225 | ) |
323 | |
226 | |
324 | printf -- urlader$URLADER >"$DIST".urlader |
227 | cat >"$DIST".vars <<EOF |
|
|
228 | G_URLADER="$URLADER" |
|
|
229 | G_OS="$OS" |
|
|
230 | G_ARCHNAME="$ARCHNAME" |
|
|
231 | G_ENVVARS="$GENPACK_ENVVARS" |
|
|
232 | G_COMMAND="./perl run" |
|
|
233 | EOF |
325 | |
234 | |
326 | echo >"$DIST".genpack genpack deliantra_S-$OS-"$ARCHNAME" '"$EXE_VER"' '"$1"' $GENPACK_ENVVARS ./perl run |
|
|
327 | |
|
|
328 | exit |
|
|
329 | |
|
|
330 | |
|
|
331 | tar cf deliantra-gnu-linux-$ARCHNAME.tar deliantra-gnu-linux-$ARCHNAME |
|
|
332 | gzip -9vf deliantra-gnu-linux-$ARCHNAME.tar |
|
|
333 | todata deliantra-gnu-linux-$ARCHNAME.tar.gz |
|
|
334 | |
|
|