source: npl/overig/oniguruma/oniguruma.SlackBuild.orig @ f33f781

Last change on this file since f33f781 was f33f781, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

php7 and deps

  • Property mode set to 100755
File size: 4.1 KB
Line 
1#!/bin/bash
2
3# Copyright 2019, 2020  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
23cd $(dirname $0) ; CWD=$(pwd)
24
25PKGNAM=oniguruma
26SRCNAM=oniguruma
27VERSION=${VERSION:-$(echo $SRCNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
28BUILD=${BUILD:-1}
29
30# Automatically determine the architecture we're building on:
31if [ -z "$ARCH" ]; then
32  case "$(uname -m)" in
33    i?86) ARCH=i586 ;;
34    arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
35    # Unless $ARCH is already set, use uname -m for all other archs:
36    *) ARCH=$(uname -m) ;;
37  esac
38  export ARCH
39fi
40
41# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
42# the name of the created package would be, and then exit. This information
43# could be useful to other scripts.
44if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
45  echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
46  exit 0
47fi
48
49NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
50
51if [ "$ARCH" = "i586" ]; then
52  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
53  LIBDIRSUFFIX=""
54elif [ "$ARCH" = "i686" ]; then
55  SLKCFLAGS="-O2 -march=i686"
56  LIBDIRSUFFIX=""
57elif [ "$ARCH" = "s390" ]; then
58  SLKCFLAGS="-O2"
59  LIBDIRSUFFIX=""
60elif [ "$ARCH" = "x86_64" ]; then
61  SLKCFLAGS="-O2 -fPIC"
62  LIBDIRSUFFIX="64"
63elif [ "$ARCH" = "armv7hl" ]; then
64  SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
65  LIBDIRSUFFIX=""
66else
67  SLKCFLAGS="-O2"
68  LIBDIRSUFFIX=""
69fi
70
71TMP=${TMP:-/tmp}
72PKG=$TMP/package-$PKGNAM
73
74rm -rf $PKG
75mkdir -p $TMP $PKG
76
77cd $TMP
78rm -rf $SRCNAM-$VERSION
79tar xvf $CWD/$SRCNAM-$VERSION.tar.?z || exit 1
80cd $SRCNAM-$VERSION || exit 1
81
82chown -R root:root .
83find . \
84  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
85  -exec chmod 755 {} \+ -o \
86  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
87  -exec chmod 644 {} \+
88
89if [ ! -r configure ]; then
90  NOCONFIGURE=1 ./autogen.sh
91fi
92
93# Configure, build, and install:
94CFLAGS="$SLKCFLAGS" \
95CXXFLAGS="$SLKCFLAGS" \
96./configure \
97  --prefix=/usr \
98  --libdir=/usr/lib${LIBDIRSUFFIX} \
99  --sysconfdir=/etc \
100  --localstatedir=/var \
101  --docdir=/usr/doc/$PKGNAM-$VERSION \
102  --mandir=/usr/man \
103  --enable-posix-api \
104  --disable-static \
105  --build=$ARCH-slackware-linux || exit 1
106make $NUMJOBS || make || exit 1
107make install DESTDIR=$PKG || exit 1
108
109# Don't ship .la files:
110rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
111
112# Strip binaries:
113find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
114
115# Add a documentation directory:
116mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
117cp -a \
118  AUTHORS* COPYING* ChangeLog HISTORY* NEWS* README* \
119  doc \
120  $PKG/usr/doc/${PKGNAM}-$VERSION
121
122# If there's a HISTORY file, installing at least part of the recent history
123# is useful, but don't let it get totally out of control:
124if [ -r HISTORY ]; then
125  DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
126  cat HISTORY | head -n 1000 > $DOCSDIR/HISTORY
127  touch -r HISTORY $DOCSDIR/HISTORY
128fi
129
130mkdir -p $PKG/install
131cat $CWD/slack-desc > $PKG/install/slack-desc
132
133cd $PKG
134/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
Note: See TracBrowser for help on using the repository browser.