slackbuilds

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

tpm2-tss.SlackBuild (2817B)


      1 #!/bin/sh
      2 
      3 # Slackware build script for throttled
      4 #
      5 # Copyright 2020 Daniel Moch <daniel@danielmoch.com>
      6 #
      7 # Permission is hereby granted, free of charge, to any person obtaining a
      8 # copy of this software and associated documentation files (the "Software"),
      9 # to deal in the Software without restriction, including without limitation
     10 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
     11 # and/or sell copies of the Software, and to permit persons to whom the
     12 # Software is furnished to do so, subject to the following conditions:
     13 #
     14 # The above copyright notice and this permission notice shall be included
     15 # in all copies or substantial portions of the Software.
     16 #
     17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
     20 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
     21 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     22 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     23 # OTHER DEALINGS IN THE SOFTWARE.
     24 
     25 PRGNAM=tpm2-tss
     26 VERSION=${VERSION:-2.3.2}
     27 BUILD=${BUILD:-1}
     28 TAG=${TAG:-_djmoch}
     29 
     30 if [ -z "$ARCH" ]; then
     31   case "$( uname -m )" in
     32     i?86) ARCH=i586 ;;
     33     arm*) ARCH=arm ;;
     34        *) ARCH=$( uname -m ) ;;
     35   esac
     36 fi
     37 
     38 CWD=$(pwd)
     39 TMP=${TMP:-/tmp/djmoch}
     40 PKG=$TMP/package-$PRGNAM
     41 OUTPUT=${OUTPUT:-/tmp}
     42 
     43 if [ "$ARCH" = "i586" ]; then
     44   SLKCFLAGS="-O2 -march=i586 -mtune=i686"
     45   LIBDIRSUFFIX=""
     46 elif [ "$ARCH" = "i686" ]; then
     47   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
     48   LIBDIRSUFFIX=""
     49 elif [ "$ARCH" = "x86_64" ]; then
     50   SLKCFLAGS="-O2 -fPIC"
     51   LIBDIRSUFFIX="64"
     52 else
     53   SLKCFLAGS="-O2"
     54   LIBDIRSUFFIX=""
     55 fi
     56 
     57 set -e
     58 
     59 rm -rf $PKG
     60 mkdir -p $TMP $PKG $OUTPUT
     61 cd $TMP
     62 rm -rf $PRGNAM-$VERSION
     63 tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
     64 cd $PRGNAM-$VERSION
     65 chown -R root:root .
     66 find -L . \
     67  \( -perm 777 -o -perm 775 -o -perm 750 -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 
     72 CFLAGS="$SLKCFLAGS" \
     73 CXXFLAGS="$SLKCFLAGS" \
     74 ./configure \
     75   --prefix=/usr \
     76   --libdir=/usr/lib${LIBDIRSUFFIX} \
     77   --sysconfdir=/etc \
     78   --localstatedir=/var \
     79   --mandir=/usr/man \
     80   --docdir=/usr/doc/$PRGNAM-$VERSION \
     81   --with-udevrulesprefix=60- \
     82   --with-udevrulesdir=/lib/udev/rules.d \
     83   --build=$ARCH-slackware-linux
     84 
     85 make
     86 make install DESTDIR=$PKG
     87 
     88 install -Dm644 $CWD/slack-desc $PKG/install/slack-desc
     89 install -Dm644 $CWD/tpm2-tss.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION/tpm2-tss.SlackBuild
     90 install -Dm644 LICENSE $PKG/usr/doc/$PRGNAM-$VERSION/LICENSE
     91 
     92 cd $PKG
     93 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}