mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
88 lines
2.8 KiB
Bash
88 lines
2.8 KiB
Bash
#!/bin/sh
|
|
|
|
# Slackware build script for rng-tools
|
|
|
|
# Written by David Miller dave at frop dot net
|
|
# This script is released into the public domain
|
|
|
|
PRGNAM=rng-tools # replace with name of program
|
|
VERSION=${VERSION:-2} # replace with version of program
|
|
ARCH=${ARCH:-i486} # this should not change
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-_SBo} # the "_SBo" is required
|
|
|
|
CWD=$(pwd)
|
|
TMP=${TMP:-/tmp/SBo} # For consistency's sake, use this
|
|
PKG=$TMP/package-$PRGNAM
|
|
OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
fi
|
|
|
|
set -e # Exit on most errors
|
|
# If you prefer to do selective error checking with
|
|
# command || exit 1
|
|
# then that's also acceptable.
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
cd $TMP
|
|
rm -rf $PRGNAM-$VERSION
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
|
cd $PRGNAM-$VERSION
|
|
chown -R root:root .
|
|
find . \
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
-exec chmod 755 {} \; -o \
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
-exec chmod 644 {} \;
|
|
|
|
# Your application will probably need different configure flags;
|
|
# these are provided as an example only.
|
|
# Be sure to build only shared libraries unless there's some need for
|
|
# static.
|
|
CFLAGS="$SLKCFLAGS" \
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
./configure \
|
|
--prefix=/usr \
|
|
--sysconfdir=/etc \
|
|
--localstatedir=/var \
|
|
--mandir=/usr/man
|
|
|
|
# Compile the application and install it into the $PKG directory
|
|
make
|
|
make install-strip DESTDIR=$PKG
|
|
|
|
|
|
# Compress man pages
|
|
# If the man pages are installed to /usr/share/man instead, you'll need to either
|
|
# add the --mandir=/usr/man flag to configure or move them manually after the
|
|
# make install process is run.
|
|
( cd $PKG/usr/man
|
|
find . -type f -exec gzip -9 {} \;
|
|
for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
|
)
|
|
|
|
# Copy program documentation into the package
|
|
# The included documentation varies from one application to another, so be sure
|
|
# to adjust your script as needed
|
|
# Also, include the SlackBuild script in the documentation directory
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cp -a AUTHORS COPYING NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
# Copy the slack-desc (and a custom doinst.sh if necessary) into ./install
|
|
mkdir -p $PKG/install
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
# Make the package; be sure to leave it in $OUTPUT
|
|
# If package symlinks need to be created during install *before*
|
|
# your custom contents of doinst.sh runs, then add the -p switch to
|
|
# the makepkg command below -- see makepkg(8) for details
|
|
cd $PKG
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
|