Fixed missing 'GNOME_VFS_OPEN_RANDOM' for the HTTP cabinets reading.
[captive.git] / build-static
1 #! /bin/bash
2
3 # $Id$
4 # Relink already built package fully statically.
5 # Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; exactly version 2 of June 1991 is required
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20
21 # It is not possible to just redefine Makefile variables as there are pushed
22 # various threading libraries etc. all the time.
23
24 # Designed+tested only for Fedora Core 4 (+updates). The list of libraries will
25 # definitely need to be changed for other distributions.
26
27 # Required precompiled static libraries .a and some .c stubs:
28 STATIC_PATH=/usr/local/devel-static
29
30
31 set -e
32 if test "$1" != link;then
33         set -x
34         ./autogen.pl --dist
35         (set -x;CFLAGS="-O2" ./configure --enable-maintainer-mode --disable-shared --enable-static --enable-install-pkg \
36                         --enable-standalone \
37                         --enable-standalone-fonts=/usr/local/share/captive/fonts \
38                 ) 2>&1|tee errs1
39         make clean
40         make 2>&1|tee errs2
41         set +x
42         fi
43
44 targets="
45                 src/client/fuse/mount.captive
46                 src/client/sandbox-server/captive-sandbox-server
47                 src/client/cmdline/captive-cmdline
48                 src/install/acquire/captive-install-acquire
49                 src/install/fstab/captive-install-fstab
50                 "
51 # FIXME: Make all the other relinks also properly conditional.
52 if grep -q 's,@ENABLE_BUG_REPLAY_TRUE@,,' config.status;then
53         targets="$targets
54                         src/client/bug-replay/captive-bug-replay
55                         "
56         fi
57 (for target in $targets;do
58         dir=`dirname $target`
59         base=`basename $target`
60         rm -f $target
61         # If you want to be really bad: s/-n// and s/_OBJ/OBJ/
62         objects="$(make -s -C $dir -f Makefile -f - print_objects <<HERE
63
64 print_objects:
65         echo '\$(addprefix $dir/,\$(`echo -n $base|tr -c a-zA-Z _`_OBJECTS))'
66
67 HERE
68 )"
69 #       set -x
70         gcc -O2 -static -Wall -Wstrict-prototypes -Wsign-compare -o $target $objects `pkg-config --cflags gmodule-2.0 gthread-2.0` $STATIC_PATH/src/*.c -L$STATIC_PATH/lib/ -L./src/install/libcaptive-install/ -lcaptive-install -L./src/libcaptive/.libs/ -lcaptive -L/usr/X11R6/lib -lgnomevfs-2 -lreadline -ltermcap -lcrypto -lntfs -lfuse -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangoxft-1.0 -lpangoft2-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lxml2 -lbonobo-2 -lgconf-2 -lbonobo-activation -lORBitCosNaming-2 -lORBit-2 -lm -lgthread-2.0 -lXft -lfontconfig -lfreetype -lexpat -lXrandr -lXinerama -lXfixes -lXcursor -lXext -lXrender -lX11 -lpng -lz -lglib-2.0 -lc -lnss_files -lnss_dns -lresolv
71         set +x
72         done) 2>&1|tee errs2
73 echo OK
74 ls -l $targets