1 | #!/bin/sh |
---|
2 | |
---|
3 | # Slackware build script for icu4c |
---|
4 | |
---|
5 | # Copyright 2007-2013 Heinz Wiesinger, Amsterdam, The Netherlands |
---|
6 | # Copyright 2012, 2013, 2015, 2016 Patrick J. Volkerding, Sebeka, MN, USA |
---|
7 | # All rights reserved. |
---|
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 | PKGNAM=icu4c |
---|
27 | SRCVER=${SRCVER:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 2- -d . | cut -f 2 -d - | rev)} |
---|
28 | VERSION=$(echo $SRCVER | tr _ .) |
---|
29 | BUILD=${BUILD:-2} |
---|
30 | |
---|
31 | # Automatically determine the architecture we're building on: |
---|
32 | if [ -z "$ARCH" ]; then |
---|
33 | case "$( uname -m )" in |
---|
34 | i?86) ARCH=i586 ;; |
---|
35 | arm*) ARCH=arm ;; |
---|
36 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
37 | *) ARCH=$( uname -m ) ;; |
---|
38 | esac |
---|
39 | fi |
---|
40 | |
---|
41 | NUMJOBS=${NUMJOBS:--j6} |
---|
42 | |
---|
43 | CWD=$(pwd) |
---|
44 | TMP=${TMP:-/tmp} |
---|
45 | PKG=$TMP/package-icu4c |
---|
46 | |
---|
47 | if [ "$ARCH" = "i586" ]; then |
---|
48 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
49 | LIBDIRSUFFIX="" |
---|
50 | elif [ "$ARCH" = "s390" ]; then |
---|
51 | SLKCFLAGS="-O2" |
---|
52 | LIBDIRSUFFIX="" |
---|
53 | elif [ "$ARCH" = "x86_64" ]; then |
---|
54 | SLKCFLAGS="-O2 -fPIC" |
---|
55 | LIBDIRSUFFIX="64" |
---|
56 | else |
---|
57 | SLKCFLAGS="-O2" |
---|
58 | LIBDIRSUFFIX="" |
---|
59 | fi |
---|
60 | |
---|
61 | rm -rf $PKG |
---|
62 | mkdir -p $TMP $PKG $OUTPUT |
---|
63 | cd $TMP |
---|
64 | rm -rf icu |
---|
65 | tar xvf $CWD/icu4c-$SRCVER-src.tar.xz || exit 1 |
---|
66 | cd icu || exit 1 |
---|
67 | chown -R root:root . |
---|
68 | find . \ |
---|
69 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
70 | -exec chmod 755 {} \; -o \ |
---|
71 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 \ |
---|
72 | -o -perm 400 \) -exec chmod 644 {} \; |
---|
73 | |
---|
74 | zcat $CWD/icu4c.closenull.patch.gz | patch -p1 --verbose || exit 1 |
---|
75 | |
---|
76 | cd source/ |
---|
77 | CFLAGS="$SLKCFLAGS" \ |
---|
78 | CXXFLAGS="$SLKCFLAGS" \ |
---|
79 | ./configure \ |
---|
80 | --prefix=/usr \ |
---|
81 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
82 | --mandir=/usr/man \ |
---|
83 | --enable-shared \ |
---|
84 | --disable-static \ |
---|
85 | --sysconfdir=/etc \ |
---|
86 | --localstatedir=/var \ |
---|
87 | --disable-samples \ |
---|
88 | --build=$ARCH-slackware-linux || exit 1 |
---|
89 | |
---|
90 | make $NUMJOBS || make || exit 1 |
---|
91 | make install DESTDIR=$PKG || exit 1 |
---|
92 | cd - |
---|
93 | |
---|
94 | find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ |
---|
95 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true |
---|
96 | |
---|
97 | find $PKG/usr/man -type f -exec gzip -9 {} \; |
---|
98 | |
---|
99 | mkdir -p $PKG/usr/doc/icu4c-$VERSION |
---|
100 | cp -a \ |
---|
101 | license.html readme.html $PKG/usr/doc/icu4c-$VERSION |
---|
102 | |
---|
103 | mkdir -p $PKG/install |
---|
104 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
105 | |
---|
106 | cd $PKG |
---|
107 | /sbin/makepkg -l y -c n $TMP/icu4c-$VERSION-$ARCH-$BUILD.txz |
---|