source: npl/overig/gawk/gawk.SlackBuild.orig @ 7c410f9

Last change on this file since 7c410f9 was cbeb6d3, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

gawk update, required for compiling gcc

  • Property mode set to 100755
File size: 3.8 KB
Line 
1#!/bin/sh
2
3# Copyright 2005-2014  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
23PKGNAM=gawk
24VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
25BUILD=${BUILD:-2}
26
27NUMJOBS=${NUMJOBS:--j6}
28
29# Automatically determine the architecture we're building on:
30if [ -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
37fi
38
39CWD=$(pwd)
40TMP=${TMP:-/tmp}
41PKG=$TMP/package-gawk
42
43if [ "$ARCH" = "i586" ]; then
44  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
45  LIBDIRSUFFIX=""
46elif [ "$ARCH" = "s390" ]; then
47  SLKCFLAGS="-O2"
48  LIBDIRSUFFIX=""
49elif [ "$ARCH" = "x86_64" ]; then
50  SLKCFLAGS="-O2 -fPIC"
51  LIBDIRSUFFIX="64"
52else
53  SLKCFLAGS="-O2"
54  LIBDIRSUFFIX=""
55fi
56
57rm -rf $PKG
58mkdir -p $TMP $PKG
59
60cd $TMP
61rm -rf gawk-$VERSION
62tar xvf $CWD/gawk-$VERSION.tar.xz
63cd gawk-$VERSION
64
65chown -R root:root .
66
67find . \
68  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
69  -exec chmod 755 {} \; -o \
70  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
71  -exec chmod 644 {} \;
72
73CFLAGS="$SLKCFLAGS" \
74./configure \
75  --prefix=/usr \
76  --libdir=/usr/lib${LIBDIRSUFFIX} \
77  --mandir=/usr/man \
78  --infodir=/usr/info \
79  --build=$ARCH-slackware-linux
80
81make $NUMJOBS || make || exit 1
82make install DESTDIR=$PKG || exit 1
83
84( cd $PKG
85  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
86    xargs strip --strip-unneeded 2> /dev/null
87  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
88    xargs strip --strip-unneeded 2> /dev/null
89)
90
91( cd $PKG/usr/bin
92  ln -sf gawk-$VERSION gawk
93)
94
95mkdir -p $PKG/bin
96mv $PKG/usr/bin/gawk* $PKG/bin
97mv $PKG/usr/bin/awk $PKG/bin
98
99( cd $PKG/usr/bin
100  ln -sf ../../bin/awk .
101  ln -sf ../../bin/gawk .
102  ln -sf ../../bin/gawk-$VERSION .
103)
104
105( cd $PKG/usr/info
106  rm dir
107  gzip -9 *
108)
109
110( cd $PKG/usr/man/man1
111  ln -sf gawk.1 awk.1
112)
113
114# Compress manual pages:
115find $PKG/usr/man -type f -exec gzip -9 {} \;
116for i in $( find $PKG/usr/man -type l ) ; do
117  ln -s $( readlink $i ).gz $i.gz
118  rm $i
119done
120
121mkdir -p $PKG/usr/doc/gawk-$VERSION
122cp -a \
123  ABOUT-NLS AUTHORS COPYING* INSTALL NEWS POSIX.STD \
124  README* \
125  $PKG/usr/doc/gawk-$VERSION
126
127# We don't need to run the GPL:
128chmod 644 $PKG/usr/doc/gawk-$VERSION/COPYING*
129
130# If there's a ChangeLog, installing at least part of the recent history
131# is useful, but don't let it get totally out of control:
132if [ -r ChangeLog ]; then
133  DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
134  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
135  touch -r ChangeLog $DOCSDIR/ChangeLog
136fi
137
138mkdir -p $PKG/install
139cat $CWD/slack-desc > $PKG/install/slack-desc
140
141# Build the package:
142cd $PKG
143/sbin/makepkg -l y -c n $TMP/gawk-$VERSION-$ARCH-$BUILD.txz
144
Note: See TracBrowser for help on using the repository browser.