slackbuilds

Personal Slackbuilds in the style of slackbuilds.org
git clone git://git.danielmoch.com/slackbuilds.git
Log | Files | Refs

lua-lpeg.SlackBuild (2945B)


      1 #!/bin/sh
      2 
      3 # SlackBuild script for lua-lpeg
      4 
      5 # Copyright 2020 Daniel Moch <daniel@danielmoch.com>
      6 # Lightly adapted from the script of the same name at slackbuilds.org,
      7 # and offered under the same license (see below)
      8 
      9 # Copyright 2014-2019 Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
     10 # All rights reserved.
     11 #
     12 # Redistribution and use of this script, with or without modification, is
     13 # permitted provided that the following conditions are met:
     14 #
     15 # 1. Redistributions of this script must retain the above copyright
     16 #    notice, this list of conditions and the following disclaimer.
     17 #
     18 #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
     19 #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     20 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
     21 #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     22 #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     23 #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     24 #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     25 #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     26 #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     27 #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28 
     29 LUANAME=${LUANAME:-lua}
     30 PRGNAM=${LUANAME}-lpeg
     31 SRCNAM=lpeg
     32 VERSION=${VERSION:-1.0.2}
     33 BUILD=${BUILD:-1}
     34 TAG=${TAG:-_djmoch}
     35 
     36 if [ -z "$ARCH" ]; then
     37   case "$( uname -m )" in
     38     i?86) ARCH=i586 ;;
     39     arm*) ARCH=arm ;;
     40        *) ARCH=$( uname -m ) ;;
     41   esac
     42 fi
     43 
     44 CWD=$(pwd)
     45 TMP=${TMP:-/tmp/djmoch}
     46 PKG=$TMP/package-$PRGNAM
     47 OUTPUT=${OUTPUT:-/tmp}
     48 
     49 if [ "$ARCH" = "i586" ]; then
     50   LIBDIRSUFFIX=""
     51 elif [ "$ARCH" = "i686" ]; then
     52   LIBDIRSUFFIX=""
     53 elif [ "$ARCH" = "x86_64" ]; then
     54   LIBDIRSUFFIX="64"
     55 else
     56   LIBDIRSUFFIX=""
     57 fi
     58 
     59 set -e
     60 
     61 rm -rf $PKG
     62 mkdir -p $TMP $PKG $OUTPUT
     63 cd $TMP
     64 rm -rf $SRCNAM-$VERSION
     65 tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
     66 cd $SRCNAM-$VERSION
     67 chown -R root:root .
     68 find -L . \
     69  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
     70   -o -perm 511 \) -exec chmod 755 {} \; -o \
     71  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
     72   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
     73 
     74 make LUADIR=/usr/include/lua5.3
     75 install -m 0755 -D lpeg.so $PKG/$(pkg-config --variable INSTALL_CMOD ${LUANAME})/lpeg.so
     76 install -m 0644 -D re.lua $PKG/$(pkg-config --variable INSTALL_LMOD ${LUANAME})/re.lua
     77 
     78 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
     79   | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
     80 
     81 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
     82 cp -a HISTORY $PKG/usr/doc/$PRGNAM-$VERSION
     83 cat $CWD/lua-lpeg.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
     84 
     85 mkdir -p $PKG/install
     86 cat $CWD/slack-desc > $PKG/install/slack-desc
     87 
     88 cd $PKG
     89 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}