| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | # Copyright 2008, 2009, 2012, 2015 Patrick J. Volkerding, Sebeka, Minnesota, 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 automake-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
|---|
| 25 | NUMJOBS=${NUMJOBS:-" -j7 "} |
|---|
| 26 | BUILD=${BUILD:-1} |
|---|
| 27 | |
|---|
| 28 | # Note: the package is _built_ as 'noarch' |
|---|
| 29 | # Automatically determine architecture for build & packaging: |
|---|
| 30 | if [ -z "$ARCH" ]; then |
|---|
| 31 | case "$( uname -m )" in |
|---|
| 32 | i?86) export ARCH=i586 ;; |
|---|
| 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=$TMP/package-automake |
|---|
| 41 | |
|---|
| 42 | rm -rf $PKG |
|---|
| 43 | mkdir -p $TMP $PKG |
|---|
| 44 | |
|---|
| 45 | cd $TMP |
|---|
| 46 | rm -rf automake-$VERSION |
|---|
| 47 | tar xvf $CWD/automake-$VERSION.tar.xz || exit 1 |
|---|
| 48 | cd automake-$VERSION |
|---|
| 49 | |
|---|
| 50 | # Patch to work with Perl 5.20: |
|---|
| 51 | zcat $CWD/automake-1.15-perl-escape-curly-bracket.patch.gz | patch -p1 --verbose || exit 1 |
|---|
| 52 | |
|---|
| 53 | chown -R root:root . |
|---|
| 54 | find . \ |
|---|
| 55 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
|---|
| 56 | -exec chmod 755 {} \; -o \ |
|---|
| 57 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
|---|
| 58 | -exec chmod 644 {} \; |
|---|
| 59 | |
|---|
| 60 | ./configure \ |
|---|
| 61 | --prefix=/usr \ |
|---|
| 62 | --mandir=/usr/man \ |
|---|
| 63 | --infodir=/usr/info \ |
|---|
| 64 | --build=$ARCH-slackware-linux |
|---|
| 65 | |
|---|
| 66 | make $NUMJOBS || make || exit 1 |
|---|
| 67 | make install DESTDIR=$PKG || exit 1 |
|---|
| 68 | |
|---|
| 69 | rm -f $PKG/usr/info/dir |
|---|
| 70 | gzip -9 $PKG/usr/info/* |
|---|
| 71 | |
|---|
| 72 | # Change hard links to symlinks: |
|---|
| 73 | SHORTNAME=$(echo $VERSION | cut -f1,2 -d .) |
|---|
| 74 | ( cd $PKG/usr/bin |
|---|
| 75 | rm -f aclocal |
|---|
| 76 | ln -sf aclocal-$SHORTNAME aclocal |
|---|
| 77 | rm -rf automake |
|---|
| 78 | ln -sf automake-$SHORTNAME automake |
|---|
| 79 | ) |
|---|
| 80 | #linkup; |
|---|
| 81 | |
|---|
| 82 | # Create local aclocal dir: |
|---|
| 83 | mkdir -p $PKG/usr/share/aclocal |
|---|
| 84 | touch $PKG/usr/share/aclocal |
|---|
| 85 | |
|---|
| 86 | # Compress manual pages: |
|---|
| 87 | find $PKG/usr/man -type f -exec gzip -9 {} \; |
|---|
| 88 | for i in $( find $PKG/usr/man -type l ) ; do |
|---|
| 89 | ln -s $( readlink $i ).gz $i.gz |
|---|
| 90 | rm $i |
|---|
| 91 | done |
|---|
| 92 | |
|---|
| 93 | mkdir -p $PKG/usr/doc/automake-$VERSION |
|---|
| 94 | mv $PKG/usr/share/doc/automake/* $PKG/usr/doc/automake-$VERSION |
|---|
| 95 | cp -a \ |
|---|
| 96 | AUTHORS COPYING* NEWS README* THANKS TODO \ |
|---|
| 97 | $PKG/usr/doc/automake-$VERSION |
|---|
| 98 | rm -rf $PKG/usr/share/doc |
|---|
| 99 | |
|---|
| 100 | mkdir -p $PKG/install |
|---|
| 101 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
|---|
| 102 | cat $CWD/slack-desc > $PKG/install/slack-desc |
|---|
| 103 | |
|---|
| 104 | cd $PKG |
|---|
| 105 | /sbin/makepkg -l y -c n $TMP/automake-$VERSION-noarch-$BUILD.txz |
|---|
| 106 | |
|---|