build-glib2.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #! /bin/sh
  2. # Download and build glib 2.x statically with all dependencies and then
  3. # compile GNU Midnight Commander against it.
  4. # Copyright (C) 2003 Pavel Roskin
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  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 along
  17. # with this program; if not, write to the Free Software Foundation, Inc.,
  18. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. # This script is incomplete! It doesn't download libiconv. This is OK
  20. # for glibc-based systems, but probably not for others. This limitation
  21. # is known. Please don't report it.
  22. : ${MC_TOPDIR=`pwd`}
  23. : ${TMP_INSTDIR=$MC_TOPDIR/tmp-inst}
  24. : ${GLIB_VERSION=2.12.6}
  25. : ${PKGC_VERSION=0.21}
  26. : ${GETTEXT_VERSION=0.16.1}
  27. GLIB_DIR="glib-$GLIB_VERSION"
  28. GLIB_TARBALL="glib-$GLIB_VERSION.tar.gz"
  29. GLIB_URL="ftp://ftp.gtk.org/pub/glib/2.12/$GLIB_TARBALL"
  30. PKGC_DIR="pkg-config-$PKGC_VERSION"
  31. PKGC_TARBALL="pkg-config-$PKGC_VERSION.tar.gz"
  32. PKGC_URL="http://pkgconfig.freedesktop.org/releases/$PKGC_TARBALL"
  33. GETTEXT_DIR="gettext-$GETTEXT_VERSION/gettext-runtime"
  34. GETTEXT_TARBALL="gettext-$GETTEXT_VERSION.tar.gz"
  35. GETTEXT_URL="ftp://ftp.gnu.org/gnu/gettext/$GETTEXT_TARBALL"
  36. get_file() {
  37. curl --remote-name "$1" || \
  38. wget --passive-ftp "$1" || \
  39. wget "$1" || \
  40. ftp "$1" </dev/null || \
  41. exit 1
  42. }
  43. if test -f src/dir.c; then : ; else
  44. echo "Not in the top-level directory of GNU Midnight Commander." 2>&1
  45. exit 1
  46. fi
  47. if test -f configure; then : ; else
  48. ./autogen.sh --help >/dev/null || exit 1
  49. fi
  50. rm -rf "$TMP_INSTDIR"
  51. PATH="$TMP_INSTDIR/bin:$PATH"
  52. export PATH
  53. # Compile gettext
  54. cd "$MC_TOPDIR"
  55. if gzip -vt "$GETTEXT_TARBALL"; then : ; else
  56. get_file "$GETTEXT_URL"
  57. fi
  58. rm -rf "$GETTEXT_DIR"
  59. gzip -cd "$GETTEXT_TARBALL" | tar xf -
  60. cd "$GETTEXT_DIR"
  61. if test -f src/gettext.c; then : ; else
  62. echo "gettext source is incomplete" 2>&1
  63. exit 1
  64. fi
  65. ./configure --disable-shared --disable-nls --prefix="$TMP_INSTDIR" || exit 1
  66. make all || exit 1
  67. make install || exit 1
  68. # Compile pkgconfig
  69. cd "$MC_TOPDIR"
  70. if gzip -vt "$PKGC_TARBALL"; then : ; else
  71. get_file "$PKGC_URL"
  72. fi
  73. rm -rf "$PKGC_DIR"
  74. gzip -cd "$PKGC_TARBALL" | tar xf -
  75. cd "$PKGC_DIR"
  76. if test -f pkg.c; then : ; else
  77. echo "pkgconfig source is incomplete" 2>&1
  78. exit 1
  79. fi
  80. ./configure --disable-shared --prefix="$TMP_INSTDIR" || exit 1
  81. make all || exit 1
  82. make install || exit 1
  83. # Compile glib
  84. cd "$MC_TOPDIR"
  85. if gzip -vt "$GLIB_TARBALL"; then : ; else
  86. get_file "$GLIB_URL" || exit 1
  87. fi
  88. rm -rf "$GLIB_DIR"
  89. gzip -cd "$GLIB_TARBALL" | tar xf -
  90. cd "$GLIB_DIR"
  91. if test -f glib/glist.c; then : ; else
  92. echo "glib source is incomplete" 2>&1
  93. exit 1
  94. fi
  95. ./configure --disable-shared --prefix="$TMP_INSTDIR" \
  96. PKG_CONFIG="$TMP_INSTDIR/bin/pkg-config" \
  97. CPPFLAGS="-I$TMP_INSTDIR/include" \
  98. LDFLAGS="-L$TMP_INSTDIR/lib" || exit 1
  99. make all || exit 1
  100. make install || exit 1
  101. cd "$MC_TOPDIR"
  102. ./configure PKG_CONFIG="$TMP_INSTDIR/bin/pkg-config" || exit 1
  103. make clean || exit 1
  104. make || exit 1
  105. echo "GNU Midnight Commander has been successfully compiled"