diff options
author | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2009-06-25 16:29:30 +0000 |
---|---|---|
committer | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2009-06-25 16:29:30 +0000 |
commit | 44fb62ee3f410f9b3ed1388292e4d05c814acd1c (patch) | |
tree | 36fb377d5d06a403009322701b1e79cf54467d92 | |
parent | f46190a42e77d6d92a2f4c3f7eab380fccd08ae0 (diff) | |
download | slackbuilds-44fb62ee3f410f9b3ed1388292e4d05c814acd1c.tar.gz slackbuilds-44fb62ee3f410f9b3ed1388292e4d05c814acd1c.tar.bz2 |
libnet: adding libnet; libnids: adding libnids
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2216 370017ae-e619-0410-ac65-c121f96126d4
-rw-r--r-- | net/libs/libnet/Manifest | 24 | ||||
-rw-r--r-- | net/libs/libnet/libnet.SlackBuild | 248 | ||||
-rw-r--r-- | net/libs/libnids/Manifest | 24 | ||||
-rw-r--r-- | net/libs/libnids/libnids-1.23.diff | 27 | ||||
-rw-r--r-- | net/libs/libnids/libnids.SlackBuild | 307 |
5 files changed, 630 insertions, 0 deletions
diff --git a/net/libs/libnet/Manifest b/net/libs/libnet/Manifest new file mode 100644 index 00000000..e939670d --- /dev/null +++ b/net/libs/libnet/Manifest @@ -0,0 +1,24 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +DIST libnet_1.1.2.1.orig.tar.gz 1021236 MD5 be845c41170d72c7db524f3411b50256 RMD160 2d8d87930d09a74ab369bd7c240af4b5426ae380 SHA1 760783a2adbd845b731e2000aafa3cd9c3b028d5 SHA256 ab01882a3d0556176018c09342cd0731f7cbc8e687795009894c3326942c76ff SHA512 07ad785427ca9c608a2150095f0623edaefe99a09d06d208f5ee6c0de62b03635685eecfaa4872a63b4e66197aaea9ed4358c3308070102b8a6b63a9286dcb47 +MKBUILD libnet.mkbuild 5121 MD5 f46dd6aa0939cc9a35d197c2b5a1bcf0 RMD160 b04c1b5ddc06d2b453d23268bb607891ff226331 SHA1 e352e5763fbd334527cb573a11fab3e320072d8f SHA256 b6072065bbfae80749ec53114f2effeb59029793449ab9f415d737499347719c SHA512 b2f6d5a40856a149a50010fb575a37020a774a971c2f643dd991ea83cdf313e657f00137c68ec85a0b85b450ed437b694b5ffde1a465ba0c8519babf804c8e67 +PATCH libnet_1.1.2.1-2.diff.gz 250734 MD5 5d0019ed3751057497af425396ad02fd RMD160 acd43d4eb5e02b27791f3653f43434a62b7f58da SHA1 28b326c1996e6ba57bcfaa9c385c98392f180bb0 SHA256 7c68656c7059c336bba71fe9663f29fa4bf504edfb72aaacae0d70e78d762788 SHA512 2f10cb85475f2b6ae523194a7e484418604844aa1ef733c40e9f78fbf31b30ca93eb84b41949f3aa1af8b84732c93cd01ebec99ea20c9b8293ab8a82a4b2dee5 +SLACKBUILD libnet.SlackBuild 8020 MD5 7aa96203321e5958b62f1b1ccc7af367 RMD160 90c7a06ccb01dcad5007a54cd4143453888622f8 SHA1 35c02d3a9e0492198e1ed29591f64ec741651fc6 SHA256 e5711b7f4eda0178ab55d8856f78bfdc92a4d1b854eb0b6ecbb3c3365c8d1b76 SHA512 7894e266094dc322850d1f8f9a3d5db79e6b237ddcba5861d8a7a35f24cbfe2588ecc2ebe21eff29d1d2d2c709729224c86bf4e87c18936b00efcdcad25f6cb8 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iQIcBAEBCAAGBQJKQ4/IAAoJEEHL93ESzgei5c4QAJ1UoAFiGFM+M85ynhb9U3pN +qzzBOHREEeyils2M2MmtuoLU/IZJlntHu47OVmOpERbGAlrsQwnnW9MK6QI/ayVx +9DIa7Dip/4jMIqfmPt+kIFaykdpIG6RnNb53ciQpZFw4uGnPNfVNgnYFxX4Yf60N +IgGlazN6PDir/+Lxv0ybs2HNho8xgNfjxGzCZMkef/fawGE7NYPxi5P+MEJWel42 +OJ4XXj1Hc1qi1zGPmCSOZxPLomb1PqP695CIW5OX0Z8NhjkOgReUDctpwTHLaP1h +Pt4VcPoQxwLREX6iKJ37fPC+BFSW6xIndSO8DZdmoS0KV0mmoQCrQNloYnD063LV +CpDQj+zLWUKqDopOjxk52AWz2LqxVOQ2KMOdIAe4Qk2NcyyqXNnXDm80+SugAStb +4GoSzBMR1E1AAhSfQTg+iBoxXWCFzGSdRuLWwNnlViePnvUyK7wB+bOyHJ8J4AUS +9xx1fqMRfUZ8pfM8x8AGXO+UKTuO+2XKxzsIgKZnp5MevRaDczLlFkxmJch4hQA8 +mR+B0dpPBTG+xsypeIacsiRCRWDIe7RF6Omr7Op8sjlte2c2RUDggc5b2m8zpzZd +Pk+AyspT+R9xzrqcyFJNoZP5IyGlQummCji/duCup84YBY0z/5vwJrelufJ+STtT +pn7XZdNk5fvcu5XlY8WO +=x7WI +-----END PGP SIGNATURE----- diff --git a/net/libs/libnet/libnet.SlackBuild b/net/libs/libnet/libnet.SlackBuild new file mode 100644 index 00000000..55753e07 --- /dev/null +++ b/net/libs/libnet/libnet.SlackBuild @@ -0,0 +1,248 @@ +#!/bin/bash +# +# libnet.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. +# +# libnet.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 +# +# slackbuild for libnet, by Silvio Rhatto +# requires: +# tested: libnet-1.1.2.1 +# model: generic.mkSlackBuild $Rev: 805 $ +# + +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + +# Set variables +CWD="$(pwd)" +SRC_NAME="libnet" +PKG_NAME="libnet" +ARCH=${ARCH:=i486} +SRC_VERSION=${VERSION:=1.1.2.1} +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} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="net/libs/libnet"} +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 + +# 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.orig.tar.gz" +URL="http://ftp.de.debian.org/debian/pool/main/libn/libnet/$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 + +# Check Manifest file +if [ -e "$CWD/Manifest" ]; then + + # 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 + + 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 + +else + exit $ERROR_MANIFEST +fi + +# 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" + +# Patch source +patches=" http://ftp.de.debian.org/debian/pool/main/libn/libnet/libnet_1.1.2.1-2.diff.gz + $PKG_NAME.diff $PKG_NAME-$PKG_VERSION.diff + $PKG_NAME-$PKG_VERSION-$ARCH.diff $PKG_NAME-$ARCH.diff" +for patch in $patches; do + patch="`basename $patch`" + if [ -f "$CWD/$patch" ]; then + patch -Np1 < "$CWD/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch" ]; then + patch -Np1 < "$CWD/patches/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/$patch.gz" ]; then + gzip -dc "$CWD/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch.gz" ]; then + gzip -dc "$CWD/patches/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + elif [ -f "$SRC_DIR/$patch" ]; then + if [ "`basename $patch .gz`" != "$patch" ]; then + gzip -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + elif [ "`basename $patch .bz2`" != "$patch" ]; then + bzip2 -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + else + patch -Np1 < "$SRC_DIR/$patch" || exit $ERROR_PATCH + fi + fi +done + +# 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="README VERSION doc/BUGS doc/CHANGELOG doc/CONTRIB doc/COPYING doc/CVS doc/DESIGN_NOTES doc/MIGRATION doc/PACKET_BUILDING doc/PORTED doc/RAWSOCKET_NON_SEQUITUR doc/TODO" +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 + +# 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 +# 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 +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler-------------------------------------------------------| +libnet: libnet +libnet: +libnet: libnet provides a portable framework for low-level +libnet: network packet writing and handling. +libnet: +libnet: +libnet: +libnet: +libnet: +libnet: +libnet: +EODESC + +# 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 + +# Delete source and build directories if requested +if [ "$CLEANUP" == "yes" ] || [ "$1" = "--cleanup" ]; then + rm -rf "$PKG_WORK" "$PKG" +fi diff --git a/net/libs/libnids/Manifest b/net/libs/libnids/Manifest new file mode 100644 index 00000000..93af5aaa --- /dev/null +++ b/net/libs/libnids/Manifest @@ -0,0 +1,24 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +DIST libnids-1.23.tar.gz 140975 MD5 af35e8ef403a0ca95df2da94db856428 RMD160 38994ad04f688291315bfcde38d8795e7a4c4226 SHA1 105bff0d0d35ab95ec90cce98cfb409f64ed44b4 SHA256 755cd72483c2cdccbc6634c00de9e2d8666419fd80da36a2bdb3f81657130643 SHA512 b718a80315de8bb26495c96f18dbd40d86dbbed7140acdfdbaad239149f7f4565dc66eacc88d85686b7ef7048a55e44f638cb4574402606db657888d62cdea64 +MKBUILD libnids.mkbuild 5262 MD5 a9d0eae9454dbec18e74841fc77e12ea RMD160 f8a6799cc8a771b10c5aa6b5903560c66a5e3c83 SHA1 39d036b5b6c43989662c45ed85d0df2946ec248a SHA256 4e65c52f18decd012cc08aaa1ccf0d2c7e103374e4a63f25d254b32185e0fea9 SHA512 66e8f2f758d15bc51d028617d788287be012f87d7a2c4311093662565c52f6f742110fde1de9de99ab7ce703ac1ddf2ecb35d0ed259dc6372120c3c6e0e0e1c1 +PATCH libnids-1.23.diff 1481 MD5 413e29bf5f9b545089b55758622b2183 RMD160 66b123f36c5b9b22ac2ea6741687c2ff4822d090 SHA1 d9e86670d947264b9b3fe037aae937d79f60ed1a SHA256 3e2225e2e0a748b23c6b3f72b3e423d511f73632af745c31c7bc75dae662e8cc SHA512 716852c16bab87a821436238048ba30f042b20929bfc0614b96533d5f013f19b57330a2e8215ec3425fa4a2543500b2eaad75a61fe2fc75e219b8a0deec8083c +SLACKBUILD libnids.SlackBuild 10011 MD5 037bc4839bfff7779814216482bbd58c RMD160 c80e4ee3081e64933fe18247eeaf0e01bd7d7493 SHA1 3fd18d23e6e7c410ead3298a679d5198ba81ccfd SHA256 72556c05e608e1d05d6232ec931151ed604739bd769c188d359d81860c3bfb67 SHA512 8348c353f9365f23756f827498ce4da389eb1ab24cc1731c48e03593f7cac85ab36d8bd4db36d75b42fae9d3d97eae9d92021d102fe25b395eae9409e908ffc7 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iQIcBAEBCAAGBQJKQ6MOAAoJEEHL93ESzgeiLGIP/iXDV8Q7xaz6KDsItlr2R3eX +mvS8HA6ldo3D6dHe/4sILiVR5VJgV6ETc/rHOrLZLrmLjAMshC/kRwxJ0iS+gWb+ +1fTG8Rsx2ydVEQkz7oWQOp57T7R0SzZw7Wh8RnRVzB97BoxNVj4A7wBl6MY/Wmy2 +fuxfofh07S9agkzjut5/4p3EHs30HVZobSfIcqNMl2viCrKjaKGopofLGsAxc9Iu +fJKJd2OD1+MRJQVlxEzx1Kj4/zOdc128YHDoTsYZ8hAtG1rNKDVT/SsXFX/GEGGD +FKpG6/5OY+JRJeuxg2k4aq2bh8wV/ukLOxzjfQ2TMu42/D2BzR0alJl0SLlKKYI3 +4Obh3isGfIcKCj7ZSmkMwTOrG8QsMlZmLEQOz1tlrgYSgfxFBuRMvGVyPyh67DXI +Da5dcF+Nr2bI09cZXCwHiAMMOAl2Gpg7ucpk5iwa407I0jbTe4mCU1cutnuCkR7Z +0ntaoeEGTXB2dhorrtT91Dy3rD3gcFB9rjoZwI2cyiQFQEeybvESqIG/RmJFgRYn +ZvkzNhzxpSSFGUC0sCHXzySi9+tUBhhYTxTeIqzsb/y8xfNvPYLNogA2iPVvGUkf +BisK4ZGKSP/gTWpC86wixahfPXWJ4qnPR6upmyKJ6pK774SNR9vUJhtUultvihoY +QTfEjfN8uUudahlQFrgT +=yQZB +-----END PGP SIGNATURE----- diff --git a/net/libs/libnids/libnids-1.23.diff b/net/libs/libnids/libnids-1.23.diff new file mode 100644 index 00000000..e44cb6d9 --- /dev/null +++ b/net/libs/libnids/libnids-1.23.diff @@ -0,0 +1,27 @@ +diff -Naur libnids-1.23.orig/src/Makefile.in libnids-1.23/src/Makefile.in +--- libnids-1.23.orig/src/Makefile.in 2008-02-21 07:40:19.000000000 -0300 ++++ libnids-1.23/src/Makefile.in 2009-06-25 13:09:07.000000000 -0300 +@@ -68,15 +68,15 @@ + $(CC) -shared -Wl,-soname,$(LIBSHARED) -o $(LIBSHARED) $(OBJS_SHARED) $(LIBS) $(LNETLIB) $(PCAPLIB) + + _install install: $(LIBSTATIC) +- ../mkinstalldirs $(install_prefix)$(libdir) +- ../mkinstalldirs $(install_prefix)$(includedir) +- ../mkinstalldirs $(install_prefix)$(mandir)/man3 +- $(INSTALL) -c -m 644 libnids.a $(install_prefix)$(libdir) +- $(INSTALL) -c -m 644 nids.h $(install_prefix)$(includedir) +- $(INSTALL) -c -m 644 libnids.3 $(install_prefix)$(mandir)/man3 ++ ../mkinstalldirs $(DESTDIR)/$(install_prefix)$(libdir) ++ ../mkinstalldirs $(DESTDIR)/$(install_prefix)$(includedir) ++ ../mkinstalldirs $(DESTDIR)/$(install_prefix)$(mandir)/man3 ++ $(INSTALL) -c -m 644 libnids.a $(DESTDIR)/$(install_prefix)$(libdir) ++ $(INSTALL) -c -m 644 nids.h $(DESTDIR)/$(install_prefix)$(includedir) ++ $(INSTALL) -c -m 644 libnids.3 $(DESTDIR)/$(install_prefix)$(mandir)/man3 + _installshared installshared: install $(LIBSHARED) +- $(INSTALL) -c -m 755 $(LIBSHARED) $(install_prefix)$(libdir) +- ln -s -f $(LIBSHARED) $(install_prefix)$(libdir)/libnids.so ++ $(INSTALL) -c -m 755 $(LIBSHARED) $(DESTDIR)/$(install_prefix)$(libdir) ++ ln -s -f $(LIBSHARED) $(DESTDIR)/$(install_prefix)$(libdir)/libnids.so + + clean: + rm -f *.o *~ $(LIBSTATIC) $(LIBSHARED) diff --git a/net/libs/libnids/libnids.SlackBuild b/net/libs/libnids/libnids.SlackBuild new file mode 100644 index 00000000..d0910f68 --- /dev/null +++ b/net/libs/libnids/libnids.SlackBuild @@ -0,0 +1,307 @@ +#!/bin/bash +# +# libnids.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. +# +# libnids.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 +# +# slackbuild for libnids, by Silvio Rhatto +# requires: +# tested: libnids-1.23 +# model: generic.mkSlackBuild $Rev: 805 $ +# + +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + +# Set variables +CWD="$(pwd)" +SRC_NAME="libnids" +PKG_NAME="libnids" +ARCH=${ARCH:=i486} +SRC_VERSION=${VERSION:=1.23} +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} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="net/libs/libnids"} +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 + +# 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/libnids/$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 + +# Import minimized signing key from +if echo [[SIGNING KEY URL]] | grep -q -v "SIGNING KEY URL"; then + lynx -dump [[SIGNING KEY URL]] | gpg --import || exit $ERROR_GPG +elif echo 6F5C037F | grep -q -v "SIGNING KEY ID"; then + gpg --recv-keys 6F5C037F || exit $ERROR_GPG +else + gpg --import << EOKEY || exit $ERROR_GPG +[[SIGNING KEY]] +EOKEY +fi + +# Download source's signature if necessary and check it +if echo http://downloads.sourceforge.net/libnids/libnids-1.23.tar.gz.asc | grep -q -v "SIGNING URL"; then + SIGNATURE="`basename http://downloads.sourceforge.net/libnids/libnids-1.23.tar.gz.asc`" + if [ ! -s "$SRC_DIR/$SIGNATURE" ]; then + wget "http://downloads.sourceforge.net/libnids/libnids-1.23.tar.gz.asc" -O "$SRC_DIR/$SIGNATURE" || exit $ERROR_WGET + fi +else + if [ -s "$SRC_DIR/$SRC.sig" ]; then + SIGNATURE="$SRC.sig" + elif [ -s "$SRC_DIR/$SRC.asc" ]; then + SIGNATURE="$SRC.asc" + else + echo Trying to get signature file from $URL.sig... + if wget "$URL.sig" -O "$SRC_DIR/$SRC.sig"; then + SIGNATURE="$SRC.sig" + else + rm $SRC_DIR/$SRC.sig + echo Trying to get signature file from $URL.asc... + if wget "$URL.asc" -O "$SRC_DIR/$SRC.asc"; then + SIGNATURE="$SRC.asc" + else + rm $SRC_DIR/$SRC.asc + echo "Error getting source's signature file" + exit $ERROR_GPG + fi + fi + fi +fi + +echo Checking $SRC_DIR/$SRC with gpg using $SRC_DIR/$SIGNATURE... +gpg --verify "$SRC_DIR/$SIGNATURE" "$SRC_DIR/$SRC" || exit $ERROR_GPG +echo Success. + +# Check Manifest file +if [ -e "$CWD/Manifest" ]; then + + # 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 + + 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 + +else + exit $ERROR_MANIFEST +fi + +# 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" + +# Patch source +patches=" [[PATCH URLS]] + $PKG_NAME.diff $PKG_NAME-$PKG_VERSION.diff + $PKG_NAME-$PKG_VERSION-$ARCH.diff $PKG_NAME-$ARCH.diff" +for patch in $patches; do + patch="`basename $patch`" + if [ -f "$CWD/$patch" ]; then + patch -Np1 < "$CWD/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch" ]; then + patch -Np1 < "$CWD/patches/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/$patch.gz" ]; then + gzip -dc "$CWD/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch.gz" ]; then + gzip -dc "$CWD/patches/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + elif [ -f "$SRC_DIR/$patch" ]; then + if [ "`basename $patch .gz`" != "$patch" ]; then + gzip -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + elif [ "`basename $patch .bz2`" != "$patch" ]; then + bzip2 -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + else + patch -Np1 < "$SRC_DIR/$patch" || exit $ERROR_PATCH + fi + fi +done + +# 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 +) + +# Compress and link manpages +if [ -d "$PKG/$PREFIX/man" ]; then + ( cd "$PKG/$PREFIX/man" + for manpagedir in $(find . -type d -name "man*") ; do + ( cd $manpagedir + for eachpage in $( find . -type l -maxdepth 1) ; do + ln -s $( readlink $eachpage ).gz $eachpage.gz + rm $eachpage + done + gzip -9 *.? + ) + done + ) +fi + +# Install documentation +DOCS="CHANGES COPYING CREDITS MISC 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 + +# 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 +# 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 +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +libnids: libnids +libnids: +libnids: Libnids is a library that provides the functionality of one +libnids: of the NIDS (Network Intrusion Detection System) components, +libnids: namely E-component. Libnids code watches all local network +libnids: traffic, cooks received datagrams a bit, and provides convenient +libnids: information about them to the NIDS analyzing modules. Libnids +libnids: performs assembly of TCP segments into TCP streams, IP +libnids: defragmentation, and TCP port scan detection. +libnids: +libnids: +EODESC + +# 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 + +# Delete source and build directories if requested +if [ "$CLEANUP" == "yes" ] || [ "$1" = "--cleanup" ]; then + rm -rf "$PKG_WORK" "$PKG" +fi |