source: npl/overig/libbsd/libbsd.SlackBuild.orig @ 0105685

gcc484ntopperl-5.22
Last change on this file since 0105685 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 4.3 KB
Line 
1#!/bin/sh
2
3# Heavily based on the Slackware 14.1 SlackBuild
4# Written by miklos < ardutu at gmail dot com >
5
6# Slackware build script for libbsd
7# Official Site: http://libbsd.freedesktop.org/wiki
8
9# Redistribution and use of this script, with or without modification, is
10# permitted provided that the following conditions are met:
11#
12# 1. Redistributions of this script must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
16# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25#
26# Requirements:
27
28PKGNAME=libbsd
29VERSION=${VERSION:-0.6.0}
30ARCH=${ARCH:-$(uname -m)}
31BUILD=${BUILD:-1}
32TAG=${TAG:-sl}
33SOURCE="http://libbsd.freedesktop.org/releases/${PKGNAME}-${VERSION}.tar.xz"
34TAR=
35DIR=
36DOCS="COPYING ChangeLog README TODO"
37SLKFILES=
38
39# Automatically determine the architecture we're building on:
40case "$ARCH" in
41          i?86) export ARCH=i486; SLKCFLAGS="-O2 -march=i486 -mtune=i686"; CHOST="i486-slackware-linux" ;;
42        x86_64) SLKCFLAGS="-O2 -fPIC"; LIBDIRSUFFIX="64"; CHOST="x86_64-slackware-linux" ;;
43          arm*) export ARCH=arm; SLKCFLAGS="-O2 -march=armv5te"; CHOST="arm-slackware-linux-gnueabi" ;;
44# Unless $ARCH is already set, use uname -m for all other archs:
45                 *) export ARCH=$( uname -m ) ;;
46esac
47
48# Do not touch following if not needed
49JOBS=${JOBS:--j2}
50CWD=$(pwd)
51TMP=${TMP:-/tmp/buildpkgs/$PKGNAME}
52PKG=$TMP/package-$PKGNAME
53OUTPUT=${OUTPUT:-$CWD}
54TAR=${TAR:-$(basename $SOURCE)}
55DIR=${DIR:-$(echo "$TAR"|sed -r 's/(\.tar|)(.gz|.bz2|.xz|.tgz|)$//')}
56
57if [ ! -e $CWD/$TAR ];then
58        wget --no-check-certificate $SOURCE -O "$CWD/$TAR"
59fi
60
61### Preparing Source
62rm -rf $TMP
63mkdir -p $TMP $PKG $OUTPUT
64cd $TMP
65tar xvf $CWD/$TAR
66cd $DIR
67
68chown -R root:root .
69chmod -R u+w,go+r-w,a-s .
70
71CFLAGS="$CFLAGS $SLKCFLAGS" \
72CXXFLAGS="$CXXFLAGS $SLKCFLAGS" \
73./configure \
74        --prefix=/usr \
75        --libdir=/usr/lib$LIBDIRSUFFIX \
76        --docdir=/usr/doc/$PKGNAME-$VERSION \
77        --sysconfdir=/etc \
78        --localstatedir=/var \
79        --mandir=/usr/man \
80        --disable-static \
81        --build=$CHOST
82make $JOBS
83make install DESTDIR=$PKG
84
85# Documentation
86mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION
87for DC in $DOCS;do
88        [ -e $DC ] && cp -r $DC $PKG/usr/doc/$PKGNAME-$VERSION/ || true
89done
90
91mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild     
92cd $CWD
93for SB in $PKGNAME.SlackBuild slack-desc doinst.sh doinst.sh.gz EULA.TXT $SLKFILES;do
94        [ -e "$SB" ] && cp -r $SB $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/$SB || true
95done
96
97for i in man info
98do
99    if [ -d $PKG/usr/$i ]; then
100                cd $PKG/usr/$i
101                find . -type f -exec gzip -9 {} \;
102                for file in $( find . -type l ) ; do ln -s $( readlink $file ).gz $file.gz ; rm $file ; done
103                [ "$i" == "info" ] && rm -f dir
104    fi
105done
106       
107cd $PKG
108find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true
109find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true
110find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true
111
112mkdir -p $PKG/install
113cat $CWD/slack-desc > $PKG/install/slack-desc
114[ -e $CWD/doinst.sh ] && cat $CWD/doinst.sh > $PKG/install/doinst.sh
115[ -e $CWD/doinst.sh.gz ] && zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
116
117cd $PKG
118chown -R root:root $PKG
119
120if [ -x "$(which requiredbuilder 2>/dev/null)" ];then
121        requiredbuilder -y -v -s $CWD $PKG # add "-c -b" if you have binary files in /usr/share
122        [ -e install/slack-required ] && cat install/slack-required > $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/slack-required
123fi
124
125/sbin/makepkg -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
126
127if [ "$1" = "--cleanup" ]; then
128        rm -rf $TMP
129fi
Note: See TracBrowser for help on using the repository browser.