source: npl/overig/pcre2/pcre2.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.2 KB
RevLine 
[f33f781]1#!/bin/bash
2
3# Slackware build script for pcre2
4
5# Copyright 2016-2017  Larry Hajali <larryhaja[at]gmail[dot]com>
6# Copyright 2017, 2018  Patrick J. Volkerding, Sebeka, MN, USA
7# All rights reserved.
8#
9# Redistribution and use of this script, with or without modification, is
10# permitted provided that the following conditions are met:
11#
12# 1. Redistributions of this script must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14#
15#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
16#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
18#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26cd $(dirname $0) ; CWD=$(pwd)
27
28PKGNAM=pcre2
29VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
30BUILD=${BUILD:-1}
31
32if [ -z "$ARCH" ]; then
33  case "$( uname -m )" in
34    i?86) ARCH=i586 ;;
35    arm*) ARCH=arm ;;
36       *) ARCH=$( uname -m ) ;;
37  esac
38fi
39
40# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
41# the name of the created package would be, and then exit. This information
42# could be useful to other scripts.
43if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
44  echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
45  exit 0
46fi
47
48NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
49
50TMP=${TMP:-/tmp}
51PKG=$TMP/package-$PKGNAM
52
53if [ "$ARCH" = "i586" ]; then
54  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
55  LIBDIRSUFFIX=""
56elif [ "$ARCH" = "i686" ]; then
57  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
58  LIBDIRSUFFIX=""
59elif [ "$ARCH" = "x86_64" ]; then
60  SLKCFLAGS="-O2 -fPIC"
61  LIBDIRSUFFIX="64"
62else
63  SLKCFLAGS="-O2"
64  LIBDIRSUFFIX=""
65fi
66
67rm -rf $PKG
68mkdir -p $TMP $PKG
69cd $TMP
70rm -rf $PKGNAM-$VERSION
71tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
72cd $PKGNAM-$VERSION || exit 1
73chown -R root:root .
74find -L . \
75 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
76  -o -perm 511 \) -exec chmod 755 {} \+ -o \
77 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
78  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
79
80CFLAGS="$SLKCFLAGS" \
81CXXFLAGS="$SLKCFLAGS" \
82./configure \
83  --prefix=/usr \
84  --libdir=/usr/lib${LIBDIRSUFFIX} \
85  --mandir=/usr/man \
86  --docdir=/usr/doc/$PKGNAM-$VERSION \
87  --disable-silent-rules \
88  --enable-static=no \
89  --enable-pcre2-16 \
90  --enable-pcre2-32 \
91  --enable-jit \
92  --enable-pcre2grep-libz \
93  --enable-pcre2grep-libbz2 \
94  --enable-pcre2test-libreadline \
95  --build=$ARCH-slackware-linux || exit 1
96
97make $NUMJOBS || make || exit 1
98make install DESTDIR=$PKG || exit 1
99
100# Don't ship .la files:
101rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.la
102
103find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
104  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
105
106# Compress and link manpages, if any:
107if [ -d $PKG/usr/man ]; then
108  ( cd $PKG/usr/man
109    for manpagedir in $(find . -type d -name "man*") ; do
110      ( cd $manpagedir
111        for eachpage in $( find . -type l -maxdepth 1 | grep -v '\.gz$') ; do
112          ln -s $( readlink $eachpage ).gz $eachpage.gz
113          rm $eachpage
114        done
115        gzip -9 *.?
116      )
117    done
118  )
119fi
120
121# Add a documentation directory:
122mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
123cp -a \
124  AUTHORS COPYING* ChangeLog HACKING INSTALL LICENCE* NEWS* NON-AUTOTOOLS-BUILD README* \
125  $PKG/usr/doc/${PKGNAM}-$VERSION
126
127# If there's a ChangeLog, installing at least part of the recent history
128# is useful, but don't let it get totally out of control:
129if [ -r ChangeLog ]; then
130  DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
131  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
132  touch -r ChangeLog $DOCSDIR/ChangeLog
133fi
134
135mkdir -p $PKG/install
136cat $CWD/slack-desc > $PKG/install/slack-desc
137
138cd $PKG
139/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
Note: See TracBrowser for help on using the repository browser.