1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright 2008, 2009, 2010, 2013 Patrick J. Volkerding, Sebeka, Minnesota, 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 | VERSION=${VERSION:-$(echo fontconfig-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
---|
25 | BUILD=${BUILD:-2} |
---|
26 | |
---|
27 | # Automatically determine the architecture we're building on: |
---|
28 | if [ -z "$ARCH" ]; then |
---|
29 | case "$( uname -m )" in |
---|
30 | i?86) export ARCH=i486 ;; |
---|
31 | arm*) export ARCH=arm ;; |
---|
32 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
33 | *) export ARCH=$( uname -m ) ;; |
---|
34 | esac |
---|
35 | fi |
---|
36 | |
---|
37 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
38 | |
---|
39 | CWD=$(pwd) |
---|
40 | TMP=${TMP:-/tmp} |
---|
41 | PKG=$TMP/package-fontconfig |
---|
42 | |
---|
43 | if [ "$ARCH" = "i486" ]; then |
---|
44 | SLKCFLAGS="-O2 -march=i486 -mtune=i686" |
---|
45 | LIBDIRSUFFIX="" |
---|
46 | elif [ "$ARCH" = "s390" ]; then |
---|
47 | SLKCFLAGS="-O2" |
---|
48 | LIBDIRSUFFIX="" |
---|
49 | elif [ "$ARCH" = "x86_64" ]; then |
---|
50 | SLKCFLAGS="-O2 -fPIC" |
---|
51 | LIBDIRSUFFIX="64" |
---|
52 | else |
---|
53 | SLKCFLAGS="-O2" |
---|
54 | LIBDIRSUFFIX="" |
---|
55 | fi |
---|
56 | |
---|
57 | rm -rf $PKG |
---|
58 | mkdir -p $TMP $PKG |
---|
59 | |
---|
60 | cd $TMP |
---|
61 | rm -rf fontconfig-$VERSION |
---|
62 | tar xvf $CWD/fontconfig-$VERSION.tar.?z* || exit 1 |
---|
63 | cd fontconfig-$VERSION |
---|
64 | chown -R root:root . |
---|
65 | find . \ |
---|
66 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
67 | -exec chmod 755 {} \; -o \ |
---|
68 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
69 | -exec chmod 644 {} \; |
---|
70 | |
---|
71 | # The wonderful extended version of the font so generously |
---|
72 | # opened up for free modification and distribution by one |
---|
73 | # for the previously proprietary font founderies, and that |
---|
74 | # Stepan Roh did such a marvelous job on getting the ball |
---|
75 | # rolling with should clearly (IMHO) be the default font: |
---|
76 | zcat $CWD/fontconfig.dejavu.diff.gz | patch -p1 --verbose || exit 1 |
---|
77 | |
---|
78 | # Hardcode the default font search path rather than having |
---|
79 | # fontconfig figure it out (and possibly follow symlinks, or |
---|
80 | # index ugly bitmapped fonts): |
---|
81 | zcat $CWD/fontconfig.font.dir.list.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 |
---|
82 | |
---|
83 | CFLAGS=$SLKCFLAGS \ |
---|
84 | ./configure \ |
---|
85 | --prefix=/usr \ |
---|
86 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
87 | --mandir=/usr/man \ |
---|
88 | --sysconfdir=/etc \ |
---|
89 | --with-templatedir=/etc/fonts/conf.avail \ |
---|
90 | --with-baseconfigdir=/etc/fonts \ |
---|
91 | --with-configdir=/etc/fonts/conf.d \ |
---|
92 | --with-xmldir=/etc/fonts \ |
---|
93 | --localstatedir=/var \ |
---|
94 | --enable-static=no \ |
---|
95 | --build=$ARCH-slackware-linux |
---|
96 | |
---|
97 | # Uses a currently non-functional sgml tool, thus '-i': |
---|
98 | make $NUMJOBS || make || exit 1 |
---|
99 | make install DESTDIR=$PKG || exit 1 |
---|
100 | |
---|
101 | # Upstream has changed the default templatedir to /usr/share/fontconfig/conf.avail. |
---|
102 | # This change, if accepted, would break any existing font package containing a |
---|
103 | # conf.avail directory. The safest thing to do is to keep things in the |
---|
104 | # traditional location, but put a link in the new place so that font packages |
---|
105 | # following the new standard location will work. Let's hear it for being |
---|
106 | # "more correct" at the expense of having things "just work"! |
---|
107 | mkdir -p $PKG/usr/share/fontconfig |
---|
108 | ( cd $PKG/usr/share/fontconfig ; ln -sf /etc/fonts/conf.avail . ) |
---|
109 | |
---|
110 | mkdir -p $PKG/usr/doc/fontconfig-$VERSION |
---|
111 | cp -a \ |
---|
112 | AUTHORS COPYING* INSTALL NEWS README \ |
---|
113 | $PKG/usr/doc/fontconfig-$VERSION |
---|
114 | # You can shop for this kind of stuff in the source tarball. |
---|
115 | rm -rf $PKG/usr/share/doc |
---|
116 | rmdir $PKG/usr/share 2>/dev/null |
---|
117 | |
---|
118 | # If there's a ChangeLog, installing at least part of the recent history |
---|
119 | # is useful, but don't let it get totally out of control: |
---|
120 | if [ -r ChangeLog ]; then |
---|
121 | DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) |
---|
122 | cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog |
---|
123 | touch -r ChangeLog $DOCSDIR/ChangeLog |
---|
124 | fi |
---|
125 | |
---|
126 | mkdir -p $PKG/var/log/setup |
---|
127 | cat $CWD/setup.05.fontconfig > $PKG/var/log/setup/setup.05.fontconfig |
---|
128 | chmod 755 $PKG/var/log/setup/setup.05.fontconfig |
---|
129 | |
---|
130 | find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ |
---|
131 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
132 | |
---|
133 | # Set up the default options in /etc/fonts/conf.d: |
---|
134 | ( cd $PKG/etc/fonts/conf.d |
---|
135 | for fontconf in \ |
---|
136 | 20-unhint-small-vera.conf \ |
---|
137 | 30-urw-aliases.conf \ |
---|
138 | 30-metric-aliases.conf \ |
---|
139 | 40-nonlatin.conf \ |
---|
140 | 45-latin.conf \ |
---|
141 | 49-sansserif.conf \ |
---|
142 | 50-user.conf \ |
---|
143 | 51-local.conf \ |
---|
144 | 60-latin.conf \ |
---|
145 | 65-fonts-persian.conf \ |
---|
146 | 65-nonlatin.conf \ |
---|
147 | 69-unifont.conf \ |
---|
148 | 80-delicious.conf \ |
---|
149 | 90-synthetic.conf ; do |
---|
150 | if [ -r ../conf.avail/$fontconf ]; then |
---|
151 | ln -sf ../conf.avail/$fontconf . |
---|
152 | else |
---|
153 | echo "ERROR: unable to symlink ../conf.avail/$fontconf, file does not exist." |
---|
154 | exit 1 |
---|
155 | fi |
---|
156 | done |
---|
157 | if [ ! $? = 0 ]; then |
---|
158 | exit 1 |
---|
159 | fi |
---|
160 | ) |
---|
161 | if [ ! $? = 0 ]; then |
---|
162 | echo "Missing /etc/fonts/$fontconf default. Exiting" |
---|
163 | exit 1 |
---|
164 | fi |
---|
165 | |
---|
166 | # Fix manpages: |
---|
167 | if [ -d $PKG/usr/man ]; then |
---|
168 | ( cd $PKG/usr/man |
---|
169 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
170 | ( cd $manpagedir |
---|
171 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
172 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
173 | rm $eachpage |
---|
174 | done |
---|
175 | gzip -9 *.? |
---|
176 | ) |
---|
177 | done |
---|
178 | ) |
---|
179 | fi |
---|
180 | |
---|
181 | mkdir $PKG/install |
---|
182 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
183 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
---|
184 | |
---|
185 | cd $PKG |
---|
186 | /sbin/makepkg -l y -c n --prepend $TMP/fontconfig-$VERSION-$ARCH-$BUILD.txz |
---|
187 | |
---|