aboutsummaryrefslogtreecommitdiff
path: root/network/icecat/icecat.SlackBuild
blob: 7268c7f7c4d6109aa4b368e2dc35b9ab42bf2fe3 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/sh

# Slackware build script for icecat
# Written by David Negroni <dnegroni.italy@gmail.com>
# Modified by melikamp <melikamp@melikamp.net>
# With some code copy-pasted from Patrick J. Volkerding's
# firefox build script.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version, with the following exception:
# the text of the GPL license may be omitted.

# This program is distributed in the hope that it will be useful, but
# without any warranty; without even the implied warranty of
# merchantability or fitness for a particular purpose. Compiling,
# interpreting, executing or merely reading the text of the program
# may result in lapses of consciousness and/or very being, up to and
# including the end of all existence and the Universe as we know it.
# See the GNU General Public License for more details.

# You may have received a copy of the GNU General Public License along
# with this program (most likely, a file named COPYING).  If not, see
# <http://www.gnu.org/licenses/>.

PRGNAM="icecat"
VERSION=${VERSION:-38.5.2}
RELEASEVER="$VERSION"
RELEASEVERMAJ=$(echo $RELEASEVER | cut -f 1 -d .)
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS=""
  LIBDIRSUFFIX=""
  OPTIMIZE=" --enable-optimize=-O2 "
  # On IA32, use gold since GNU ld runs out of memory linking libxul.so:
  PATH="$(pwd)/gold:$PATH"
  export CC="gcc -B$(pwd)/gold"
  export CXX="g++ -B$(pwd)/gold"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
  OPTIMIZE=" --enable-optimize=-O2 "
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
  OPTIMIZE=" --enable-optimize=-O2 "
elif [ "$ARCH" = "arm" ]; then
  SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
  LIBDIRSUFFIX=""
  OPTIMIZE=" --enable-optimize=-O2 "
elif [ "$ARCH" = "armel" ]; then
  SLKCFLAGS="-O2 -march=armv4t"
  LIBDIRSUFFIX=""
  OPTIMIZE=" --enable-optimize=-O2 "
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
  OPTIMIZE=" --enable-optimize=-O2 "
fi

# When it works, it builds much faster.
#NUMJOBS=${NUMJOBS:-" -j7 "}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/${PRGNAM}-$VERSION-gnu1.tar.bz2
cd ${PRGNAM}-$VERSION

# https://bugzilla.mozilla.org/show_bug.cgi?id=1194520
sed -e '/^ftglyph.h/i ftfntfmt.h' \
  -e '/^freetype\/ftcache.h/a freetype\/ftfntfmt.h' \
  -i config/system-headers

# https://bugzilla.mozilla.org/show_bug.cgi?id=1233963
patch -p1 < $CWD/changeset280875.patch

chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

# Our building options, in a configure-like display ;)
OPTIONS="\
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --with-system-zlib \
  --enable-application=browser \
  --enable-default-toolkit=cairo-gtk2 \
  --enable-startup-notification \
  --enable-crypto \
  --enable-svg \
  --enable-canvas \
  --enable-logging \
  --enable-xft \
  --enable-webm \
  --enable-xinerama \
  $OPTIMIZE \
  --enable-reorder \
  --enable-strip \
  --enable-cpp-rtti \
  --enable-single-profile \
  --enable-pulseaudio \
  --disable-gnomevfs \
  --disable-ldap \
  --disable-accessibility \
  --disable-crashreporter \
  --disable-debug \
  --disable-pedantic \
  --disable-installer \
  --disable-mailnews \
  --disable-composer \
  --disable-profilesharing"
# Complains about missing APNG support in Slackware's libpng:
# --with-system-png \
# This option breaks mozilla-12.0:
# --enable-system-cairo \

export CFLAGS="$SLKCFLAGS"
export CXXFLAGS="$SLKCFLAGS"
#export MOZ_MAKE_FLAGS="$NUMJOBS"

# Clear some variables that could break the build
unset DBUS_SESSION_BUS_ADDRESS ORBIT_SOCKETDIR SESSION_MANAGER \
  XDG_SESSION_COOKIE XAUTHORITY MAKEFLAGS

# Assemble our .mozconfig, we use this method for building, seems
# needed for PGO.
echo ". \$topsrcdir/browser/config/mozconfig" > .mozconfig

# Mozilla devs enforce using an objdir for building
# https://developer.mozilla.org/en/Configuring_Build_Options#Building_with_an_objdir
mkdir obj
echo "mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj" >> .mozconfig

# Write in it the options above
for option in $OPTIONS; do echo "ac_add_options $option" >> .mozconfig; done

echo "ac_add_options --disable-tests" >> .mozconfig
make -f client.mk build
make -f client.mk install DESTDIR=$PKG

# We don't need these (just symlinks anyway):
rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/icecat-devel-$RELEASEVER

# Nor these:
rm -rf $PKG/usr/include

# OK, this is just awkward. Only OS-dependent addons should be in the
# OS software channel, and the rest should be installed by the user,
# or else the user gets stuck with unremovable addons. This especially
# affects the adblockers, since some of them are incompatible.
( cd $PKG/usr/lib${LIBDIRSUFFIX}/icecat-$RELEASEVER/browser/extensions \
  && rm -rf spyblock* jid1* https* html5* abouticecat* )

# Desktop integration
mkdir -p $PKG/usr/share/applications
cat $CWD/icecat.desktop > $PKG/usr/share/applications/icecat.desktop
# Need some default icons in the right place:
for i in 16 22 24 32 48 256; do
  install -m 0644 -D browser/branding/official/default${i}.png \
    $PKG/usr/share/icons/hicolor/${i}x${i}/apps/icecat.png
done
mkdir -p $PKG/usr/share/pixmaps
( cd $PKG/usr/share/pixmaps ; ln -sf /usr/share/icons/hicolor/256x256/apps/icecat.png . )
mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/icecat-$RELEASEVER/chrome/icons/default
install -m 644 browser/branding/official/default16.png \
  $PKG/usr/lib$LIBDIRSUFFIX/icecat-$RELEASEVER/icons/
install -m 644 browser/branding/official/default16.png \
  $PKG/usr/lib$LIBDIRSUFFIX/icecat-$RELEASEVER/chrome/icons/default/

# Stage documentation
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a Changelog.IceCat LEGAL LICENSE README.IceCat README.txt AUTHORS \
  $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

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:-tgz}