[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | #DEP:libnl |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | # Copyright 2008, 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA |
---|
| 6 | # All rights reserved. |
---|
| 7 | # |
---|
| 8 | # Redistribution and use of this script, with or without modification, is |
---|
| 9 | # permitted provided that the following conditions are met: |
---|
| 10 | # |
---|
| 11 | # 1. Redistributions of this script must retain the above copyright |
---|
| 12 | # notice, this list of conditions and the following disclaimer. |
---|
| 13 | # |
---|
| 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
| 15 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
| 16 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
| 17 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 18 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 19 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
| 20 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
| 21 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
| 22 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
| 23 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 24 | |
---|
| 25 | VERSION=${VERSION:-6.47} |
---|
| 26 | BUILD=${BUILD:-1} |
---|
| 27 | |
---|
| 28 | # Automatically determine the architecture we're building on: |
---|
| 29 | if [ -z "$ARCH" ]; then |
---|
| 30 | case "$( uname -m )" in |
---|
| 31 | i?86) export ARCH=i486 ;; |
---|
| 32 | arm*) export ARCH=arm ;; |
---|
| 33 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
| 34 | *) export ARCH=$( uname -m ) ;; |
---|
| 35 | esac |
---|
| 36 | fi |
---|
| 37 | |
---|
| 38 | if [ "$ARCH" = "i486" ]; then |
---|
| 39 | SLKCFLAGS="-O2 -march=i486 -mtune=i686" |
---|
| 40 | LIBDIRSUFFIX="" |
---|
| 41 | elif [ "$ARCH" = "i686" ]; then |
---|
| 42 | SLKCFLAGS="-O2 -march=i686 -mtune=i686" |
---|
| 43 | LIBDIRSUFFIX="" |
---|
| 44 | elif [ "$ARCH" = "s390" ]; then |
---|
| 45 | SLKCFLAGS="-O2" |
---|
| 46 | LIBDIRSUFFIX="" |
---|
| 47 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 48 | SLKCFLAGS="-O2 -fPIC" |
---|
| 49 | LIBDIRSUFFIX="64" |
---|
| 50 | else |
---|
| 51 | SLKCFLAGS="-O2" |
---|
| 52 | LIBDIRSUFFIX="" |
---|
| 53 | fi |
---|
| 54 | |
---|
| 55 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
| 56 | |
---|
| 57 | CWD=$(pwd) |
---|
| 58 | TMP=${TMP:-/tmp} |
---|
| 59 | PKG=$TMP/package-nmap |
---|
| 60 | |
---|
| 61 | rm -rf $PKG |
---|
| 62 | mkdir -p $TMP $PKG |
---|
| 63 | cd $TMP |
---|
| 64 | rm -rf nmap-$VERSION |
---|
| 65 | tar xvf $CWD/nmap-$VERSION.tar.?z* || exit 1 |
---|
| 66 | cd nmap-$VERSION || exit 1 |
---|
| 67 | |
---|
| 68 | chown -R root:root . |
---|
| 69 | find . \ |
---|
| 70 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
| 71 | -exec chmod 755 {} \; -o \ |
---|
| 72 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
| 73 | -exec chmod 644 {} \; |
---|
| 74 | |
---|
| 75 | sed -i "s,share/man/man1,man/man1,g" ndiff/setup.py |
---|
| 76 | |
---|
| 77 | # --without-nmap-update is needed below to avoid depending on apr and subversion libraries. |
---|
| 78 | # It's not worth the feature IMHO. |
---|
| 79 | LIBS="-lnl" \ |
---|
| 80 | CFLAGS="$SLKCFLAGS" \ |
---|
| 81 | ./configure \ |
---|
| 82 | --prefix=/usr \ |
---|
| 83 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
| 84 | --with-liblua=included \ |
---|
| 85 | --with-libpcap=included \ |
---|
| 86 | --mandir=/usr/man \ |
---|
| 87 | --docdir=/usr/doc/nmap-$VERSION \ |
---|
| 88 | --without-nmap-update \ |
---|
| 89 | --build=$ARCH-slackware-linux |
---|
| 90 | |
---|
| 91 | make $NUMJOBS || make || exit 1 |
---|
| 92 | make install DESTDIR=$PKG || exit 1 |
---|
| 93 | |
---|
| 94 | mkdir -p $PKG/usr/doc/nmap-$VERSION |
---|
| 95 | cp -a COPYING* HACKING INSTALL \ |
---|
| 96 | docs/licenses/ \ |
---|
| 97 | docs/*.txt \ |
---|
| 98 | $PKG/usr/doc/nmap-$VERSION |
---|
| 99 | ( cd docs |
---|
| 100 | # It looks like all of these translations are gone from the 4.00+ tarball, and |
---|
| 101 | # most of them are not available on the web site. Sorry -- I didn't do it. |
---|
| 102 | if [ -f nmap_german.1 ] ; then |
---|
| 103 | mkdir -p $PKG/usr/man/de/man1 |
---|
| 104 | cat nmap_german.1 | gzip -9c > $PKG/usr/man/de/man1/nmap.1.gz |
---|
| 105 | fi |
---|
| 106 | if [ -f nmap_spanish.1 ] ; then |
---|
| 107 | mkdir -p $PKG/usr/man/es/man1 |
---|
| 108 | cat nmap_spanish.1 | gzip -9c > $PKG/usr/man/es/man1/nmap.1.gz |
---|
| 109 | fi |
---|
| 110 | if [ -f nmap_french.1 ] ; then |
---|
| 111 | mkdir -p $PKG/usr/man/fr/man1 |
---|
| 112 | cat nmap_french.1 | gzip -9c > $PKG/usr/man/fr/man1/nmap.1.gz |
---|
| 113 | fi |
---|
| 114 | if [ -f nmap_italian.1 ] ; then |
---|
| 115 | mkdir -p $PKG/usr/man/it/man1 |
---|
| 116 | cat nmap_italian.1 | gzip -9c > $PKG/usr/man/it/man1/nmap.1.gz |
---|
| 117 | fi |
---|
| 118 | if [ -f nmap_lithuanian.1 ] ; then |
---|
| 119 | mkdir -p $PKG/usr/man/lt/man1 |
---|
| 120 | cat nmap_lithuanian.1 | gzip -9c > $PKG/usr/man/lt/man1/nmap.1.gz |
---|
| 121 | fi |
---|
| 122 | if [ -f nmap_portuguese.1 ] ; then |
---|
| 123 | mkdir -p $PKG/usr/man/pt/man1 |
---|
| 124 | cat nmap_portuguese.1 | gzip -9c > $PKG/usr/man/pt/man1/nmap.1.gz |
---|
| 125 | fi |
---|
| 126 | if [ -f nmap_russian.1 ] ; then |
---|
| 127 | mkdir -p $PKG/usr/man/ru/man1 |
---|
| 128 | cat nmap_russian.1 | gzip -9c > $PKG/usr/man/ru/man1/nmap.1.gz |
---|
| 129 | fi |
---|
| 130 | ) |
---|
| 131 | |
---|
| 132 | # If there's a ChangeLog, installing at least part of the recent history |
---|
| 133 | # is useful, but don't let it get totally out of control: |
---|
| 134 | if [ -r CHANGELOG ]; then |
---|
| 135 | DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) |
---|
| 136 | cat CHANGELOG | head -n 1000 > $DOCSDIR/CHANGELOG |
---|
| 137 | touch -r CHANGELOG $DOCSDIR/CHANGELOG |
---|
| 138 | fi |
---|
| 139 | |
---|
| 140 | find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ |
---|
| 141 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
| 142 | |
---|
| 143 | # Compress and link manpages, if any: |
---|
| 144 | if [ -d $PKG/usr/man ]; then |
---|
| 145 | ( cd $PKG/usr/man |
---|
| 146 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
| 147 | ( cd $manpagedir |
---|
| 148 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
| 149 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
| 150 | rm $eachpage |
---|
| 151 | done |
---|
| 152 | gzip -9 *.? |
---|
| 153 | ) |
---|
| 154 | done |
---|
| 155 | ) |
---|
| 156 | fi |
---|
| 157 | |
---|
| 158 | mkdir -p $PKG/install |
---|
| 159 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 160 | |
---|
| 161 | cd $PKG |
---|
| 162 | /sbin/makepkg -l y -c n $TMP/nmap-$VERSION-$ARCH-$BUILD.txz |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | ############ make syn3 packages |
---|
| 166 | cd $CWD |
---|
| 167 | for PKG in /tmp/package-*; do |
---|
| 168 | NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/'` |
---|
| 169 | |
---|
| 170 | #seperate dev-package |
---|
| 171 | syn3_move_dev $PKG $PKG""_dev |
---|
| 172 | syn3_makepkg $PKG""_dev $NAME""_dev $VERSION $ARCH || exit 1 |
---|
| 173 | |
---|
| 174 | #make main package |
---|
| 175 | syn3_makepkg $PKG $NAME $VERSION $ARCH || exit 1 |
---|
| 176 | done |
---|