[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # Copyright 2010, 2011 Robby Workman, Northport, Alabama, USA |
---|
| 4 | # Copyright 2010, 2011 Patrick Volkerding, Sebeka, Minnesota, USA |
---|
| 5 | # All rights reserved. |
---|
| 6 | # |
---|
| 7 | # Redistribution and use of this script, with or without modification, is |
---|
| 8 | # permitted provided that the following conditions are met: |
---|
| 9 | # |
---|
| 10 | # 1. Redistributions of this script must retain the above copyright |
---|
| 11 | # notice, this list of conditions and the following disclaimer. |
---|
| 12 | # |
---|
| 13 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED |
---|
| 14 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
| 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
| 16 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 17 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 18 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
| 19 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
| 20 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
| 21 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
| 22 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 23 | |
---|
| 24 | PKGNAM=gdk-pixbuf |
---|
| 25 | VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
---|
| 26 | BUILD=${BUILD:-1} |
---|
| 27 | |
---|
| 28 | # Automatically determine the architecture we're building on: |
---|
| 29 | if [ -z "$ARCH" ]; then |
---|
| 30 | case "$( uname -m )" in |
---|
| 31 | i?86) export ARCH=i586 ;; |
---|
| 32 | arm*) export ARCH=arm ;; |
---|
| 33 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
| 34 | *) export ARCH=$( uname -m ) ;; |
---|
| 35 | esac |
---|
| 36 | fi |
---|
| 37 | |
---|
| 38 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
| 39 | |
---|
| 40 | CWD=$(pwd) |
---|
| 41 | TMP=${TMP:-/tmp} |
---|
| 42 | PKG=$TMP/package-$PKGNAM |
---|
| 43 | |
---|
| 44 | if [ "$ARCH" = "i586" ]; then |
---|
| 45 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
| 46 | LIBDIRSUFFIX="" |
---|
| 47 | elif [ "$ARCH" = "i686" ]; then |
---|
| 48 | SLKCFLAGS="-O2 -march=i686 -mtune=i686" |
---|
| 49 | LIBDIRSUFFIX="" |
---|
| 50 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 51 | SLKCFLAGS="-O2 -fPIC" |
---|
| 52 | LIBDIRSUFFIX="64" |
---|
| 53 | else |
---|
| 54 | SLKCFLAGS="-O2" |
---|
| 55 | LIBDIRSUFFIX="" |
---|
| 56 | fi |
---|
| 57 | |
---|
| 58 | rm -rf $PKG |
---|
| 59 | mkdir -p $TMP $PKG |
---|
| 60 | cd $TMP |
---|
| 61 | rm -rf $PKGNAM-$VERSION |
---|
| 62 | tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1 |
---|
| 63 | cd $PKGNAM-$VERSION || exit 1 |
---|
| 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 | # There's been this long standing debate about PNG and -lz |
---|
| 72 | # and this patch is the workaround. ;-) |
---|
| 73 | zcat $CWD/gdk-pixbuf.pnglz.diff.gz | patch -p1 || exit 1 |
---|
| 74 | |
---|
| 75 | CFLAGS="$SLKCFLAGS" \ |
---|
| 76 | CXXFLAGS="$SLKCFLAGS" \ |
---|
| 77 | ./configure \ |
---|
| 78 | --prefix=/usr \ |
---|
| 79 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
| 80 | --sysconfdir=/etc \ |
---|
| 81 | --localstatedir=/var \ |
---|
| 82 | --mandir=/usr/man \ |
---|
| 83 | --docdir=/usr/doc/$PKGNAM-$VERSION \ |
---|
| 84 | --enable-introspection \ |
---|
| 85 | --with-x11 \ |
---|
| 86 | --build=$ARCH-slackware-linux |
---|
| 87 | |
---|
| 88 | make $NUMJOBS || make || exit 1 |
---|
| 89 | make install DESTDIR=$PKG || exit 1 |
---|
| 90 | |
---|
| 91 | # We need to have separate 32-bit and 64-bit binaries |
---|
| 92 | # for places where we have two copies of the GTK+ package installed. |
---|
| 93 | # (we might have x86_64 and i486 packages on the same system, for example.) |
---|
| 94 | host="$ARCH-slackware-linux" |
---|
| 95 | case "$host" in |
---|
| 96 | s390x*|x86_64*) |
---|
| 97 | mv $PKG/usr/bin/gdk-pixbuf-query-loaders{,-64} |
---|
| 98 | ( cd $PKG/usr/bin |
---|
| 99 | ln -sf gdk-pixbuf-query-loaders-64 gdk-pixbuf-query-loaders |
---|
| 100 | ) |
---|
| 101 | ;; |
---|
| 102 | *) |
---|
| 103 | mv $PKG/usr/bin/gdk-pixbuf-query-loaders{,-32} |
---|
| 104 | ( cd $PKG/usr/bin |
---|
| 105 | ln -sf gdk-pixbuf-query-loaders-32 gdk-pixbuf-query-loaders |
---|
| 106 | ) |
---|
| 107 | ;; |
---|
| 108 | esac |
---|
| 109 | |
---|
| 110 | # Install wrappers for the binaries: |
---|
| 111 | cp $CWD/update-gdk-pixbuf-loaders $PKG/usr/bin/update-gdk-pixbuf-loaders |
---|
| 112 | chmod 0755 $PKG/usr/bin/update-gdk-pixbuf-loaders |
---|
| 113 | |
---|
| 114 | find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ |
---|
| 115 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true |
---|
| 116 | |
---|
| 117 | # Compress and link manpages, if any: |
---|
| 118 | if [ -d $PKG/usr/man ]; then |
---|
| 119 | ( cd $PKG/usr/man |
---|
| 120 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
| 121 | ( cd $manpagedir |
---|
| 122 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
| 123 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
| 124 | rm $eachpage |
---|
| 125 | done |
---|
| 126 | gzip -9 *.? |
---|
| 127 | ) |
---|
| 128 | done |
---|
| 129 | ) |
---|
| 130 | fi |
---|
| 131 | |
---|
| 132 | mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION |
---|
| 133 | cp -a \ |
---|
| 134 | AUTHORS COPYING* INSTALL NEWS README* \ |
---|
| 135 | $PKG/usr/doc/$PKGNAM-$VERSION |
---|
| 136 | |
---|
| 137 | # If there's a ChangeLog, installing at least part of the recent history |
---|
| 138 | # is useful, but don't let it get totally out of control: |
---|
| 139 | if [ -r ChangeLog ]; then |
---|
| 140 | DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) |
---|
| 141 | cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog |
---|
| 142 | touch -r ChangeLog $DOCSDIR/ChangeLog |
---|
| 143 | fi |
---|
| 144 | |
---|
| 145 | mkdir -p $PKG/install |
---|
| 146 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 147 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
---|
| 148 | |
---|
| 149 | cd $PKG |
---|
| 150 | /sbin/makepkg -l y -c n $TMP/${PKGNAM}2-$VERSION-$ARCH-$BUILD.txz |
---|
| 151 | |
---|