[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser-build/master] Bug 23561: Fix NSIS builds for Windows 64
commit 951b1a7e01000f3dc1529c497b64d32cc0e58339
Author: Sukhbir Singh <sukhbir@xxxxxxxxxxxxxx>
Date: Sun Jun 17 18:32:21 2018 -0400
Bug 23561: Fix NSIS builds for Windows 64
This commit adds support for building the 64-bit version of NSIS, and
also bumps the version to 3.03. Doing this enables us to build MAR files
in a 64-bit container for the 64-bit version of Tor Browser; see bug
26363 and bug 24477.
The pe_checksum_fix.py doesn't work in a 64-bit container with the
bundled python-pefile version so we build its latest version to fix this
issue. This change is borrowed from commit bb32ec91b and updates
python-pefile to 2017.11.5.
The Debian package and the patches are no longer required as all changes
were merged upstream in 3.01-1. (See the nsis changelog in Debian.)
---
projects/nsis/build | 26 +++++++++++++++--------
projects/nsis/config | 10 ++++-----
projects/nsis/no-insert-timestamp.patch | 28 ++++++++++++-------------
projects/nsis/nsis-missing-unistd-include.patch | 11 ----------
projects/tor-browser/build | 13 +++++++-----
projects/tor-browser/config | 22 +++++++------------
6 files changed, 51 insertions(+), 59 deletions(-)
diff --git a/projects/nsis/build b/projects/nsis/build
index 5a7b59f..c6a6d3e 100755
--- a/projects/nsis/build
+++ b/projects/nsis/build
@@ -3,23 +3,31 @@
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
mkdir -p /var/tmp/build
tar -C /var/tmp/build -xf nsis-[% c('version') %].tar.bz2
+
+# NSIS requires zlib and we later set the path using ZLIB_W32.
+tar -C /var/tmp/build -xf [% c('input_files_by_name/zlib') %]
+
cd /var/tmp/build/nsis-[% c('version') %]-src
-tar -xf $rootdir/[% c('input_files_by_name/debian') %]
-rm -f debian/patches/nsis_system_zlib.patch
-rm -f debian/patches/parallel_build.patch
-patch -p1 < $rootdir/nsis-missing-unistd-include.patch
-for patch in $(grep '\.patch$' debian/patches/series)
-do
- [ -f debian/patches/$patch ] && patch -p1 < debian/patches/$patch
-done
# Adding --no-insert-timestamp to APPEND_LINKFLAGS is not working as it
# is used for both the host and cross-compiled parts, but this option is
# only valid for the Windows linker. Therefore we add it using a patch
# to the cross-compilation part only.
patch -p1 < $rootdir/no-insert-timestamp.patch
+
+[% IF c("var/windows-x86_64") %]
+ # Seems like setting TARGET_ARCH is not enough so we need to patch build.cpp
+ # manually; this is confirmed by a comment in the same file.
+ sed -i 's/m_target_type=TARGET_X86ANSI/m_target_type=TARGET_AMD64/' Source/build.cpp
+ [% SET target = "amd64" %]
+[% ELSE %]
+ [% SET target = "x86" %]
+[% END %]
+
[% SET scons_args = 'VERSION=' _ c("version")
_ ' APPEND_CCFLAGS="-fgnu89-inline"'
- _ " SKIPUTILS='NSIS Menu' XGCC_W32_PREFIX=i686-w64-mingw32-"
+ _ " SKIPUTILS='NSIS Menu' XGCC_W32_PREFIX=" _ c("arch") _ "-w64-mingw32-"
+ _ " TARGET_ARCH=" _ target
+ _ " ZLIB_W32=/var/tmp/build/zlib/"
_ ' PREFIX=/var/tmp/dist/nsis' -%]
scons [% scons_args %]
scons [% scons_args %] install
diff --git a/projects/nsis/config b/projects/nsis/config
index 24adc36..81273ab 100644
--- a/projects/nsis/config
+++ b/projects/nsis/config
@@ -1,5 +1,5 @@
# vim: filetype=yaml sw=2
-version: 2.51
+version: 3.03
filename: 'nsis-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz'
var:
container:
@@ -16,11 +16,9 @@ input_files:
- project: container-image
- filename: 'nsis-[% c("version") %].tar.bz2'
URL: 'https://downloads.sourceforge.net/nsis/nsis-[% c("version") %]-src.tar.bz2'
- sha256sum: 43d4c9209847e35eb6e2c7cd5a7586e1445374c056c2c7899e40a080e17a1be7
- - name: debian
- URL: 'http://http.debian.net/debian/pool/main/n/nsis/nsis_2.51-1.debian.tar.xz'
- sha256sum: 1dee6957b4a4b8dfe69bcf28bc7f301a13b96b3fa5a394e36c8926ae781e774a
- - filename: nsis-missing-unistd-include.patch
+ sha256sum: abae7f4488bc6de7a4dd760d5f0e7cd3aad7747d4d7cd85786697c8991695eaa
- filename: no-insert-timestamp.patch
- name: '[% c("var/compiler") %]'
project: '[% c("var/compiler") %]'
+ - name: zlib
+ project: zlib
diff --git a/projects/nsis/no-insert-timestamp.patch b/projects/nsis/no-insert-timestamp.patch
index e71af21..8053b82 100644
--- a/projects/nsis/no-insert-timestamp.patch
+++ b/projects/nsis/no-insert-timestamp.patch
@@ -1,27 +1,27 @@
-diff -ur nsis-2.51-src/SCons/Config/gnu nsis-2.51-src.n/SCons/Config/gnu
---- nsis-2.51-src/SCons/Config/gnu 2018-05-24 20:40:06.508000000 +0200
-+++ nsis-2.51-src.n/SCons/Config/gnu 2018-05-24 21:04:16.501000000 +0200
-@@ -89,6 +89,7 @@
+diff -ur nsis-3.03-src/SCons/Config/gnu nsis-3.03-src.n/SCons/Config/gnu
+--- nsis-3.03-src/SCons/Config/gnu 2017-10-06 15:30:20.000000000 -0400
++++ nsis-3.03-src.n/SCons/Config/gnu 2018-06-17 13:26:05.945495151 -0400
+@@ -102,6 +102,7 @@
+ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries
stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
- stub_env.Append(LINKFLAGS = ['-Wl,-e,_WinMain@16']) # entry point
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
+stub_env.Append(LINKFLAGS = ['-Wl,--no-insert-timestamp']) # remove timestamps for reproducible builds
- ### makensis environment
-
-@@ -125,6 +126,7 @@
+ stub_uenv = stub_env.Clone()
+ stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
+@@ -142,6 +143,7 @@
plugin_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
- plugin_env.Append(LINKFLAGS = ['-static-libgcc']) # Make sure libgcc is statically linked in, for the plugins to work.
- plugin_env.Append(LINKFLAGS = ['-static-libstdc++']) # Make sure libstdc++ is statically linked in, for the plugins to work.
+ plugin_env.Append(LINKFLAGS = ['-static-libgcc']) # remove libgcc*.dll dependency
+ plugin_env.Append(LINKFLAGS = ['-static-libstdc++']) # remove libstdc++*.dll dependency
+plugin_env.Append(LINKFLAGS = ['-Wl,--no-insert-timestamp']) # remove timestamps for reproducible builds
- ### cross-platform util environment
-
-@@ -148,6 +150,7 @@
+ plugin_uenv = plugin_env.Clone()
+ plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
+@@ -181,6 +183,7 @@
util_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
util_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
+util_env.Append(LINKFLAGS = ['-Wl,--no-insert-timestamp']) # remove timestamps for reproducible builds
+
conf = FlagsConfigure(util_env)
- if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
diff --git a/projects/nsis/nsis-missing-unistd-include.patch b/projects/nsis/nsis-missing-unistd-include.patch
deleted file mode 100644
index 4f4fdd2..0000000
--- a/projects/nsis/nsis-missing-unistd-include.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- nsis-2.46-src.old/Source/util.h 2009-03-28 09:47:26.000000000 +0000
-+++ nsis-2.46-src/Source/util.h 2012-01-16 12:22:14.967416817 +0000
-@@ -17,6 +17,8 @@
- #ifndef _UTIL_H_
- #define _UTIL_H_
-
-+#include <unistd.h>
-+
- #include <string> // for std::string
-
- #include "boost/scoped_ptr.hpp" // for boost::scoped_ptr
diff --git a/projects/tor-browser/build b/projects/tor-browser/build
index 52678ed..65c752b 100644
--- a/projects/tor-browser/build
+++ b/projects/tor-browser/build
@@ -43,11 +43,6 @@ mkdir -p "$TBDIR/$MEEKPROFILEPATH/extensions"
# Extract the MAR tools.
unzip -d $rootdir $rootdir/[% c('input_files_by_name/firefox') %]/mar-tools-*.zip
MARTOOLS=$rootdir/mar-tools
-[% IF c("var/windows-x86_64") -%]
- # Workaround for bug 24477
- rm -Rf $MARTOOLS
- unzip -d $rootdir $rootdir/mar-tools-linux32.zip
-[% END -%]
mv [% c('input_files_by_name/tor-launcher') %] "$TBDIR/$EXTSPATH/tor-launcher@xxxxxxxxxxxxxxxxxx"
mv [% c('input_files_by_name/torbutton') %] "$TBDIR/$EXTSPATH/torbutton@xxxxxxxxxxxxxxxxxx"
@@ -241,6 +236,14 @@ popd
[% IF c("var/windows") %]
+ # We need to install a recent version of python-pefile so that it works
+ # in a x86_64 container:
+ # https://github.com/TheTorProject/tor-messenger-build/pull/10
+ tar xf $rootdir/[% c('input_files_by_name/python-pefile') %]
+ cd $(echo [% c('input_files_by_name/python-pefile') %] | sed s/\.tar\.gz$//)
+ python setup.py install --user
+ cd ..
+
tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/nsis') %]
export PATH="/var/tmp/dist/nsis/bin:$PATH"
diff --git a/projects/tor-browser/config b/projects/tor-browser/config
index 225a0bb..820755c 100644
--- a/projects/tor-browser/config
+++ b/projects/tor-browser/config
@@ -28,17 +28,16 @@ targets:
windows:
var:
arch_deps:
- - python-pefile
+ - python-future
+ pre_pkginst: |
+ # enable jessie-backports for python-future
+ echo 'deb http://ftp.debian.org/debian jessie-backports main' >> /etc/apt/sources.list
windows-i686:
var:
mar_osname: win32
windows-x86_64:
var:
mar_osname: win64
- # We use a 32bit container to be able to use a 32bit nsis and
- # pe_checksum_fix.py
- container:
- arch: i386
input_files:
- project: container-image
@@ -79,18 +78,13 @@ input_files:
enable: '[% c("var/osx") %]'
- project: nsis
name: nsis
- target:
- - '[% c("var/channel") %]'
- - torbrowser-windows-i686
enable: '[% c("var/windows") %]'
- name: tbb-windows-installer
project: tbb-windows-installer
enable: '[% c("var/windows") %]'
- filename: pe_checksum_fix.py
enable: '[% c("var/windows") %]'
- # Workaround for bug 24477
- - URL: https://archive.torproject.org/tor-package-archive/torbrowser/7.5a7/mar-tools-linux32.zip
- sig_ext: asc
- file_gpg_id: 1
- gpg_keyring: torbrowser.gpg
- enable: '[% c("var/windows-x86_64") %]'
+ - name: python-pefile
+ URL: https://files.pythonhosted.org/packages/7e/9b/f99171190f04cd23768547dd34533b4016bd582842f53cd9fe9585a74c74/pefile-2017.11.5.tar.gz
+ sha256sum: 675c35ee0e1677db9e80d2f48d8a7ff2cf38e6207e8cd5e2a2c6d126db025854
+ enable: '[% c("var/windows") %]'
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits