build 5.54 KB
Newer Older
boklm's avatar
boklm committed
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
#!/bin/bash
set -e
rootdir=$(pwd)
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
distdir=/var/tmp/dist/[% project %]
mkdir -p /var/tmp/build

export SHELL=/bin/bash
export HOME=$rootdir
export TZ=UTC
export LC_ALL=C
umask 0022

[% IF c("var/linux") %]
tar xf $rootdir/[% c('input_files_by_name/binutils') %]
export PATH="/var/tmp/dist/binutils/bin:$PATH"
[% END -%]

tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz

[% IF c("var/osx") %]
mkdir -p $distdir/TorBrowser.app/Contents/MacOS
[% ELSE %]
mkdir -p $distdir/Browser
[% END %]

[% IF c("var/linux") %]
mkdir -p $distdir/Debug/Browser/components
mkdir -p $distdir/Debug/Browser/browser/components
[% END %]

cd /var/tmp/build/[% project %]-[% c("version") %]
mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig

# TODO: run get-moz-build-date

[% IF c("var/windows") %]
# FIXME
# Ideally, using LDFLAGS (and e.g. DLLFLAGS for NSS) would be enough to get
# all Firefox libraries linked against msvcr100. Alas, this does not hold for
# NSPR. Without patching it we get a "missing entry points for _strcmpi in
# msvcr100.dll". Now, this should be fixed in rev>=6179 as the def file there
# contains a proper patch according to the mingw-w64 developers.
# However, even with this patch the _strcmpi issue is still popping up,
# probably due to a bug in our current linking setup. The small patch below
# is therefore just a workaround which should get fixed but is at least
# justified as the signature of _strcmpi and _stricmp is the same, see:
# http://msdn.microsoft.com/en-us/library/k59z8dwe.aspx.
sed 's/strcmpi/stricmp/' -i nsprpub/pr/src/linking/prlink.c
export HOST_LDFLAGS=" "
export LDFLAGS="-specs=/var/tmp/dist/mingw-w64/msvcr100.spec"
# Our flags don't get passed to NSS. We need to do that manually using an
# obscure one.
export DLLFLAGS="-specs=/var/tmp/dist/mingw-w64/msvcr100.spec"
[% END %]

[% IF c("var/osname") == "linux-i686" -%]
export LDFLAGS=-m32
export CFLAGS=-m32
export CC='gcc -m32'
[% END -%]

rm -f configure
rm -f js/src/configure
make -f client.mk configure CONFIGURE_ARGS="--with-tor-browser-version=[% c("var/torbrowser_version") %] --enable-update-channel=[% c("var/torbrowser_update_chanel") %] --enable-bundled-fonts"

make -j8 -f client.mk build
make -C obj-* package INNER_MAKE_PACKAGE=true

[% IF c("var/osx") %]
cp -a obj-macos/dist/firefox/* $distdir
# Remove firefox-bin (we don't use it, see ticket #10126)
rm -f $distdir/TorBrowser.app/Contents/MacOS/firefox-bin

# Adjust the Info.plist file
INFO_PLIST=$distdir/TorBrowser.app/Contents/Info.plist
mv $INFO_PLIST tmp.plist
python $rootdir/fix-info-plist.py '[% c("var/torbrowser_version") %]' '[% exec("git show -s --format=%ci").remove("-.*") %]' < tmp.plist > $INFO_PLIST
rm -f tmp.plist
[% END %]

[% IF c("var/linux") %]
cp -a obj-*/dist/firefox/* $distdir/Browser/
# Remove firefox-bin (we don't use it, see ticket #10126)
rm -f $distdir/Browser/firefox-bin
# TODO: There goes FIPS-140.. We could upload these somewhere unique and
# subsequent builds could test to see if they've been uploaded before...
# But let's find out if it actually matters first..
rm -f $distdir/Browser/*.chk
[% END %]

[% IF c("var/windows") %]
cp -a obj-*/dist/firefox/* $distdir/Browser/
cp -a $rootdir/msvcr100.dll $distdir/Browser
cp -a $gcclibs/libssp-0.dll $distdir/Browser
[% END %]

# Make MAR-based update tools available for use during the bundle phase.
# Note that mar and mbsdiff are standalone tools, compiled for the build
# host's architecture.  We also include signmar, certutil, and the libraries
# they require; these utilities and libraries are built for the target
# architecture.
MARTOOLS=$distdir/mar-tools
mkdir -p $MARTOOLS
cp -p config/createprecomplete.py $MARTOOLS/
cp -p tools/update-packaging/*.sh $MARTOOLS/
cp -p obj-*/dist/host/bin/mar $MARTOOLS/
cp -p obj-*/dist/host/bin/mbsdiff $MARTOOLS/
[% IF c("var/linux") %]
cp -p obj-*/modules/libmar/tool/signmar $MARTOOLS/
cp -p obj-*/security/nss/cmd/certutil/certutil $MARTOOLS/
NSS_LIBS="libfreebl3.so libmozsqlite3.so libnss3.so libnssdbm3.so libnssutil3.so libsmime3.so libsoftokn3.so libssl3.so"
NSPR_LIBS="libnspr4.so libplc4.so libplds4.so"
for LIB in $NSS_LIBS $NSPR_LIBS; do
    cp -p obj-*/dist/bin/$LIB $MARTOOLS/
done
[% END %]

cd $distdir

[% IF c("var/linux") %]
# Strip and generate debuginfo for the firefox binary that we keep, all *.so
# files, the plugin-container, and the updater (see ticket #10126)
for LIB in Browser/*.so Browser/webapprt-stub Browser/firefox Browser/plugin-container Browser/browser/components/*.so Browser/updater
do
    objcopy --only-keep-debug $LIB Debug/$LIB
    strip $LIB
    objcopy --add-gnu-debuglink=./Debug/$LIB $LIB
done
[% END %]

# TODO:
#  ~/build/re-dzip.sh Browser/omni.ja
#  ~/build/re-dzip.sh Browser/webapprt/omni.ja
#  ~/build/re-dzip.sh Browser/browser/omni.ja

[% IF c("var/windows") %]
cp $rootdir/msvcr100.dll Browser/
cp $gcclibs/libssp-0.dll Browser/
[% END %]

mkdir -p [% dest_dir _ '/' _ c('filename') %]

[%
IF c("var/osx");
  SET browserdir='TorBrowser.app/Contents';
ELSE;
  SET browserdir='Browser';
END;
%]

[% c('tar', {
        tar_src => [ browserdir ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename') _ '/tor-browser.tar.gz',
    }) %]

[% IF c("var/linux") %]
[% c('tar', {
        tar_src => [ 'Debug' ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename') _ '/tor-browser-debug.tar.gz',
    }) %]
[% END %]

[% c('zip', {
        zip_src => [ 'mar-tools' ],
        zip_args => dest_dir _ '/' _ c('filename') _ '/' _ c('var/martools_filename'),
    }) %]