Fixed message typo.
[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/staticbuild
29
30
31 set -e -o pipefail
32 if test "$1" != link;then
33         set -x
34         ./autogen.pl --dist
35         (set -x;CFLAGS="-O2" CPPFLAGS="-I$STATIC_PATH/include/gnome-vfs-module-2.0" \
36                         ./configure --enable-maintainer-mode --disable-shared --enable-static --enable-install-pkg \
37                         --enable-standalone \
38                         --enable-standalone-fonts=/usr/local/share/captive/fonts \
39                         --disable-standalone-yum \
40                 ) 2>&1|tee errs1
41 #                       --enable-standalone-yum=/etc/yum.repos.d
42         make clean
43         make 2>&1|tee errs2
44         set +x
45         fi
46
47 targets="
48                 src/client/fuse/mount.captive
49                 src/client/fuse/captive-fusermount
50                 src/client/sandbox-server/captive-sandbox-server
51                 src/client/cmdline/captive-cmdline
52                 src/install/acquire/captive-install-acquire
53                 src/install/fstab/captive-install-fstab
54                 "
55 # FIXME: Make all the other relinks also properly conditional.
56 if grep -q 's,@ENABLE_BUG_REPLAY_TRUE@,,' config.status;then
57         targets="$targets
58                         src/client/bug-replay/captive-bug-replay
59                         "
60         fi
61 (for target in $targets;do
62         dir=`dirname $target`
63         base=`basename $target`
64         rm -f $target
65         # If you want to be really bad: s/-n// and s/_OBJ/OBJ/
66         objects="$(make -s -C $dir -f Makefile -f - print_objects <<HERE
67
68 print_objects:
69         echo '\$(addprefix $dir/,\$(`echo -n $base|tr -c a-zA-Z _`_OBJECTS))'
70
71 HERE
72 )"
73 #       set -x
74         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 -L/usr/lib/gnome-vfs-2.0/modules -lgnomevfs-2 -lreadline -ltermcap -lcrypto -lntfs-gnomevfs -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
75         set +x
76         done) 2>&1|tee errs2
77 echo OK
78 ls -l $targets