Skip to content

Commit

Permalink
cabextract: upgraded to 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
conraid committed Mar 1, 2015
1 parent 7fdb0fb commit b69f70e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 54 deletions.
93 changes: 42 additions & 51 deletions cabextract/cabextract.SlackBuild
Expand Up @@ -23,108 +23,99 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Exit on most errors
set -e
set -eu

# Set variables:
CWD=$(pwd)

PRGNAME=${PRGNAME:-cabextract}
PKGNAME=${PKGNAME:-$PRGNAME}
VERSION=${VERSION:-1.4}
PKGVERSION=$(echo $VERSION | tr - _)
BUILD=${BUILD:-2}
PKGNAME=${PKGNAME:-${PRGNAME}}
VERSION=${VERSION:-1.5}
PKGVERSION=${VERSION/-/_}
BUILD=${BUILD:-1}
ARCH=${ARCH:=""} # Set ARCH or leave blank to determine it automatically
TAG=${TAG:-cf}
TMP=${TMP:-/tmp/pkg}
PKG=$TMP/package-$PKGNAME
DOCS="$PKG/usr/doc/$PKGNAME-$VERSION"
PKG=${TMP}/package-${PKGNAME}
DOCDIR="${PKG}/usr/doc/${PKGNAME}-${VERSION}"

# Insert document files in this variable
DOCFILES="AUTHORS COPYING ChangeLog INSTALL NEWS README TODO"

# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
if [ -z "${ARCH}" ]; then
case "$( uname -m )" in
i?86) ARCH=i686 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
i?86) ARCH=i686 ;;
arm*) ARCH=arm ;;
# Unless ${ARCH} is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi

# Set compiling FLAGS
case "$ARCH" in
i486)
case "${ARCH}" in
i486)
SLKCFLAGS="-O2 -march=i486 -mtune=i686"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
i686)
;;
i686)
SLKCFLAGS="-O2 -march=i686 -pipe -fomit-frame-pointer"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
x86_64)
;;
x86_64)
SLKCFLAGS="-O2 -fPIC -pipe -fomit-frame-pointer"; CHOST="x86_64"
SLKLDFLAGS="-L/lib64 -L/usr/lib64"; LIBDIRSUFFIX="64"
;;
*)
SLKCFLAGS="-O2"; CHOST=$ARCH
;;
*)
SLKCFLAGS="-O2"; CHOST=${ARCH}
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
esac

# Extract source and prepare:
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PRGNAME-$VERSION
tar xzvf $CWD/$PRGNAME-$VERSION.tar.gz
cd $PRGNAME-$VERSION
rm -rf ${PKG}
mkdir -p ${TMP} ${PKG}
cd ${TMP}
rm -rf ${PRGNAME}-${VERSION}
tar xzvf ${CWD}/${PRGNAME}-${VERSION}.tar.gz
cd ${PRGNAME}-${VERSION}

# Make sure ownerships and permissions are sane:
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# Configure
LDFLAGS="$SLKLDFLAGS" \
CFLAGS="$SLKCFLAGS" \
LDFLAGS="${SLKLDFLAGS}" \
CFLAGS="${SLKCFLAGS}" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--host=$CHOST-slackware-linux \
--build=$CHOST-slackware-linux
--host=${CHOST}-slackware-linux \
--build=${CHOST}-slackware-linux

# Build and install:
make
make DESTDIR=$PKG install-strip
make DESTDIR=${PKG} install-strip

# Compress and link manpages, if any:
if [ -d $PKG/usr/man ]; then
( 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
)
if [ -d ${PKG}/usr/man ]; then
find ${PKG}/usr/man -type f -exec gzip -9 {} \;
for i in $( find ${PKG}/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
fi

# Add a documentation directory:
mkdir -p ${DOCS}
for i in ${DOCFILES}; do
if [ -e "${i}" ]; then
if ! [ -L "${i}" ]; then
cp -a "${i}" ${DOCS}
else
cp -LRp "${i}" ${DOCS}
fi
fi;
done
mkdir -p ${DOCDIR}
cp -a ${DOCFILES} ${DOCDIR} || true

# Add a slackbuild script:
cat $CWD/$PKGNAME.SlackBuild > $DOCS/$PKGNAME.SlackBuild
install -Dm644 ${CWD}/${PKGNAME}.SlackBuild ${DOCDIR}/${PKGNAME}.SlackBuild

# Add slack-desc
install -Dm644 $CWD/slack-desc $PKG/install/slack-desc
install -Dm644 ${CWD}/slack-desc ${PKG}/install/slack-desc

# Create package:
cd $PKG
/sbin/makepkg -l y -c n $CWD/$PKGNAME-$PKGVERSION-$ARCH-${BUILD}${TAG}.txz
cd ${PKG}
/sbin/makepkg -l y -c n ${CWD}/${PKGNAME}-${PKGVERSION}-${ARCH}-${BUILD}${TAG}.txz
6 changes: 3 additions & 3 deletions cabextract/cabextract.info
@@ -1,6 +1,6 @@
NAME="cabextract"
VERSION="1.4"
VERSION="1.5"
HOMEPAGE="http://www.cabextract.org.uk/"
DOWNLOAD="http://www.cabextract.org.uk/cabextract-1.4.tar.gz"
DOWNLOAD="http://www.cabextract.org.uk/cabextract-1.5.tar.gz"
REQUIRES=""
MD5SUM="79f41f568cf1a3ac105e0687e8bfb7c0"
MD5SUM="4e22fc3b36eb028acf2115b44f85930d"

0 comments on commit b69f70e

Please sign in to comment.