]> gitweb.fluxo.info Git - slackbuilds.git/commitdiff
unrar: adding unrar
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Tue, 27 Jan 2009 17:04:43 +0000 (17:04 +0000)
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Tue, 27 Jan 2009 17:04:43 +0000 (17:04 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2096 370017ae-e619-0410-ac65-c121f96126d4

app/arch/unrar/Manifest [new file with mode: 0644]
app/arch/unrar/unrar.SlackBuild

diff --git a/app/arch/unrar/Manifest b/app/arch/unrar/Manifest
new file mode 100644 (file)
index 0000000..6ebb227
--- /dev/null
@@ -0,0 +1,23 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+DIST unrarsrc-3.8.5.tar.gz 135670 MD5 875688e6a144a3f75d2a6a0da3e43f8b RMD160 acc20420466f50e6826ae34d3b663f0b9c541ec9 SHA1 911d3ef2c279d9522afa22b452176dd86883a751 SHA256 9173a68f7ec106248a4942653b9bd2ca8e3c8d288b543d1462dda6d52b11338a SHA512 66244e6023568c6d285e5ede2a7fc13f3f76a5e3445ffaa4f324f9bd899fa7d2d406815f06a50a527a055d1e0bf1aad798995ca39457a0743bd3c3be47f30429
+MKBUILD unrar.mkbuild 3729 MD5 6e97f03292add237a36f7394e0d589a3 RMD160 79a8bd02199e33d2820e37bbc76abcff3466a4c6 SHA1 d793eb77d037d7eab06e035a2d0ce9ea2c431c97 SHA256 b2b3e50d28f781e8ee074a91976a9c085e3aff5f071f83e6769d71f4db32d491 SHA512 a110b389b5175de60e846be17b2106e7024da4efb88a63ca8b5d9ceeebde34aa62260a76703dd619f5a97b50d93d85fca89280d3e6c1aa1c8f584a3b97161299
+SLACKBUILD unrar.SlackBuild 6547 MD5 5456fb34ea276891c276ab6825bf2b84 RMD160 482ee2fe4b4af51dfcf1b54a5f45af516d193695 SHA1 8c8ced8e48c94187bfe2239a94c896b59b4ff80c SHA256 fe852932de163ed0fd6e4911bd1189e7cb412267dd0bb1966a7ccdf5cc5d5b2f SHA512 4ecfdd2b1260863279ff30b0790110495c79ebcd0f5aedf7c4a8fa1a677b8ef0a94c5f7f26368faa3a288bf1eec38415d1aec1df7880ac5e8990aa83d1675680
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+iQIcBAEBAgAGBQJJfz+lAAoJEEHL93ESzgeiFLEP/RmhNgs3dCUu0CQDTDY/WgeY
+Z1GenaM4rednZReD9O4HNbkTJVaGKDTjXbut3q1v9fvzQyYsuZh9HImw9plf+SvO
+LYLCrKhvNquaSKg5sCTQofNuabfAfApFPDgBrug8FrkRt3BNVxYX+ePa7VjkTWfM
+V0OxOluWTPbsSH8unxZUj1cd7dk+ahJX4BGpMA+2WrvI/Nyeq/r9ylwvQmi0fFb7
+THKoVHckBAtRD9+e5x0ss1BKTCqhYBv5KZ0ObMOh5x/Ep/6R3uablZa2EngP3opG
+dXdQafFZsZeKbLer0VYJNWB2MXJgB/TKuWAkFMiqGQUgOLUDCQpvSmwnEJOW4Nbb
+Ln0XDnPL1TC8pfYdV2iaAv0ZwVzoZxGw8mBs3AcZM2+u2s6nDvlDInBTQJO2FXQW
+TAPJIxnnTawxuA/y1GRjxV+2kUEuQb4NMINGAVyRzhjABswsXA1U0ATbEKQvuVKv
+0ZBtrFDuB0XAAnAyoxKsVNL+lUYndyIX7TQ2AhpfvdscCe41T75+CpRBOIN24BgA
+Jw3p6EOW6Fn2q9S9aSdrEhfZY0xZDJNARTv3B8JCfiVPJ4x8+4qBjb+WBk7GJQzn
+gqzH1L3DSTZDGEBiX3/CPx2P70m57209RN1EhrMAtd63J38/rqhqLR4dp0y0+D+a
+CzwhtBdKFdcS+yOI4ZcM
+=fjgw
+-----END PGP SIGNATURE-----
index 35dace72eee53c019f80d3bf6d93adab04ab1e4b..87df5cbc3d5657c15725a8fd741526f889591e31 100755 (executable)
 #!/bin/bash
 #
-#  unrar.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.
+#  unrar.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.
 #
-#  unrar.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.
+#  unrar.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 unrar
-# by rhatto at riseup.net
+# slackbuild for unrar, by Silvio Rhatto
+# requires:  
+# tested: unrar-3.8.5
 #
 
-CWD="`pwd`"
-
+# Look for slackbuildrc
 if [ -f ~/.slackbuildrc ]; then
   source ~/.slackbuildrc
 elif [ -f /etc/slackbuildrc ]; then
   source /etc/slackbuildrc
 fi
 
-# default settings
-PACKAGE="unrar"
+# Set variables
+CWD="$(pwd)"
+SRC_NAME="unrarsrc"
+PKG_NAME="unrar"
 ARCH=${ARCH:=i486}
-VERSION=${VERSION:=0.40}
+SRC_VERSION=${VERSION:=3.8.5}
+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
-  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 -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
 
-SRC_DIR="$SRC_DIR/$PACKAGE"
-mkdir -p $SRC_DIR
-
-RTOOL="wget"
-PACKAGE_EXT="bz2"
-SRC="unrarlib040.tar.bz2"
-URL="http://www.unrarlib.org/download/$SRC"
-PATCH="unrarlib040-unrar-patch-ab.tar.gz"
-PATCH_URL="http://www.unrarlib.org/download/contribution/$PATCH"
-
-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="ftp://ftp.rarlabs.com/rar/$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" ]; then
-  if [ ! -f "$SRC_DIR/$SRC" ]; then
-    wget "$URL" -O "$SRC_DIR/$SRC"
-  fi
+# Check Manifest file
+if [ -e "$CWD/Manifest" ]; then
 
-  if [ ! -f "$SRC_DIR/$PATCH" ]; then
-    wget "$PATCH_URL" -O "$SRC_DIR/$PATCH"
+  # 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
-fi
-
-TMP="$TMP/$PACKAGE"
-rm -rf $TMP
-mkdir -p $TMP
-cd $TMP
 
-tar zxvf $SRC_DIR/$PATCH
-tar xvf$tarflag $SRC_DIR/$SRC
-cd unrarlib040-unrar-patch-ab
-cp ../unrarlib-0.4.0/unrarlib/* .
+  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
 
-make || exit 32
-
-mkdir -p $TMP/package-$PACKAGE/usr/{bin,doc/$PACKAGE-$VERSION}
-cp unrar $TMP/package-$PACKAGE/usr/bin
-cp readme.txt $TMP/package-$PACKAGE/usr/doc/$PACKAGE-$VERSION/readme-unrar.txt
-cp  ../unrarlib-0.4.0/{gpl,licence,unrarlib-license}.txt $TMP/package-$PACKAGE/usr/doc/$PACKAGE-$VERSION
-cp  ../unrarlib-0.4.0/readme.txt $TMP/package-$PACKAGE/usr/doc/$PACKAGE-$VERSION/readme-unrarlib.txt
-
-CWD="`pwd`"
-
-cd $TMP/package-$PACKAGE
+else
+  exit $ERROR_MANIFEST
+fi
 
-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"
+
+# Make
+make -f makefile.unix || exit $ERROR_MAKE
+
+# Install
+mkdir -p $PKG/bin
+make -f makefile.unix DESTDIR=$PKG install || 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="license.txt"
+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--------------------------------------------------------|
 unrar: unrar (unpack RAR 2 archives)
 unrar:
+unrar: unRAR is a utility to extract, view, and test the
+unrar: contents of an RAR archive, version 1.50 and above.
 unrar:
 unrar:
 unrar:
@@ -109,13 +203,13 @@ unrar:
 unrar:
 unrar:
 unrar:
-unrar:
-unrar:
-EOF
+EODESC
 
-makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz
+# Build the package
+cd "$PKG"
+makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG
 
-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
-