[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # Copyright 2009 Robby Workman, Northport, Alabama, USA |
---|
| 4 | # Copyright 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, MN, 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=swig |
---|
| 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 | CWD=$(pwd) |
---|
| 39 | TMP=${TMP:-/tmp} |
---|
| 40 | PKG=${PKG:-$TMP/package-swig} |
---|
| 41 | |
---|
| 42 | if [ "$ARCH" = "i586" ]; then |
---|
| 43 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
| 44 | elif [ "$ARCH" = "i686" ]; then |
---|
| 45 | SLKCFLAGS="-O2 -march=i686 -mtune=i686" |
---|
| 46 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 47 | SLKCFLAGS="-O2 -fPIC" |
---|
| 48 | else |
---|
| 49 | SLKCFLAGS="-O2" |
---|
| 50 | fi |
---|
| 51 | |
---|
| 52 | NUMJOBS=${NUMJOBS:--j6} |
---|
| 53 | |
---|
| 54 | rm -rf $PKG |
---|
| 55 | mkdir -p $TMP $PKG |
---|
| 56 | cd $TMP |
---|
| 57 | rm -rf swig-$VERSION |
---|
| 58 | tar xvf $CWD/swig-$VERSION.tar.?z* || exit 1 |
---|
| 59 | cd swig-$VERSION |
---|
| 60 | chown -R root:root . |
---|
| 61 | find . \ |
---|
| 62 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
| 63 | -exec chmod 755 {} \; -o \ |
---|
| 64 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
| 65 | -exec chmod 644 {} \; |
---|
| 66 | |
---|
| 67 | CFLAGS="$SLKCFLAGS" \ |
---|
| 68 | CXXFLAGS="$SLKCFLAGS" \ |
---|
| 69 | ./configure \ |
---|
| 70 | --prefix=/usr \ |
---|
| 71 | --mandir=/usr/man \ |
---|
| 72 | --exec-prefix=/usr \ |
---|
| 73 | --sysconfdir=/etc \ |
---|
| 74 | --localstatedir=/var \ |
---|
| 75 | --build=$ARCH-slackware-linux || exit 1 |
---|
| 76 | |
---|
| 77 | make $NUMJOBS || make || exit 1 |
---|
| 78 | make install DESTDIR=$PKG || exit 1 |
---|
| 79 | |
---|
| 80 | ( cd $PKG |
---|
| 81 | find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ |
---|
| 82 | xargs strip --strip-unneeded 2> /dev/null || true |
---|
| 83 | #find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ |
---|
| 84 | # xargs strip --strip-unneeded 2> /dev/null |
---|
| 85 | ) |
---|
| 86 | |
---|
| 87 | # Compress and link manpages, if any: |
---|
| 88 | if [ -d $PKG/usr/man ]; then |
---|
| 89 | ( cd $PKG/usr/man |
---|
| 90 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
| 91 | ( cd $manpagedir |
---|
| 92 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
| 93 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
| 94 | rm $eachpage |
---|
| 95 | done |
---|
| 96 | gzip -9 *.? |
---|
| 97 | ) |
---|
| 98 | done |
---|
| 99 | ) |
---|
| 100 | fi |
---|
| 101 | |
---|
| 102 | mkdir -p $PKG/usr/doc/swig-$VERSION |
---|
| 103 | cp -a \ |
---|
| 104 | ANNOUNCE CHANGES* INSTALL LICENSE README TODO \ |
---|
| 105 | Examples Doc/Manual Doc/Devel \ |
---|
| 106 | $PKG/usr/doc/swig-$VERSION |
---|
| 107 | # Fix permissions and wipe the pdf bloat |
---|
| 108 | find $PKG/usr/doc/swig-$VERSION -type f -exec chmod 0644 {} \; |
---|
| 109 | find $PKG/usr/doc/swig-$VERSION -name "*.pdf" -exec rm -f {} \; |
---|
| 110 | |
---|
| 111 | mkdir -p $PKG/install |
---|
| 112 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 113 | |
---|
| 114 | cd $PKG |
---|
| 115 | /sbin/makepkg -l y -c n $TMP/swig-$VERSION-$ARCH-$BUILD.txz |
---|