network/hping3: Switch to i586 + Add patches.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Brenton Earl 2016-12-17 06:28:53 +07:00 committed by Willy Sudiarto Raharjo
parent 343a598543
commit 0850342043
3 changed files with 67 additions and 45 deletions

View file

@ -1,11 +1,9 @@
#!/bin/sh
# Slackware build script for hping3 TCP/IP packet assembler/analyzer
#
# Copyright 2015 Brenton Earl <brent@exitstatusone.com>
# All rights reserved.
#
# Copyright 2009-2010 Marco Bonetti <sid77@slackware.it>
# Copyright 2015-2016 Brenton Earl <brent@exitstatusone.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -32,7 +30,7 @@ TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
@ -46,8 +44,8 @@ OUTPUT=${OUTPUT:-/tmp}
DOCS="APD.txt API.txt AS-BACKDOOR HPING2-HOWTO.txt HPING2-IS-OPEN HPING3.txt \
MORE-FUN-WITH-IPID SPOOFED_SCAN.txt hping2rc.example"
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@ -70,55 +68,34 @@ tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Add some of Debian's patchset
patch -p1 < $CWD/patches/libpcap0.8.diff
patch -p1 < $CWD/patches/bytesex.diff
patch -p1 < $CWD/patches/spelling.diff
patch -p1 < $CWD/patches/personality.diff
patch -p1 < $CWD/patches/tcl.diff
patch -p1 < $CWD/patches/ip_id_field.diff
patch -p1 < $CWD/patches/dontfrag_offbyone.diff
patch -p1 < $CWD/patches/rtt_icmp_unreachable.diff
patch -p1 < $CWD/patches/spelling_error_in_binary.diff
patch -p1 < $CWD/patches/data_size_udp.diff
patch -p1 < $CWD/patches/tcp_mss.diff
patch -p1 < $CWD/patches/ip_optlen_conflicting_types.diff
for i in $CWD/patches/*.diff; do
patch -p1 --verbose < "$i"
done
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
MANPATH=/usr/man ./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--build=$ARCH-slackware-linux
make \
CCOPT="$SLKCFLAGS -DUSE_TCL" \
INSTALL_MANPATH=/usr/man
# From Arch Linux - Adds DESTDIR to Makefile
patch -p1 --verbose < $CWD/patches/Makefile.patch
# Install is done by hand, as the Makefile doesn't understand DESTDIR
# (and it's just one file)
install -d $PKG/usr/sbin/
install -m 0755 hping3 $PKG/usr/sbin/
( cd $PKG/usr/sbin
ln -sf hping3 hping
ln -sf hping3 hping2
)
install -d $PKG/usr/man/man8/
install -m 0644 docs/hping2.8 $PKG/usr/man/man8/
install -m 0644 docs/hping3.8 $PKG/usr/man/man8/
make CCOPT="$SLKCFLAGS -DUSE_TCL"
make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
( 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
)
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
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
( cd docs ; cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION )
@ -128,4 +105,4 @@ mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
/sbin/makepkg -p -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,30 @@
diff -Naur hping3-20051105/Makefile hping3-20051105-new/Makefile
--- hping3-20051105/Makefile 2005-11-05 05:31:41.000000000 -0500
+++ hping3-20051105-new/Makefile 2009-02-26 03:21:46.000000000 -0500
@@ -72,16 +72,18 @@
rm -rf hping3 *.o byteorder byteorder.h systype.h Makefile libars.a .depend
install: hping3
- cp -f hping3 /usr/sbin/
- chmod 755 /usr/sbin/hping3
- ln -s /usr/sbin/hping3 /usr/sbin/hping
- ln -s /usr/sbin/hping3 /usr/sbin/hping2
- @if [ -d ${INSTALL_MANPATH}/man8 ]; then \
- cp ./docs/hping3.8 ${INSTALL_MANPATH}/man8; \
- chmod 644 ${INSTALL_MANPATH}/man8/hping3.8; \
+ @[ ! -d ${DESTDIR}/usr/bin ] && install -d ${DESTDIR}/usr/bin
+ cp -f hping3 ${DESTDIR}/usr/bin/
+ chmod 755 ${DESTDIR}/usr/bin/hping3
+ ln -s hping3 ${DESTDIR}/usr/bin/hping
+ ln -s hping3 ${DESTDIR}/usr/bin/hping2
+ @[ ! -d ${DESTDIR}${INSTALL_MANPATH}/man8 ] && install -d ${DESTDIR}${INSTALL_MANPATH}/man8
+ @if [ -d ${DESTDIR}${INSTALL_MANPATH}/man8 ]; then \
+ cp ./docs/hping3.8 ${DESTDIR}${INSTALL_MANPATH}/man8; \
+ chmod 644 ${DESTDIR}${INSTALL_MANPATH}/man8/hping3.8; \
else \
echo "@@@@@@ WARNING @@@@@@"; \
- echo "Can't install the man page: ${INSTALL_MANPATH}/man8 does not exist"; \
+ echo "Can't install the man page: ${DESTDIR}${INSTALL_MANPATH}/man8 does not exist"; \
fi
strip: hping3

View file

@ -1 +1,16 @@
Thanks to Debian for the patchset :-)
Thanks to Debian for these patches :-)
* bytesex.diff
* data_size_udp.diff
* dontfrag_offbyone.diff
* ip_id_field.diff
* ip_optlen_conflicting_types.diff
* libpcap0.8.diff
* personality.diff
* rtt_icmp_unreachable.diff
* spelling.diff
* spelling_error_in_binary.diff
* tcl.diff
* tcp_mss.diff
Thanks to Arch Linux for this patch :-)
* Makefile.patch