aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2008-12-26 17:53:54 +0000
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2008-12-26 17:53:54 +0000
commit74765b4a6d9d2aadfe13b11f7b1d64400ed066ec (patch)
tree166f63f3f390883892e169b97608460526309ee7
parentf09bd269dc646f3b8c7736d9909f3c5c6db86cbf (diff)
downloadslackbuilds-74765b4a6d9d2aadfe13b11f7b1d64400ed066ec.tar.gz
slackbuilds-74765b4a6d9d2aadfe13b11f7b1d64400ed066ec.tar.bz2
libgc.mkbuild libgc: adding mkbuild and manifest
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2039 370017ae-e619-0410-ac65-c121f96126d4
-rw-r--r--media/libs/libgc/Manifest3
-rwxr-xr-xmedia/libs/libgc/libgc.SlackBuild251
2 files changed, 169 insertions, 85 deletions
diff --git a/media/libs/libgc/Manifest b/media/libs/libgc/Manifest
new file mode 100644
index 00000000..47480c98
--- /dev/null
+++ b/media/libs/libgc/Manifest
@@ -0,0 +1,3 @@
+DIST libgc6.8.tar.gz 756879 MD5 418d38bd9c66398386a372ec0435250e SHA1 6d5def5ba5d29292ba9c76f04df3ec06d3ab3278 SHA256 448f8e4c6ee8c80eac059cf1c9379d20c388bcb900fc0796cd2a44d1dcbbae69 SHA512 69a9554d2d213392512d4ce41ec8c4993557e65c2b3dc4f568ac18695421cc08b7677c25f9a0ce03e94fb5e68a298fcac7ed09fb90007a2c998ff6ef78d3c651 RMD160 6e894e7a51683a9342fd738baa6f1a2861e27400
+MKBUILD libgc.mkbuild 3221 MD5 92165892b7598bf57cca7b0305ff07de SHA1 1f1d253edee7c58e898622d163ef6e162487acb8 SHA256 099facfd91993ac9e2cb306201ff3d3ae72bd69076a6bb740e2d6d7dfc766624 SHA512 93a94e33fa6af03d0f9253379f5fc10b318ca3f7b976993dac6c04a6dace0f49d5f9058daff7556aebeb3bfeb81c77d92d0681c2bdb226c338a03cc5a8473d2d RMD160 d239381e488025c657742b06c3fd37b3880c7acf
+SLACKBUILD libgc.SlackBuild 6852 MD5 09b6fe6a716a109064338fc67b413863 SHA1 3ae61291844243a11fc4ae6abf25b2008f372725 SHA256 95a9830a41d898695b9ffb081a1bbc8037d0dc2999013db685d2dde6780b9c79 SHA512 545ea498ff4ee58151320c2e16c2e890d316b4c16dc601b95b5907a7aec159af21726a8511ff62396651189deb23341fb6f2f5dd0db99cc1f9e67f25b0444c97 RMD160 9f0358962e2d22bd481084ca28d47e87c00e3c54
diff --git a/media/libs/libgc/libgc.SlackBuild b/media/libs/libgc/libgc.SlackBuild
index 440f477f..de737558 100755
--- a/media/libs/libgc/libgc.SlackBuild
+++ b/media/libs/libgc/libgc.SlackBuild
@@ -1,107 +1,193 @@
#!/bin/bash
#
-# libgc.SlackBuild is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or any later version.
+# libgc.SlackBuild is free software; you can redistribute
+# it and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the License,
+# or any later version.
#
-# libgc.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# libgc.SlackBuild is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place - Suite 330, Boston, MA 02111-1307, USA
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
-# slackbuild script for libgc
-# by rafael at riseup.net
+# slackbuild for libgc, by Silvio Rhatto
+# requires:
+# tested: libgc-6.8
#
-if [ -s "slack-required" ]; then
- echo Recomended and required packages for building libgc are:
- cat slack-required | sed -e 's/^/\t/'
- if [ "$INTERACT" != "no" ]; then
- echo If you dont have those installed, press Ctrl-C. Otherwise, hit ENTER.
- read crap
-# else
-# echo Sleeping 3 seconds...
-# sleep 3
- fi
-fi
-
-CWD="`pwd`"
-
+# Look for slackbuildrc
if [ -f ~/.slackbuildrc ]; then
source ~/.slackbuildrc
elif [ -f /etc/slackbuildrc ]; then
source /etc/slackbuildrc
fi
-# default settings
-PACKAGE="gc"
+# Set variables
+CWD="$(pwd)"
+SRC_NAME="libgc"
+PKG_NAME="libgc"
ARCH=${ARCH:=i486}
-VERSION=${VERSION:=6.8}
-BUILD=${BUILD:=1rd}
-SRC_DIR=${SRC:=$CWD}
+SRC_VERSION=${VERSION:=6.8}
+PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')"
+BUILD=${BUILD:=1rha}
+SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME
TMP=${TMP:=/tmp}
+PKG=${PKG:=$TMP/package-$PKG_NAME}
REPOS=${REPOS:=$TMP}
-
-if [ "$ARCH" == "x86_64" ]; then
- LIBDIR=/usr/lib64
-else
- LIBDIR=/usr/lib
+PREFIX=${PREFIX:=/usr}
+PKG_WORK="$TMP/$SRC_NAME"
+CONF_OPTIONS=${CONF_OPTIONS:=""}
+NUMJOBS=${NUMJOBS:=""}
+
+# Set system libraries' path and optmization flags based on $ARCH
+LIBDIR="$PREFIX/lib"
+
+if [ "$ARCH" = "i386" ]; then
+ SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
+elif [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686"
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIR="$PREFIX/lib64"
+ LDFLAGS="-L/lib64 -L/usr/lib64"
fi
-RTOOL="wget"
-PACKAGE_EXT="gz"
-SRC="$PACKAGE$VERSION.tar.$PACKAGE_EXT"
+# Set error codes (used by createpkg)
+ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33
+ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36
+ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39
+ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42
+ERROR_MANIFEST=43;
+
+# Clean up any leftovers of previous builds
+rm -rf "$PKG_WORK" 2> /dev/null
+rm -rf "$PKG" 2> /dev/null
+
+# Create directories if necessary
+mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR
+mkdir -p "$PKG" || exit $ERROR_MKDIR
+mkdir -p "$REPOS" || exit $ERROR_MKDIR
+mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR
+
+# Dowload source if necessary
+SRC="$SRC_NAME""$VERSION.tar.gz"
URL="http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/$SRC"
-SRC_DIR="$SRC_DIR/$PACKAGE"
-mkdir -p $SRC_DIR
-
-if [ "$PACKAGE_EXT" == "bz2" ]; then
- tarflag="j"
-else
- tarflag="z"
+if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then
+ wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET
fi
-if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then
- wget "$URL" -O "$SRC_DIR/$SRC"
-fi
-
-TMP="$TMP/$PACKAGE"
-rm -rf $TMP
-mkdir -p $TMP
-cd $TMP
-
-tar xvf$tarflag $SRC_DIR/$SRC
-cd $PACKAGE$VERSION
+# Check Manifest file
+if [ -e "$CWD/Manifest" ]; then
+
+ MANIFEST_LINES="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | wc -l`"
+
+ for ((MANIFEST_COUNT=1; MANIFEST_COUNT <= $MANIFEST_LINES; MANIFEST_COUNT++)); do
+
+ MANIFEST_LINE="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | head -n $MANIFEST_COUNT | tail -n 1`"
+ MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`"
+ MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`"
+
+ if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then
+ MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE"
+ else
+ MANIFEST_FILE="`find $CWD -name $MANIFEST_FILE`"
+ fi
+
+ if [ ! -e "$MANIFEST_FILE" ] || [ -d "$MANIFEST_FILE" ]; then
+ continue
+ fi
+
+ echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..."
+
+ SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`"
+ SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`"
+
+ # Check source code size
+ if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then
+ echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC"
+ exit $ERROR_MANIFEST
+ else
+ echo "Size match."
+ fi
+
+ # Check source code integrity
+ for ALGO in md5 sha1 sha256 sha512 rmd160; do
+ if [ $ALGO = "rmd160" ]; then
+ ALGO_SRC="`openssl rmd160 $MANIFEST_FILE | awk '{ print $2 }'`"
+ else
+ ALGO_SRC="`"$ALGO"sum $MANIFEST_FILE | awk '{ print $1 }'`"
+ fi
+ ALGO="`echo $ALGO | tr '[:lower:]' '[:upper:]'`"
+ ALGO_MANIFEST=$(echo $MANIFEST_LINE | sed "s/.* $ALGO //" | awk '{ print $1 }')
+ if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then
+ echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC"
+ exit $ERROR_MANIFEST
+ else
+ echo "$ALGO match."
+ fi
+ done
+
+ done
-if [ -f "$CWD/$PACKAGE-$VERSION.diff" ]; then
- patch -p1 < $CWD/$PACKAGE-$VERSION.diff
+else
+ exit $ERROR_MANIFEST
fi
-./configure --prefix=/usr --sysconfdir=/etc --libdir=$LIBDIR --with-docdir=/usr/doc/$PACKAGE-$VERSION
-make || exit 32
-make DESTDIR=$TMP/package-$PACKAGE install
-
-CWD="`pwd`"
-
-cd $TMP/package-$PACKAGE
-
-find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
-find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+# Untar
+cd "$PKG_WORK"
+tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR
+PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`"
+cd "$PKG_SRC"
+
+# Configure
+CFLAGS="$SLKCFLAGS" \
+ CXXFLAGS="$SLKCFLAGS" \
+ ./configure \
+ --prefix="$PREFIX" --libdir="$LIBDIR" $CONF_OPTIONS || exit $ERROR_CONF
+
+# Compile
+make $NUMJOBS || exit $ERROR_MAKE
+
+# Install
+make install DESTDIR="$PKG" || exit $ERROR_INSTALL
+
+# Strip binaries
+( cd "$PKG"
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null
+)
+
+# Install documentation
+DOCS="NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING LICENSE SIGNATURE readme.*"
+mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR
+for doc in $DOCS; do
+ if [ -f "$doc" ]; then
+ cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION"
+ fi
+done
-mkdir install
-cat << EOF > install/slack-desc
+# Add package description (slack-desc)
+mkdir -p "$PKG/install" || exit $ERROR_MKDIR
+cat << EODESC > "$PKG/install/slack-desc"
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
+# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
- |-----handy-ruler-----------------------------------------------------|
+ |-----handy-ruler--------------------------------------------------------|
libgc: libgc (libgc is portable garbage colector library)
libgc:
libgc: The Boehm-Demers-Weiser conservative garbage collector can be used as
@@ -113,18 +199,13 @@ libgc: can no longer be otherwise accessed.
libgc:
libgc: http://www.hpl.hp.com/personal/Hans_Boehm/gc/
libgc:
-EOF
-
-# docs
-mkdir -p usr/doc/$PACKAGE-$VERSION
+EODESC
-for file in README;do
- cp $CWD/$file* usr/doc/$PACKAGE-$VERSION/
-done
+# Build the package
+cd "$PKG"
+makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG
-makepkg -c y -l y $REPOS/lib$PACKAGE-$VERSION-$ARCH-$BUILD.tgz
-
-if [ "$CLEANUP" == "yes" ]; then
- rm -rf $TMP
+# Delete source and build directories if requested
+if [ "$CLEANUP" == "yes" ] || [ "$1" = "--cleanup" ]; then
+ rm -rf "$PKG_WORK" "$PKG"
fi
-