fix for #188
[free-mc.git] / build-glib2.sh
blob3701772f564ba9e13889a8301adf823da3e4c867
1 #! /bin/sh
3 # Download and build glib 2.x statically with all dependencies and then
4 # compile GNU Midnight Commander against it.
5 # Copyright (C) 2003 Pavel Roskin
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; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # This script is incomplete! It doesn't download libiconv. This is OK
23 # for glibc-based systems, but probably not for others. This limitation
24 # is known. Please don't report it.
27 : ${MC_TOPDIR=`pwd`}
28 : ${TMP_INSTDIR=$MC_TOPDIR/tmp-inst}
29 : ${GLIB_VERSION=2.12.6}
30 : ${PKGC_VERSION=0.21}
31 : ${GETTEXT_VERSION=0.16.1}
33 GLIB_DIR="glib-$GLIB_VERSION"
34 GLIB_TARBALL="glib-$GLIB_VERSION.tar.gz"
35 GLIB_URL="ftp://ftp.gtk.org/pub/glib/2.12/$GLIB_TARBALL"
37 PKGC_DIR="pkg-config-$PKGC_VERSION"
38 PKGC_TARBALL="pkg-config-$PKGC_VERSION.tar.gz"
39 PKGC_URL="http://pkgconfig.freedesktop.org/releases/$PKGC_TARBALL"
41 GETTEXT_DIR="gettext-$GETTEXT_VERSION/gettext-runtime"
42 GETTEXT_TARBALL="gettext-$GETTEXT_VERSION.tar.gz"
43 GETTEXT_URL="ftp://ftp.gnu.org/gnu/gettext/$GETTEXT_TARBALL"
45 get_file() {
46 curl --remote-name "$1" || \
47 wget --passive-ftp "$1" || \
48 wget "$1" || \
49 ftp "$1" </dev/null || \
50 exit 1
53 if test -f src/dir.c; then : ; else
54 echo "Not in the top-level directory of GNU Midnight Commander." 2>&1
55 exit 1
58 if test -f configure; then : ; else
59 ./autogen.sh --help >/dev/null || exit 1
62 rm -rf "$TMP_INSTDIR"
63 PATH="$TMP_INSTDIR/bin:$PATH"
64 export PATH
66 # Compile gettext
67 cd "$MC_TOPDIR"
68 if gzip -vt "$GETTEXT_TARBALL"; then : ; else
69 get_file "$GETTEXT_URL"
72 rm -rf "$GETTEXT_DIR"
73 gzip -cd "$GETTEXT_TARBALL" | tar xf -
74 cd "$GETTEXT_DIR"
75 if test -f src/gettext.c; then : ; else
76 echo "gettext source is incomplete" 2>&1
77 exit 1
80 ./configure --disable-shared --disable-nls --prefix="$TMP_INSTDIR" || exit 1
81 make all || exit 1
82 make install || exit 1
84 # Compile pkgconfig
85 cd "$MC_TOPDIR"
86 if gzip -vt "$PKGC_TARBALL"; then : ; else
87 get_file "$PKGC_URL"
90 rm -rf "$PKGC_DIR"
91 gzip -cd "$PKGC_TARBALL" | tar xf -
92 cd "$PKGC_DIR"
93 if test -f pkg.c; then : ; else
94 echo "pkgconfig source is incomplete" 2>&1
95 exit 1
98 ./configure --disable-shared --prefix="$TMP_INSTDIR" || exit 1
99 make all || exit 1
100 make install || exit 1
102 # Compile glib
103 cd "$MC_TOPDIR"
104 if gzip -vt "$GLIB_TARBALL"; then : ; else
105 get_file "$GLIB_URL" || exit 1
108 rm -rf "$GLIB_DIR"
109 gzip -cd "$GLIB_TARBALL" | tar xf -
110 cd "$GLIB_DIR"
111 if test -f glib/glist.c; then : ; else
112 echo "glib source is incomplete" 2>&1
113 exit 1
116 ./configure --disable-shared --prefix="$TMP_INSTDIR" \
117 PKG_CONFIG="$TMP_INSTDIR/bin/pkg-config" \
118 CPPFLAGS="-I$TMP_INSTDIR/include" \
119 LDFLAGS="-L$TMP_INSTDIR/lib" || exit 1
120 make all || exit 1
121 make install || exit 1
123 cd "$MC_TOPDIR"
124 ./configure PKG_CONFIG="$TMP_INSTDIR/bin/pkg-config" || exit 1
125 make clean || exit 1
126 make || exit 1
128 echo "GNU Midnight Commander has been successfully compiled"