]> gitweb.fluxo.info Git - slackbuilds.git/commitdiff
grip: adding grip
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Sat, 10 Oct 2009 18:21:03 +0000 (18:21 +0000)
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Sat, 10 Oct 2009 18:21:03 +0000 (18:21 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2261 370017ae-e619-0410-ac65-c121f96126d4

media/sound/grip/Manifest [new file with mode: 0644]
media/sound/grip/grip.SlackBuild

diff --git a/media/sound/grip/Manifest b/media/sound/grip/Manifest
new file mode 100644 (file)
index 0000000..c0990fd
--- /dev/null
@@ -0,0 +1,23 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+DIST grip-3.3.1.tar.gz 812562 MD5 4b4233999b9f2bc85c711092553ea9aa RMD160 ec523457b06505e6ec98605badcacd5085599676 SHA1 58ef51fbddf981a189f8b5b39774e3bd6862127d SHA256 d46394a1062ed066f9c633b010fd1059e63d9ed791bbb7a85bc6567cf0fd66fd SHA512 380e36cb4e58180e543e1d293d38108f4879842ed63106da875e00747e98c2c06da1e706cfaf4ff26f481bba0ca941eb1201f430de04b0f313b1307ddd7e88d3
+MKBUILD grip.mkbuild 5258 MD5 20a5756cab9e3691c6f5bc0b093956e1 RMD160 a6ffd24f5a6d19c22e2e10d6351f2129e550aa71 SHA1 a10f75961de3c6067fb7fcc521242c035a233ce2 SHA256 a05c259d3de0057fbc63903c4ae2adc59b1f48088b86a1c82a4d858caf5d1faf SHA512 29d07cdb501666697956c39ce0cfef9dca8a65d2a44e1dc05038d71b503511682f788f4df376d31e6b20b0ec5ac1f06e2a1fa0e6b5e3daa04fe46958c4e74252
+SLACKBUILD grip.SlackBuild 7300 MD5 1f72daa8c881f1a751d344a76bd6fb28 RMD160 c36d098520bd5f35376e84f595bb142bb15a8ebc SHA1 17eff2da35889030bb2cfbfda4e7b96918adf4b3 SHA256 21355e9985e5e8fc4b8118e28defb054f5b52e654603d21787999acf1c699d2f SHA512 9ebb7a3cb3f3d5d454afb373d288e6f522b5c66bdd49f572ec38563bf910fced63fa51f7e6f477a2c81b7794b37bdf1aba843f3fd325239b53073b53d292da60
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+iQIcBAEBCAAGBQJK0NAeAAoJEEHL93ESzgeiF8MP/R9ND4+v9q372Mk+4XC+BZTT
+ikrpWQgC9ymzeMXR3vLFtZp/ERNnY1eq/h/uiE5iLd1Jui1/VUczzWA0O5Ef2PyJ
+I5ONs3qqXgendCjlnNvudvHffIPPbdrCqST3FX99wyK0Fm3SPREzWBFmN8EgjV3L
+9xDFz6Nui/SzWfefg99GhL/5wVk2NblE0wSlG8oC0XoTsBKnKyasiIheqBcIDunP
+e0brSVuPhEOm9vJompxM5q6J0AygI2K885zbBy81zp+6DuYVqqyAxuDdPWpmYJ2R
+umgjDXyvVTd/GDLUPk/k6SNXz4XSWzMnrU8KXFLGAywfwLjX6UMYvEgT97zILNrx
+79g+F4pEbmEbKMMiyF9NqW2GuXewsD6EuOO7C6KwjDv7FWNg/J+s3XZpzyBC37Xd
+CKft9T6jMIGKFByGUJaMDEFPxTU9l0Dnt476rwl8YwKAqUTBMrq1SHRx0nn7xsvB
+liGN1gqWl9qQuUAoUt1sKq/an5Nv6meiYno4naesWS4lOeK05kNccE1+FTAeLEvp
+bWQ8hIk5+9uYX2PI0yPV1K9FfT+wQMY9THoCnXkMRMh+otGqeVfO8un3cFVudemW
+XC1ppv9uzpr5KgXdrxQO9ElNfsRFLruO6HVYB7kQCSXkh/kkalU2Z6Eo7bFP7w9f
++rQiqe9G8JB9gZb+H4qm
+=ICIi
+-----END PGP SIGNATURE-----
index 027688aea94c4ef4b2d299f5529a9902e4c4bd29..69712fedef040460543d4d84e47cb440ce34ce79 100755 (executable)
 #!/bin/bash
 #
-#  grip.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.
+#  grip.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.
 #
-#  grip.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.
+#  grip.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 grip
-# by rhatto at riseup.net
+# slackbuild for grip, by Silvio Rhatto
+# requires:  
+# tested: grip-3.3.1
+# model: generic.mkSlackBuild $Rev: 822 $
 #
 
-if [ -s "slack-required" ]; then
-  echo Recomended and required packages for building grip 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="grip"
+# Set variables
+CWD="$(pwd)"
+SRC_NAME="grip"
+PKG_NAME="grip"
 ARCH=${ARCH:=i486}
-VERSION=${VERSION:=3.3.1}
+SRC_VERSION=${VERSION:=3.3.1}
+PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')"
 BUILD=${BUILD:=1rha}
-SRC_DIR=${SRC:=$CWD}
+SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME
 TMP=${TMP:=/tmp}
+PKG=${PKG:=$TMP/package-$PKG_NAME}
 REPOS=${REPOS:=$TMP}
-
-if [ "$ARCH" == "x86_64" ]; then
-  export LDFLAGS="-L/lib64 -L/usr/lib64"
-  LIBDIR=/usr/lib64
-else
-  LIBDIR=/usr/lib
+SLACKBUILD_PATH=${SLACKBUILD_PATH:="media/sound/grip"}
+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 -mtune=i686"
+elif [ "$ARCH" = "i486" ]; then
+  SLKCFLAGS="-O2 -march=i486 -mtune=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"
-URL="http://easynews.dl.sourceforge.net/sourceforge/grip/$SRC"
-
-SRC_DIR="$SRC_DIR/$PACKAGE"
-mkdir -p $SRC_DIR
-
-if [ "$PACKAGE_EXT" == "bz2" ]; then
-  tarflag="j"
-else
-  tarflag="z"
+# 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://downloads.sourceforge.net/project/grip/grip/3.3.1/$SRC"
+
+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
+# Check Manifest file
+if [ -e "$CWD/Manifest" ]; then
 
-TMP="$TMP/$PACKAGE"
-rm -rf $TMP
-mkdir -p $TMP
-cd $TMP
+  # Manifest signature checking
+  if grep -q -- "-----BEGIN PGP SIGNED MESSAGE-----" $CWD/Manifest; then
+    echo "Checking Manifest signature..."
+    gpg --verify $CWD/Manifest
+    if [ "$?" != "0" ]; then
+      exit $ERROR_MANIFEST
+    fi
+  fi
 
-tar xvf$tarflag $SRC_DIR/$SRC
-cd $PACKAGE-$VERSION
+  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 rmd160 sha1 sha256 sha512; 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 
-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---------------------------------------------------------|
 grip: grip (cd player and ripper)
 grip:
 grip: Grip is a cd-player and cd-ripper for the Gnome desktop.
@@ -114,18 +210,14 @@ grip: Internet disc lookups are supported for retrieving track information
 grip: from disc database servers.Grip works with DigitalDJ to provide a
 grip: unified "computerized" version of your music collection.
 grip:
-EOF
-
-# docs
-mkdir -p usr/doc/$PACKAGE-$VERSION
+EODESC
 
-for file in ABOUT-NLS AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO; do
-  cp $CWD/$file* usr/doc/$PACKAGE-$VERSION/
-done
+# Build the package
+cd "$PKG"
+mkdir -p $REPOS/$SLACKBUILD_PATH
+makepkg -l y -c n "$REPOS/$SLACKBUILD_PATH/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG
 
-makepkg -c y -l y $REPOS/$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
-