Unverified Commit 2d177af5 authored by boklm's avatar boklm
Browse files

Add projects/firefox

parent fba3b060
#!/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'),
}) %]
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
filename: 'firefox-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %]'
git_hash: 'tor-browser-[% c("var/firefox_version") %]-6.5-1-build1'
git_url: https://git.torproject.org/tor-browser.git
tag_gpg_id: 1
gpg_keyring: torbutton.gpg
remote_docker: 1
var:
firefox_version: 45.6.0esr
torbrowser_update_channel: alpha
deps:
- build-essential
- unzip
- zip
- autoconf2.13
- yasm
- python
targets:
linux-x86_64:
var:
martools_filename: mar-tools-linux64.zip
arch_deps:
- libgtk2.0-dev
- libdbus-glib-1-dev
- libasound2-dev
- libgstreamer-plugins-base0.10-dev
- libxt-dev
- hardening-wrapper
# To pass configure since ESR 31.
- libpulse-dev
# To pass configure since ESR 45.
- libgconf2-dev
# We built GCC but not the libmpc2, thus we need to install it
- libmpc2
linux-i686:
var:
martools_filename: mar-tools-linux32.zip
sort_deps: 0
arch_deps:
- libc6-dev-i386
- libgtk2.0-dev:i386
- libdbus-glib-1-dev:i386
- lib32asound2-dev
- libasound2-dev:i386
- libgstreamer-plugins-base0.10-dev:i386
- libxt-dev:i386
# To pass configure since ESR 31.
- libpulse-dev:i386
# To pass configure since ESR 45.
- libgconf2-dev:i386
# We built GCC but not the libmpc2, thus we need to install it
- libmpc2
- hardening-wrapper
osx-x86_64:
var:
martools_filename: mar-tools-mac64.zip
arch_deps:
- rsync
windows-i686:
var:
martools_filename: mar-tools-win32.zip
input_files:
- project: docker-image
- name: '[% c("var/compiler") %]'
project: '[% c("var/compiler") %]'
- filename: 'mozconfig-[% c("var/osname") %]'
name: mozconfig
- project: binutils
name: binutils
enable: '[% c("var/linux") %]'
- filename: fix-info-plist.py
enable: '[% c("var/osx") %]'
- URL: https://people.torproject.org/~mikeperry/mirrors/sources/msvcr100.dll
sha256sum: 1221a09484964a6f38af5e34ee292b9afefccb3dc6e55435fd3aaf7c235d9067
enable: '[% c("var/windows") %]'
#!/usr/bin/env python
# Sets these keys in a property list file:
# CFBundleGetInfoString
# CFBundleShortVersionString
# NSHumanReadableCopyright
import getopt
import plistlib
import sys
def usage():
print >> sys.stderr, "usage: %s TORBROWSER_VERSION YEAR < Info.plist > FixedInfo.plist" % sys.argv[0]
sys.exit(2)
_, args = getopt.gnu_getopt(sys.argv[1:], "")
if len(args) != 2:
usage()
TORBROWSER_VERSION = args[0]
YEAR = args[1]
COPYRIGHT = "Tor Browser %s Copyright %s The Tor Project" % (TORBROWSER_VERSION, YEAR)
plist = plistlib.readPlist(sys.stdin)
plist["CFBundleGetInfoString"] = "Tor Browser %s" % TORBROWSER_VERSION
plist["CFBundleShortVersionString"] = TORBROWSER_VERSION
plist["NSHumanReadableCopyright"] = COPYRIGHT
plistlib.writePlist(plist, sys.stdout)
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
mk_add_options MOZ_APP_DISPLAYNAME="Tor Browser"
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
# Use jemalloc 4.x. In 52ESR, we should use
# the --enable-jemalloc=4 flag instead:
export MOZ_JEMALLOC4=1
export CFLAGS=-m32
export CXXFLAGS=-m32
export LDFLAGS=-m32
export XLDOPTS=-m32
export ASFLAGS=-m32
ac_add_options --host=i686-linux-gnu
ac_add_options --enable-optimize
#ac_add_options --disable-optimize
ac_add_options --enable-official-branding
ac_add_options --enable-tor-browser-update
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar
ac_add_options --disable-strip
ac_add_options --disable-install-strip
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-maintenance-service
ac_add_options --disable-crashreporter
ac_add_options --disable-webrtc
# Let's not compile EME at least until we can enable ClearKey and only Clearkey.
# (Apart from that there is no Adobe CRM module for Linux right now)
ac_add_options --disable-eme
#ac_add_options --disable-ctypes
ac_add_options --disable-loop
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
mk_add_options MOZ_APP_DISPLAYNAME="Tor Browser"
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
# Use jemalloc 4.x. In 52ESR, we should use
# the --enable-jemalloc=4 flag instead:
export MOZ_JEMALLOC4=1
ac_add_options --enable-optimize
#ac_add_options --disable-optimize
ac_add_options --enable-official-branding
ac_add_options --enable-tor-browser-update
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar
ac_add_options --disable-strip
ac_add_options --disable-install-strip
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-maintenance-service
ac_add_options --disable-crashreporter
ac_add_options --disable-webrtc
# Let's not compile EME at least until we can enable ClearKey and only Clearkey.
# (Apart from that there is no Adobe CRM module for Linux right now)
ac_add_options --disable-eme
#ac_add_options --disable-ctypes
ac_add_options --disable-loop
# ld needs libLTO.so from llvm
mk_add_options "export LD_LIBRARY_PATH=/var/tmp/dist/macosx-toolchain/clang/lib"
TOOLCHAIN_DIR=/var/tmp/dist/macosx-toolchain
CROSS_CCTOOLS_PATH=$TOOLCHAIN_DIR/cctools
CROSS_SYSROOT=$TOOLCHAIN_DIR/SDK
CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks
FLAGS="-target x86_64-apple-darwin10 -mlinker-version=136 -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT"
export CC="$TOOLCHAIN_DIR/clang/helpers/clang $FLAGS"
export CXX="$TOOLCHAIN_DIR/clang/helpers/clang++ $FLAGS"
export CPP="$TOOLCHAIN_DIR/clang/helpers/clang $FLAGS -E"
export LLVMCONFIG=$TOOLCHAIN_DIR/clang/bin/llvm-config
export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT -Wl,-dead_strip -Wl,-pie"
export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin10-
#TODO: bug 1184202 - would be nice if these could be detected with TOOLCHAIN_PREFIX automatically
export AR=${TOOLCHAIN_PREFIX}ar
export RANLIB=${TOOLCHAIN_PREFIX}ranlib
export STRIP=${TOOLCHAIN_PREFIX}strip
export OTOOL=${TOOLCHAIN_PREFIX}otool
export DSYMUTIL=$topsrcdir/clang/bin/llvm-dsymutil
export HOST_CC="$TOOLCHAIN_DIR/clang/helpers/clang"
export HOST_CXX="$TOOLCHAIN_DIR/clang/helpers/clang++"
export HOST_CPP="$TOOLCHAIN_DIR/clang/helpers/clang -E"
export HOST_CFLAGS="-g"
export HOST_CXXFLAGS="-g"
export HOST_LDFLAGS="-g"
ac_add_options --target=x86_64-apple-darwin
ac_add_options --with-macos-private-frameworks=$CROSS_PRIVATE_FRAMEWORKS
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-macos
mk_add_options MOZ_APP_DISPLAYNAME="Tor Browser"
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
ac_add_options --enable-application=browser
ac_add_options --enable-strip
ac_add_options --enable-official-branding
ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --enable-tor-browser-data-outside-app-dir
ac_add_options --enable-tor-browser-update
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar
ac_add_options --disable-crashreporter
ac_add_options --disable-maintenance-service
ac_add_options --disable-webrtc
ac_add_options --disable-tests
# Let's not compile EME at least until we can enable ClearKey and only Clearkey.
# (Apart from that there is no Adobe CRM module for OS X right now)
ac_add_options --disable-eme
# ac_add_options --disable-ctypes
ac_add_options --disable-loop
CROSS_COMPILE=1
ac_add_options --enable-application=browser
ac_add_options --target=i686-w64-mingw32
ac_add_options --enable-default-toolkit=cairo-windows
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-mingw
mk_add_options MOZ_APP_DISPLAYNAME="Tor Browser"
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
ac_add_options --disable-debug
ac_add_options --enable-optimize
ac_add_options --enable-strip
ac_add_options --enable-official-branding
ac_add_options --enable-tor-browser-update
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar
# We can't build the sandbox code with mingw-w64:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1042426
ac_add_options --disable-sandbox
# EME is not running without sandbox. Thus, don't compile it in the first place.
ac_add_options --disable-eme
ac_add_options --disable-crashreporter
ac_add_options --disable-maintenance-service
ac_add_options --disable-webrtc
ac_add_options --disable-tests
#ac_add_options --disable-ctypes
ac_add_options --disable-loop
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment