[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # Copyright 2015 Patrick J. Volkerding, Sebeka, MN, USA |
---|
| 4 | # Copyright 2015 Heinz Wiesinger, Amsterdam, The Netherlands |
---|
| 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 | |
---|
| 25 | PKGNAM=scons |
---|
| 26 | VERSION=${VERSION:-$(echo scons-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
---|
| 27 | BUILD=${BUILD:-1} |
---|
| 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 | if [ "${ARCH}" = "i586" ]; then |
---|
| 40 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
| 41 | LIBDIRSUFFIX="" |
---|
| 42 | elif [ "$ARCH" = "i686" ]; then |
---|
| 43 | SLKCFLAGS="-O2 -march=i686 -mtune=i686" |
---|
| 44 | LIBDIRSUFFIX="" |
---|
| 45 | elif [ "$ARCH" = "s390" ]; then |
---|
| 46 | SLKCFLAGS="-O2" |
---|
| 47 | LIBDIRSUFFIX="" |
---|
| 48 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 49 | SLKCFLAGS="-O2 -fPIC" |
---|
| 50 | LIBDIRSUFFIX="64" |
---|
| 51 | fi |
---|
| 52 | |
---|
| 53 | CWD=$(pwd) |
---|
| 54 | TMP=${TMP:-/tmp} |
---|
| 55 | PKG=$TMP/package-$PKGNAM |
---|
| 56 | |
---|
| 57 | rm -rf $PKG |
---|
| 58 | mkdir -p $TMP $PKG |
---|
| 59 | |
---|
| 60 | cd $TMP |
---|
| 61 | rm -rf scons-$VERSION |
---|
| 62 | tar xvf $CWD/scons-$VERSION.tar.*z* || exit 1 |
---|
| 63 | cd scons-$VERSION |
---|
| 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 | python setup.py install \ |
---|
| 72 | --no-version-script \ |
---|
| 73 | --standard-lib \ |
---|
| 74 | --root=$PKG || exit 1 |
---|
| 75 | |
---|
| 76 | find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ |
---|
| 77 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
| 78 | |
---|
| 79 | ( cd $PKG/usr/man |
---|
| 80 | find . -type f -exec gzip -9 {} \; |
---|
| 81 | for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done |
---|
| 82 | ) |
---|
| 83 | |
---|
| 84 | mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/ |
---|
| 85 | cp -a \ |
---|
| 86 | *.txt MANIFEST PKG-INFO \ |
---|
| 87 | $PKG/usr/doc/$PKGNAM-$VERSION/ |
---|
| 88 | |
---|
| 89 | mkdir -p $PKG/install |
---|
| 90 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 91 | |
---|
| 92 | cd $PKG |
---|
| 93 | /sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz |
---|
| 94 | |
---|