1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright 2008, 2009, 2010, 2012, 2015 Patrick J. Volkerding, Sebeka, MN, USA |
---|
4 | # All rights reserved. |
---|
5 | # |
---|
6 | # Redistribution and use of this script, with or without modification, is |
---|
7 | # permitted provided that the following conditions are met: |
---|
8 | # |
---|
9 | # 1. Redistributions of this script must retain the above copyright |
---|
10 | # notice, this list of conditions and the following disclaimer. |
---|
11 | # |
---|
12 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
13 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
14 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
15 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
16 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
17 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
18 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
19 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
20 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
21 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
22 | |
---|
23 | |
---|
24 | PKGNAM=intltool |
---|
25 | VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
---|
26 | BUILD=${BUILD:-2} |
---|
27 | |
---|
28 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
29 | |
---|
30 | # Automatically determine the architecture we're building on: |
---|
31 | if [ -z "$ARCH" ]; then |
---|
32 | case "$( uname -m )" in |
---|
33 | i?86) export ARCH=i586 ;; |
---|
34 | arm*) export ARCH=arm ;; |
---|
35 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
36 | *) export ARCH=$( uname -m ) ;; |
---|
37 | esac |
---|
38 | fi |
---|
39 | |
---|
40 | CWD=$(pwd) |
---|
41 | TMP=${TMP:-/tmp} |
---|
42 | PKG=$TMP/package-${PKGNAM} |
---|
43 | |
---|
44 | if [ "$ARCH" = "i586" ]; then |
---|
45 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
46 | elif [ "$ARCH" = "s390" ]; then |
---|
47 | SLKCFLAGS="-O2" |
---|
48 | elif [ "$ARCH" = "x86_64" ]; then |
---|
49 | SLKCFLAGS="-O2 -fPIC" |
---|
50 | else |
---|
51 | SLKCFLAGS="-O2" |
---|
52 | fi |
---|
53 | |
---|
54 | rm -rf $PKG |
---|
55 | mkdir -p $TMP $PKG |
---|
56 | cd $TMP |
---|
57 | rm -rf ${PKGNAM}-${VERSION} |
---|
58 | tar xvf $CWD/${PKGNAM}-$VERSION.tar.?z* || exit 1 |
---|
59 | cd ${PKGNAM}-$VERSION || exit 1 |
---|
60 | |
---|
61 | # Make sure ownerships and permissions are sane: |
---|
62 | chown -R root:root . |
---|
63 | find . \ |
---|
64 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
65 | -exec chmod 755 {} \; -o \ |
---|
66 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
67 | -exec chmod 644 {} \; |
---|
68 | |
---|
69 | # Compatability with perl 5.22: |
---|
70 | zcat $CWD/intltool-0.51.0-perl-5.22.patch.gz | patch -p1 --verbose || exit 1 |
---|
71 | |
---|
72 | # Configure: |
---|
73 | CFLAGS="$SLKCFLAGS" \ |
---|
74 | ./configure \ |
---|
75 | --prefix=/usr \ |
---|
76 | --mandir=/usr/man \ |
---|
77 | --infodir=/usr/info \ |
---|
78 | --docdir=/usr/doc/${PKGNAM}-$VERSION \ |
---|
79 | --build=$ARCH-slackware-linux || exit 1 |
---|
80 | |
---|
81 | # Build and install: |
---|
82 | make $NUMJOBS || make || exit 1 |
---|
83 | make install DESTDIR=$PKG || exit 1 |
---|
84 | |
---|
85 | # Strip binaries: |
---|
86 | find $PKG | xargs file | grep -e "executable" -e "shared object" \ |
---|
87 | | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
88 | |
---|
89 | # Compress and link manpages, if any: |
---|
90 | if [ -d $PKG/usr/man ]; then |
---|
91 | ( cd $PKG/usr/man |
---|
92 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
93 | ( cd $manpagedir |
---|
94 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
95 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
96 | rm $eachpage |
---|
97 | done |
---|
98 | gzip -9 *.? |
---|
99 | ) |
---|
100 | done |
---|
101 | ) |
---|
102 | fi |
---|
103 | |
---|
104 | # Compress info files, if any: |
---|
105 | if [ -d $PKG/usr/info ]; then |
---|
106 | rm -f $PKG/usr/info/dir |
---|
107 | gzip -9 $PKG/usr/info/* |
---|
108 | fi |
---|
109 | |
---|
110 | # Add a documentation directory: |
---|
111 | mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION |
---|
112 | cp -a \ |
---|
113 | AUTHORS COPYING* INSTALL NEWS README* TODO \ |
---|
114 | $PKG/usr/doc/${PKGNAM}-$VERSION |
---|
115 | |
---|
116 | # If there's a ChangeLog, installing at least part of the recent history |
---|
117 | # is useful, but don't let it get totally out of control: |
---|
118 | if [ -r ChangeLog ]; then |
---|
119 | DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION) |
---|
120 | cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog |
---|
121 | touch -r ChangeLog $DOCSDIR/ChangeLog |
---|
122 | fi |
---|
123 | |
---|
124 | mkdir -p $PKG/install |
---|
125 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
126 | |
---|
127 | cd $PKG |
---|
128 | /sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz |
---|
129 | |
---|