#!/bin/bash # # Download and build newest GTK+ / Glade. # # Since Glade usually depends on the newest GTK+-library, GTK+ and most of its # dependencies have to be built before Glade can be built. This script tries # to simplify this procedure. It does: # # - download sourcecode of Glade/GTK+ and its dependencies # - compile/install the dependencies in the right order # - compile/install Glade # # Note that this it not related to the Glade/GTK+-maintainers. # # :Author: Roland Koebler # :Version: 2014-06-10 (alpha) shopt -s nullglob set -e echo "glade_build.sh: Download/build/install newest Glade incl. dependencies." echo "Version 2014-06-10, Author: Roland Koebler (rk@simple-is-better.org)" echo #========================================= # configuration read -p "== Glade and GTK+, or only GTK+? 0) GTK+ 3 and Glade 1) only GTK+ 3 (0/1, default: 0) " TEST if [[ -z "$TEST" ]] || [[ "$TEST" == "0" ]]; then GLADE=1 elif [[ "$TEST" == "1" ]]; then GLADE=0 else echo "ERROR: Invalid choice '$TEST', must be 0, 1 or empty." exit 1 fi #========================================= # download # wget_latest "http://...3.18/" "LATEST-IS" "glade" ".tar.xz" "sha256" wget_latest() { DIR="$1" LATEST="$2" NAME="$3" EXT="$4" SUM="$5" echo "== $NAME..." VERSION=$(wget "$DIR" -O - | grep "$LATEST-" | tail -n 1 | sed "s/^.*\"$LATEST-\([-0-9\.]*[0-9]\).*/\1/") wget -c "$DIR/$NAME-$VERSION.$EXT" if [[ -n "$SUM" ]]; then wget -c "$DIR/$NAME-$VERSION.$SUM" if [[ "$SUM" == "sha1" ]] || [[ "${SUM##*.}" == "sha1" ]]; then sha1sum -c "$NAME-$VERSION.$SUM" else tail -n 1 "$NAME-$VERSION.$SUM" | sha256sum -c fi fi } read -p "== Download glade and its dependencies? " TEST if [[ "$TEST" == [yY] ]]; then if [[ "$GLADE" == "1" ]]; then wget_latest http://ftp.gnome.org/pub/GNOME/sources/glade/3.18/ "LATEST-IS" "glade" "tar.xz" "sha256sum" fi wget_latest http://ftp.gnome.org/pub/gnome/sources/gtk+/3.12/ "LATEST-IS" "gtk+" "tar.xz" "sha256sum" wget_latest http://ftp.gnome.org/pub/gnome/sources/glib/2.40/ "LATEST-IS" "glib" "tar.xz" "sha256sum" wget_latest http://ftp.gnome.org/pub/gnome/sources/atk/2.12/ "LATEST-IS" "atk" "tar.xz" "sha256sum" wget_latest http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.30/ "LATEST-IS" "gdk-pixbuf" "tar.xz" "sha256sum" wget_latest http://ftp.gnome.org/pub/gnome/sources/pango/1.36/ "LATEST-IS" "pango" "tar.xz" "sha256sum" wget_latest http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/1.40/ "LATEST-IS" "gobject-introspection" "tar.xz" "sha256sum" wget_latest http://www.cairographics.org/releases/ "LATEST-cairo" "cairo" "tar.xz" "tar.xz.sha1" wget_latest http://www.cairographics.org/releases/ "LATEST-pixman" "pixman" "tar.gz" "tar.gz.sha1" wget_latest http://www.freedesktop.org/software/fontconfig/release/ "fontconfig" "fontconfig" "tar.bz2" wget_latest http://www.freedesktop.org/software/harfbuzz/release/ "harfbuzz" "harfbuzz" "tar.bz2" "tar.bz2.sha256" #wget_latest http://people.freedesktop.org/~hadess/ "shared-mime-info" "shared-mime-info" ".tar.xz" # libiconf http://www.gnu.org/software/libiconv/ # gettext # x-window-system-dev # libpng, freetype, libxml echo fi #========================================= # configuration MYHOME=~ read -p "== Install-directory-prefix (default: $MYHOME/local): " TEST if [[ -z "$TEST" ]]; then PREFIX=~/local else PREFIX="$TEST" fi echo "-> install-dir-prefix: '""$PREFIX""'" echo #========================================= # compile/install # set +e CPPFLAGS=-I$PREFIX/include LDFLAGS=-L$PREFIX/lib PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig LD_LIBRARY_PATH=$PREFIX/lib PATH="$PREFIX/bin:$PATH" export CPPFLAGS LDFLAGS PKG_CONFIG_PATH export LD_LIBRARY_PATH PATH # dependencies: # - (shared-mime-info) # - GLib: shared-mime-info, (libiconf, gettext, pkgconfig, (libffi, libattr, libselinux)) # # - ATK: GLib # - gdk-pixbuf: GLib, libpng, ... # - GObject-introspection: GLib? # # - pixman: -- # - fontconfig: FreeType, expat # # - Cairo: pixman, fontconfig, libpng, FreeType, libx11, ... # (libz/zlib, libxrender, automake, autoconf, autoheader, aclocal, libtoolize, pkg-config >= 0.16) # # - HarfBuzz: Cairo, FreeType, GLib, graphite2? # # - Pango: HarfBuzz, Cairo (or Xft), fontconfig, FreeType, ... # # - GTK+: GLib, gobject-instrospection, ATK, GdkPixbuf, Pango, Cairo, freetype, shared-mime-info, ... # # - glade: GLib, GTK+, libxml, ... read -p "== Compile/install all? " TEST if [[ "$TEST" == [yY] ]]; then ALL=1 TEST="y" else ALL=0 fi for name in "glib-" "atk-" "gdk-pixbuf-" "gobject-introspection-" "pixman-" "fontconfig-" "cairo-" "harfbuzz-" "pango-" "gtk+-" "glade-"; do file="" DIR=$(pwd) if [[ "$GLADE" == "0" ]] && [[ "$name" == "glade-" ]]; then continue fi # find latest file for f in "$name"*.{xz,gz,bz2}; do file="$f" done if [ -z "$file" ]; then continue fi # unpack/compile if [[ "$ALL" == "0" ]]; then read -p "== Compile $file? " TEST fi if [[ "$TEST" == [yY] ]]; then dir="${file%.*.*}" if [[ ! -e "$dir" ]]; then echo "--- Unpacking $file..." tar -xf "$file" fi echo "--- Compiling $dir..." cd "$dir" ./configure --prefix="$PREFIX" && make echo else continue fi # install if [[ "$ALL" == "0" ]]; then read -p "== Install $dir? " TEST fi if [[ "$TEST" == [yY] ]]; then make install fi echo cd "$DIR" done #========================================= # install if [[ "$GLADE" == "1" ]]; then echo "== Creating glade.sh..." cat << EOF > glade.sh export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig/" export LD_LIBRARY_PATH="$PREFIX/lib/" export GSETTINGS_SCHEMA_DIR="$PREFIX/share/glib-2.0/schemas/" export PATH="$PREFIX/bin:$PATH" glade EOF chmod a+x glade.sh echo echo "Call './glade.sh' to start glade." fi #=========================================