[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # Copyright 2008, 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA |
---|
| 4 | # All rights reserved. |
---|
| 5 | # |
---|
| 6 | # Redistribution and use of this script, with or without modification, is |
---|
| 7 | # permitted provided that the following conditions are met: |
---|
| 8 | # |
---|
| 9 | # 1. Redistributions of this script must retain the above copyright |
---|
| 10 | # notice, this list of conditions and the following disclaimer. |
---|
| 11 | # |
---|
| 12 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
| 13 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
| 14 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
| 15 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 16 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 17 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
| 18 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
| 19 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
| 20 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
| 21 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | VERSION=${VERSION:-$(echo gtk+-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
---|
| 25 | BUILD=${BUILD:-3} |
---|
| 26 | |
---|
| 27 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
| 28 | |
---|
| 29 | # Automatically determine the architecture we're building on: |
---|
| 30 | if [ -z "$ARCH" ]; then |
---|
| 31 | case "$( uname -m )" in |
---|
| 32 | i?86) export ARCH=i586 ;; |
---|
| 33 | arm*) export ARCH=arm ;; |
---|
| 34 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
| 35 | *) export ARCH=$( uname -m ) ;; |
---|
| 36 | esac |
---|
| 37 | fi |
---|
| 38 | |
---|
| 39 | CWD=$(pwd) |
---|
| 40 | TMP=${TMP:-/tmp} |
---|
| 41 | PKG=$TMP/package-gtk2 |
---|
| 42 | |
---|
| 43 | if [ "$ARCH" = "i586" ]; then |
---|
| 44 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
| 45 | LIBDIRSUFFIX="" |
---|
| 46 | elif [ "$ARCH" = "s390" ]; then |
---|
| 47 | SLKCFLAGS="-O2" |
---|
| 48 | LIBDIRSUFFIX="" |
---|
| 49 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 50 | SLKCFLAGS="-O2 -fPIC" |
---|
| 51 | LIBDIRSUFFIX="64" |
---|
| 52 | else |
---|
| 53 | SLKCFLAGS="-O2" |
---|
| 54 | LIBDIRSUFFIX="" |
---|
| 55 | fi |
---|
| 56 | |
---|
| 57 | rm -rf $PKG |
---|
| 58 | mkdir -p $TMP $PKG/usr |
---|
| 59 | cd $TMP |
---|
| 60 | rm -rf gtk+-$VERSION |
---|
| 61 | tar xvf $CWD/gtk+-$VERSION.tar.?z* || exit 1 |
---|
| 62 | cd gtk+-$VERSION |
---|
| 63 | |
---|
| 64 | chown -R root:root . |
---|
| 65 | find . \ |
---|
| 66 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
| 67 | -exec chmod 755 {} \; -o \ |
---|
| 68 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
| 69 | -exec chmod 644 {} \; |
---|
| 70 | |
---|
| 71 | # Fix build errors |
---|
| 72 | zcat $CWD/fix_build_issues_on_tutorial_and_faq.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 73 | |
---|
| 74 | # Do not flood the console or .xsession-errors with "trouble ahead" |
---|
| 75 | # warnings (most noticable when using Firefox and Flash): |
---|
| 76 | zcat $CWD/gtk.xid.nowarningflood.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 77 | |
---|
| 78 | # Patch to restore commonly used icon names, otherwise everything breaks. |
---|
| 79 | # I fail to see the point of this "cleanup" |
---|
| 80 | zcat $CWD/gtk+-2.24.x.icon-compat.am.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 81 | zcat $CWD/gtk+-2.24.x.icon-compat.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 82 | |
---|
| 83 | # Prevents build failures in the docs. Found online. |
---|
| 84 | # Only needed if autoreconf is used... ? |
---|
| 85 | zcat $CWD/gtk.gtk-faq.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 86 | zcat $CWD/gtk.gtk-tut.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 87 | |
---|
| 88 | # Regenerate ./configure: |
---|
| 89 | libtoolize --force |
---|
| 90 | autoreconf -vif |
---|
| 91 | |
---|
| 92 | # Autoconf changes linux to linux-gnu. |
---|
| 93 | # Our host is $ARCH-slackware-linux not $ARCH-slackware-linux-gnu: |
---|
| 94 | sed -i -e 's#linux|linux-gnu|#linux|linux|#' config.sub |
---|
| 95 | |
---|
| 96 | CFLAGS="$SLKCFLAGS" \ |
---|
| 97 | ./configure \ |
---|
| 98 | --prefix=/usr \ |
---|
| 99 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
| 100 | --sysconfdir=/etc \ |
---|
| 101 | --mandir=/usr/man \ |
---|
| 102 | --with-xinput=yes \ |
---|
| 103 | --enable-xkb \ |
---|
| 104 | --enable-introspection \ |
---|
| 105 | --build=$ARCH-slackware-linux |
---|
| 106 | |
---|
| 107 | make $NUMJOBS || make || exit 1 |
---|
| 108 | |
---|
| 109 | # Check the host value that is passed to the compile to the one in this script: |
---|
| 110 | host="$ARCH-slackware-linux" |
---|
| 111 | compile_host=$(grep 'host_triplet =' gtk/Makefile | sed -e "s/.* = //") |
---|
| 112 | if [ "x$compile_host" != "x$host" ]; then |
---|
| 113 | echo "Host mismatch: compile='$compile_host', SlackBuild='$host'" && exit 1 |
---|
| 114 | fi |
---|
| 115 | |
---|
| 116 | make install \ |
---|
| 117 | RUN_QUERY_IMMODULES_TEST=false RUN_QUERY_LOADER_TEST=false \ |
---|
| 118 | DESTDIR=$PKG \ |
---|
| 119 | || exit 1 |
---|
| 120 | |
---|
| 121 | # Don't clobber im-multipress.conf |
---|
| 122 | mv $PKG/etc/gtk-2.0/im-multipress.conf $PKG/etc/gtk-2.0/im-multipress.conf.new || exit 1 |
---|
| 123 | |
---|
| 124 | # Install a "starter" gtkrc |
---|
| 125 | # /etc/gtk-2.0/gtkrc overrides this --rworkman |
---|
| 126 | echo 'gtk-theme-name="GTK+"' > $PKG/usr/share/gtk-2.0/gtkrc |
---|
| 127 | |
---|
| 128 | # We need to have separate 32-bit and 64-bit binaries |
---|
| 129 | # for places where we have two copies of the GTK+ package installed. |
---|
| 130 | # (we might have x86_64 and i486 packages on the same system, for example.) |
---|
| 131 | case "$host" in |
---|
| 132 | s390x*|x86_64*) |
---|
| 133 | mv $PKG/usr/bin/gtk-query-immodules-2.0{,-64} |
---|
| 134 | ( cd $PKG/usr/bin |
---|
| 135 | ln -sf gtk-query-immodules-2.0-64 gtk-query-immodules-2.0 |
---|
| 136 | ) |
---|
| 137 | ;; |
---|
| 138 | *) |
---|
| 139 | mv $PKG/usr/bin/gtk-query-immodules-2.0{,-32} |
---|
| 140 | ( cd $PKG/usr/bin |
---|
| 141 | ln -sf gtk-query-immodules-2.0-32 gtk-query-immodules-2.0 |
---|
| 142 | ) |
---|
| 143 | ;; |
---|
| 144 | esac |
---|
| 145 | |
---|
| 146 | # Install wrappers for the binaries: |
---|
| 147 | cp -a $CWD/update-gtk-immodules* $PKG/usr/bin |
---|
| 148 | chown root:root $PKG/usr/bin/update-* |
---|
| 149 | chmod 0755 $PKG/usr/bin/update-* |
---|
| 150 | |
---|
| 151 | # Add profile scripts to set up GTK+ environment: |
---|
| 152 | mkdir -p $PKG/etc/profile.d |
---|
| 153 | cp -a $CWD/profile.d/* $PKG/etc/profile.d |
---|
| 154 | chmod 0755 $PKG/etc/profile.d/* |
---|
| 155 | |
---|
| 156 | # Strip binaries: |
---|
| 157 | ( cd $PKG |
---|
| 158 | find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
| 159 | find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
| 160 | ) |
---|
| 161 | |
---|
| 162 | # Compress and if needed symlink the man pages: |
---|
| 163 | if [ -d $PKG/usr/man ]; then |
---|
| 164 | ( cd $PKG/usr/man |
---|
| 165 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
| 166 | ( cd $manpagedir |
---|
| 167 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
| 168 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
| 169 | rm $eachpage |
---|
| 170 | done |
---|
| 171 | gzip -9 *.? |
---|
| 172 | ) |
---|
| 173 | done |
---|
| 174 | ) |
---|
| 175 | fi |
---|
| 176 | |
---|
| 177 | mkdir -p $PKG/usr/doc/gtk+-$VERSION |
---|
| 178 | cp -a \ |
---|
| 179 | AUTHORS COPYING* NEWS README* TODO \ |
---|
| 180 | $PKG/usr/doc/gtk+-$VERSION |
---|
| 181 | ( cd $PKG/usr/doc/gtk+-$VERSION |
---|
| 182 | ln -s ../../share/gtk-doc/html/gail-libgail-util . |
---|
| 183 | ln -s ../../share/gtk-doc/html/gdk . |
---|
| 184 | ln -s ../../share/gtk-doc/html/gtk . |
---|
| 185 | ) |
---|
| 186 | |
---|
| 187 | # If there's a ChangeLog, installing at least part of the recent history |
---|
| 188 | # is useful, but don't let it get totally out of control: |
---|
| 189 | if [ -r ChangeLog ]; then |
---|
| 190 | DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) |
---|
| 191 | cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog |
---|
| 192 | touch -r ChangeLog $DOCSDIR/ChangeLog |
---|
| 193 | fi |
---|
| 194 | |
---|
| 195 | mkdir -p $PKG/install |
---|
| 196 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 197 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
---|
| 198 | |
---|
| 199 | cd $PKG |
---|
| 200 | /sbin/makepkg -l y -c n $TMP/gtk+2-$VERSION-$ARCH-$BUILD.txz |
---|
| 201 | |
---|