source: npl/system/bison/bison.SlackBuild.orig @ 439f083

Last change on this file since 439f083 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 3.6 KB
Line 
1#!/bin/sh
2
3# Copyright 2005-2008, 2009, 2010, 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
24PKGNAM=bison
25VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
26BUILD=${BUILD:-1}
27
28NUMJOBS=${NUMJOBS:--j6}
29
30# Automatically determine the architecture we're building on:
31if [ -z "$ARCH" ]; then
32  case "$( uname -m )" in
33    i?86) export ARCH=i486 ;;
34    arm*) export ARCH=arm ;;
35    # Unless $ARCH is already set, use uname -m for all other archs:
36       *) export ARCH=$( uname -m ) ;;
37  esac
38fi
39
40CWD=$(pwd)
41TMP=${TMP:-/tmp}
42PKG=$TMP/package-bison
43
44if [ "$ARCH" = "i486" ]; then
45  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
46  LIBDIRSUFFIX=""
47elif [ "$ARCH" = "s390" ]; then
48  SLKCFLAGS="-O2"
49  LIBDIRSUFFIX=""
50elif [ "$ARCH" = "x86_64" ]; then
51  SLKCFLAGS="-O2 -fPIC"
52  LIBDIRSUFFIX="64"
53else
54  SLKCFLAGS="-O2"
55  LIBDIRSUFFIX=""
56fi
57
58rm -rf $PKG
59mkdir -p $TMP $PKG
60
61cd $TMP
62rm -rf bison-$VERSION
63tar xvf $CWD/bison-$VERSION.tar.xz || exit 1
64cd bison-$VERSION || exit 1
65chown -R root:root .
66find . \
67  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
68  -exec chmod 755 {} \; -o \
69  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
70  -exec chmod 644 {} \;
71
72CFLAGS="$SLKCFLAGS" \
73./configure \
74  --prefix=/usr \
75  --libdir=/usr/lib${LIBDIRSUFFIX} \
76  --mandir=/usr/man \
77  --infodir=/usr/info \
78  --docdir=/usr/doc/bison-$VERSION \
79  --build=$ARCH-slackware-linux
80
81make $NUMJOBS || make || exit 1
82make install DESTDIR=$PKG
83
84find $PKG | xargs file | grep -e "executable" -e "shared object" \
85  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
86
87# Compress and link manpages, if any:
88if [ -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  )
100fi
101
102rm -f $PKG/usr/info/dir
103gzip -9 $PKG/usr/info/*
104
105mkdir -p $PKG/usr/doc/bison-$VERSION
106cp -a \
107  AUTHORS COPYING* INSTALL NEWS README* REFERENCES THANKS doc/FAQ \
108  $PKG/usr/doc/bison-$VERSION
109
110# If there's a ChangeLog, installing at least part of the recent history
111# is useful, but don't let it get totally out of control:
112if [ -r ChangeLog ]; then
113  DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
114  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
115  touch -r ChangeLog $DOCSDIR/ChangeLog
116fi
117
118mkdir -p $PKG/install
119cat $CWD/slack-desc > $PKG/install/slack-desc
120
121# Build the package:
122cd $PKG
123/sbin/makepkg -l y -c n $TMP/bison-$VERSION-$ARCH-$BUILD.txz
124
Note: See TracBrowser for help on using the repository browser.