Support bracketed paste mode of xterm in mcedit.
[midnight-commander.git] / build-glib2.sh
blob71d0dd7f0f80bd264c476211582539dffa9e5159
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 3 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
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # This script is incomplete! It doesn't download libiconv. This is OK
21 # for glibc-based systems, but probably not for others. This limitation
22 # is known. Please don't report it.
25 : ${MC_TOPDIR=`pwd`}
26 : ${WORK_TOPDIR=$MC_TOPDIR/build_glib2}
27 : ${TMP_INSTDIR=$WORK_TOPDIR/tmp-inst}
28 : ${GLIB_VERSION=2.21.0}
29 : ${PKGC_VERSION=0.23}
30 : ${GETTEXT_VERSION=0.17}
32 GLIB_DIR="glib-$GLIB_VERSION"
33 GLIB_TARBALL="glib-$GLIB_VERSION.tar.gz"
34 GLIB_URL="ftp://ftp.gtk.org/pub/glib/2.21/$GLIB_TARBALL"
36 PKGC_DIR="pkg-config-$PKGC_VERSION"
37 PKGC_TARBALL="pkg-config-$PKGC_VERSION.tar.gz"
38 PKGC_URL="http://pkgconfig.freedesktop.org/releases/$PKGC_TARBALL"
40 GETTEXT_DIR="gettext-$GETTEXT_VERSION/gettext-runtime"
41 GETTEXT_TARBALL="gettext-$GETTEXT_VERSION.tar.gz"
42 GETTEXT_URL="ftp://ftp.gnu.org/gnu/gettext/$GETTEXT_TARBALL"
44 get_file() {
45 curl --remote-name "$1" || \
46 wget --passive-ftp "$1" || \
47 wget "$1" || \
48 ftp "$1" </dev/null || \
49 exit 1
51 if test ! -d $WORK_TOPDIR; then
52 mkdir -p $WORK_TOPDIR
55 if test -f $MC_TOPDIR/src/dir.c; then : ; else
56 echo "Not in the top-level directory of GNU Midnight Commander." 2>&1
57 exit 1
60 if test -f $MC_TOPDIR/configure; then : ; else
61 $MC_TOPDIR/autogen.sh --help >/dev/null || exit 1
64 rm -rf "$TMP_INSTDIR"
65 PATH="$TMP_INSTDIR/bin:$PATH"
66 export PATH
68 # Compile gettext
69 cd "$WORK_TOPDIR"
70 if gzip -vt "$GETTEXT_TARBALL"; then : ; else
71 get_file "$GETTEXT_URL"
74 rm -rf "$GETTEXT_DIR"
75 gzip -cd "$GETTEXT_TARBALL" | tar xf -
76 cd "$GETTEXT_DIR"
77 if test -f src/gettext.c; then : ; else
78 echo "gettext source is incomplete" 2>&1
79 exit 1
82 ./configure --disable-shared --disable-nls --prefix="$TMP_INSTDIR" || exit 1
83 make all || exit 1
84 make install || exit 1
86 # Compile pkgconfig
87 cd "$WORK_TOPDIR"
88 if gzip -vt "$PKGC_TARBALL"; then : ; else
89 get_file "$PKGC_URL"
92 rm -rf "$PKGC_DIR"
93 gzip -cd "$PKGC_TARBALL" | tar xf -
94 cd "$PKGC_DIR"
95 if test -f pkg.c; then : ; else
96 echo "pkgconfig source is incomplete" 2>&1
97 exit 1
100 ./configure --disable-shared --prefix="$TMP_INSTDIR" || exit 1
101 make all || exit 1
102 make install || exit 1
104 # Compile glib
105 cd "$WORK_TOPDIR"
106 if gzip -vt "$GLIB_TARBALL"; then : ; else
107 get_file "$GLIB_URL" || exit 1
110 rm -rf "$GLIB_DIR"
111 gzip -cd "$GLIB_TARBALL" | tar xf -
112 cd "$GLIB_DIR"
113 if test -f glib/glist.c; then : ; else
114 echo "glib source is incomplete" 2>&1
115 exit 1
118 ./configure --disable-shared --prefix="$TMP_INSTDIR" \
119 PKG_CONFIG="$TMP_INSTDIR/bin/pkg-config" \
120 CPPFLAGS="-I$TMP_INSTDIR/include" \
121 LDFLAGS="-L$TMP_INSTDIR/lib" || exit 1
122 make all || exit 1
123 make install || exit 1
125 cd "$MC_TOPDIR"
126 ./configure PKG_CONFIG="$TMP_INSTDIR/bin/pkg-config" $@ || exit 1
127 make clean || exit 1
128 make || exit 1
130 echo "GNU Midnight Commander has been successfully compiled"