aboutsummaryrefslogtreecommitdiff
path: root/development/gnulib/gnulib.SlackBuild
blob: e5b6ca29112ff8feb646322ba951fdd5a4b8b3f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash

# Slackware build script for gnulib

# Written by B. Watson (yalhcru@gmail.com)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# Heavily based on Debian's package:
# https://packages.debian.org/sid/gnulib

# According to the gnulib docs at http://www.gnu.org/software/gnulib/,
# this build shouldn't exist: "there is no distribution tarball;
# the idea is to copy files from Gnulib into your own source tree."
# However, Debian packages it, and some projects that use it expect it
# to be installed system-wide (notably, lbzip2 does this). For practical
# reasons, I'm going to package this. Hopefully this saves someone else
# some work in the future.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=gnulib
VERSION=${VERSION:-20140202}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-${VERSION/+/-}-stable
tar xvf $CWD/${PRGNAM}_$VERSION+stable.orig.tar.gz
cd $PRGNAM-${VERSION/+/-}-stable
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

find . \( -name '.git*' -o -name '.cvs*' \) -print0 | xargs -0 rm -rf

# does the same as Debian's 02-shebang.patch
sed -i '1s,#!/usr/local/bin,#!/usr/bin,' lib/uniname/gen-uninames.lisp

make -C doc info
make -C doc html

# Debian does this, is it really necessary?
chmod 755 tests/*.in.sh lib/config.charset

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mv doc/*html COPYING ChangeLog DEPENDENCIES README NEWS* users.txt STATUS* \
  $PKG/usr/doc/$PRGNAM-$VERSION

mkdir -p $PKG/usr/info
gzip -9c < doc/$PRGNAM.info > $PKG/usr/info/$PRGNAM.info.gz
rm -f doc/$PRGNAM.info

mkdir -p $PKG/usr/share/$PRGNAM
cp -a * $PKG/usr/share/$PRGNAM

mkdir -p $PKG/usr/bin
ln -s ../share/$PRGNAM/check-module $PKG/usr/bin/check-module
ln -s ../share/$PRGNAM/gnulib-tool $PKG/usr/bin/gnulib-tool

# man pages lifted straight from the Debian package
mkdir -p $PKG/usr/man/man1
for i in $CWD/manpages/*.1; do
  gzip -9c < $i > $PKG/usr/man/man1/$( basename $i ).gz
done

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE