Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

5 changed files:

Changes:

  • projects/nsis/build
    ... ... @@ -4,21 +4,41 @@
    4 4
     mkdir -p /var/tmp/build
    
    5 5
     tar -C /var/tmp/build -xf nsis-[% c('version') %].tar.bz2
    
    6 6
     
    
    7
    +# We need the GNU assembler for the system plugin
    
    8
    +tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
    
    9
    +
    
    7 10
     # NSIS requires zlib and we later set the path using ZLIB_W32.
    
    8 11
     tar -C /var/tmp/build -xf [% c('input_files_by_name/zlib') %]
    
    9 12
     
    
    13
    +# This trick is adapted from Firefox's
    
    14
    +# taskcluster/scripts/misc/build-mingw32-nsis.sh
    
    15
    +compiler_prefix=/var/tmp/dist/mingw-w64-clang/bin/[% c("arch") %]-w64-mingw32
    
    16
    +cat <<'EOF' >"$compiler_prefix-gcc"
    
    17
    +#!/bin/sh
    
    18
    +# SCons ignores the external $PATH, so we add binutils here.
    
    19
    +export PATH=/var/tmp/dist/binutils/bin:$PATH
    
    20
    +case "$@" in
    
    21
    +*/Call*.S)
    
    22
    +  $(dirname $0)/[% c("arch") %]-w64-mingw32-clang -fno-integrated-as "$@"
    
    23
    +  ;;
    
    24
    +*)
    
    25
    +  $(dirname $0)/[% c("arch") %]-w64-mingw32-clang "$@"
    
    26
    +  ;;
    
    27
    +esac
    
    28
    +EOF
    
    29
    +
    
    30
    +chmod +x "$compiler_prefix-gcc"
    
    31
    +ln -s "$compiler_prefix-clang++" "$compiler_prefix-g++"
    
    32
    +
    
    10 33
     cd /var/tmp/build/nsis-[% c('version') %]-src
    
    11
    -# Adding --no-insert-timestamp to APPEND_LINKFLAGS is not working as it
    
    12
    -# is used for both the host and cross-compiled parts, but this option is
    
    13
    -# only valid for the Windows linker. Therefore we add it using a patch
    
    14
    -# to the cross-compilation part only. Still needed as of 3.06.1, see: #40090.
    
    15
    -patch -p1 < $rootdir/no-insert-timestamp.patch
    
    16
    -# tor-browser-build#40822: NSIS adds a flag to tell it supports ASLR, but it
    
    17
    -# does so only to pass MS certifications. According to the NSIS forums, they
    
    18
    -# intended not to ship the .reloc to save space. But, according to the bug
    
    19
    -# tracker, binutils 2.36 started adding a .reloc section by default, and we need
    
    20
    -# to disable it with this patch.
    
    21
    -patch -p1 < $rootdir/no-reloc-section.diff
    
    34
    +
    
    35
    +# These two sed commands also come from build-mingw32-nsis.sh
    
    36
    +sed -i 's/-Wl,--exclude-libs,msvcrt.a/-Wl,-Xlink=-fixed/' SCons/Config/gnu
    
    37
    +sed -i '2i extern "C"' SCons/Config/{memcpy,memset}.c
    
    38
    +
    
    39
    +export SOURCE_DATE_EPOCH=$(stat -c '%Y' Source)
    
    40
    +# Resource.dll does not obey the source date epoch...
    
    41
    +patch -p1 < "$rootdir/resource-reproducible.diff"
    
    22 42
     
    
    23 43
     [% IF c("var/windows-x86_64") %]
    
    24 44
       # Seems like setting TARGET_ARCH is not enough so we need to patch build.cpp
    
    ... ... @@ -30,8 +50,7 @@ patch -p1 < $rootdir/no-reloc-section.diff
    30 50
     [% END %]
    
    31 51
     
    
    32 52
     [% SET scons_args = 'VERSION=' _ c("version")
    
    33
    -        _ ' APPEND_CCFLAGS="-fgnu89-inline"'
    
    34
    -        _ " SKIPUTILS='NSIS Menu' XGCC_W32_PREFIX=" _ c("arch") _ "-w64-mingw32-"
    
    53
    +        _ " SKIPUTILS='NSIS Menu,Makensisw' XGCC_W32_PREFIX=" _ c("arch") _ "-w64-mingw32-"
    
    35 54
             _ " TARGET_ARCH=" _ target
    
    36 55
             _ " ZLIB_W32=/var/tmp/build/zlib/"
    
    37 56
             _ ' PREFIX=/var/tmp/dist/nsis' -%]
    

  • projects/nsis/config
    1 1
     # vim: filetype=yaml sw=2
    
    2
    -version: 3.08
    
    2
    +version: 3.09
    
    3 3
     filename: 'nsis-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.[% c("compress_tar") %]'
    
    4 4
     container:
    
    5 5
       use_container: 1
    
    ... ... @@ -11,21 +11,16 @@ var:
    11 11
         - zlib1g-dev
    
    12 12
         - libcppunit-dev
    
    13 13
         - xsltproc
    
    14
    -  # NSIS has an assembly part that cannot be compiled with Clang.
    
    15
    -  # Mozilla uses -fno-integrated-as (see
    
    16
    -  # taskcluster/scripts/misc/build-mingw32-nsis.sh) but for some reason this
    
    17
    -  # does not seem to work for us, so just keep GCC for the moment, since we are
    
    18
    -  # already using it for Rust anyway.
    
    19
    -  compiler: mingw-w64
    
    20 14
     
    
    21 15
     input_files:
    
    22 16
       - project: container-image
    
    23 17
       - filename: 'nsis-[% c("version") %].tar.bz2'
    
    24 18
         URL: 'https://downloads.sourceforge.net/nsis/nsis-[% c("version") %]-src.tar.bz2'
    
    25
    -    sha256sum: a85270ad5386182abecb2470e3d7e9bec9fe4efd95210b13551cb386830d1e87
    
    26
    -  - filename: no-insert-timestamp.patch
    
    27
    -  - filename: no-reloc-section.diff
    
    19
    +    sha256sum: 0cd846c6e9c59068020a87bfca556d4c630f2c5d554c1098024425242ddc56e2
    
    28 20
       - name: '[% c("var/compiler") %]'
    
    29 21
         project: '[% c("var/compiler") %]'
    
    22
    +  - name: binutils
    
    23
    +    project: binutils
    
    30 24
       - name: zlib
    
    31 25
         project: zlib
    
    26
    +  - filename: resource-reproducible.diff

  • projects/nsis/no-insert-timestamp.patch deleted
    1
    -diff -ur nsis-3.03-src/SCons/Config/gnu nsis-3.03-src.n/SCons/Config/gnu
    
    2
    ---- nsis-3.03-src/SCons/Config/gnu	2017-10-06 15:30:20.000000000 -0400
    
    3
    -+++ nsis-3.03-src.n/SCons/Config/gnu	2018-06-17 13:26:05.945495151 -0400
    
    4
    -@@ -102,6 +102,7 @@
    
    5
    - stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG'])    # no standard libraries
    
    6
    - stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG'])        # 512 bytes align
    
    7
    - stub_env.Append(LINKFLAGS = ['$MAP_FLAG'])          # generate map file
    
    8
    -+stub_env.Append(LINKFLAGS = ['-Wl,--no-insert-timestamp']) # remove timestamps for reproducible builds
    
    9
    - 
    
    10
    - stub_uenv = stub_env.Clone()
    
    11
    - stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
    
    12
    -@@ -142,6 +143,7 @@
    
    13
    - plugin_env.Append(LINKFLAGS = ['$MAP_FLAG'])        # generate map file
    
    14
    - plugin_env.Append(LINKFLAGS = ['-static-libgcc'])   # remove libgcc*.dll dependency
    
    15
    - plugin_env.Append(LINKFLAGS = ['-static-libstdc++']) # remove libstdc++*.dll dependency
    
    16
    -+plugin_env.Append(LINKFLAGS = ['-Wl,--no-insert-timestamp']) # remove timestamps for reproducible builds
    
    17
    - 
    
    18
    - plugin_uenv = plugin_env.Clone()
    
    19
    - plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
    
    20
    -@@ -181,6 +183,7 @@
    
    21
    - 
    
    22
    - util_env.Append(LINKFLAGS = ['-mwindows'])          # build windows executables
    
    23
    - util_env.Append(LINKFLAGS = ['$ALIGN_FLAG'])        # 512 bytes align
    
    24
    -+util_env.Append(LINKFLAGS = ['-Wl,--no-insert-timestamp']) # remove timestamps for reproducible builds
    
    25
    - 
    
    26
    - 
    
    27
    - conf = FlagsConfigure(util_env)

  • projects/nsis/no-reloc-section.diff deleted
    1
    -diff -Naur nsis-3.08-orig/SCons/Config/gnu nsis-3.08-src/SCons/Config/gnu
    
    2
    ---- nsis-3.08-orig/SCons/Config/gnu	2023-03-23 09:22:46.315471779 +0100
    
    3
    -+++ nsis-3.08-src/SCons/Config/gnu	2023-03-23 09:24:05.260933879 +0100
    
    4
    -@@ -103,6 +103,10 @@
    
    5
    - stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG'])        # 512 bytes align
    
    6
    - stub_env.Append(LINKFLAGS = ['$MAP_FLAG'])          # generate map file
    
    7
    -
    
    8
    -+# https://sourceforge.net/p/nsis/bugs/1283/?limit=25#e303,
    
    9
    -+# https://sourceforge.net/p/nsis/bugs/1283/?limit=25#e303/e90f
    
    10
    -+stub_env.Append(LINKFLAGS = ['-Wl,--disable-reloc-section'])
    
    11
    -+
    
    12
    - conf = FlagsConfigure(stub_env)
    
    13
    - conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns')  # GCC 10: Don't generate msvcrt!memmove calls (bug #1248)
    
    14
    - conf.Finish()

  • projects/nsis/resource-reproducible.diff
    1
    +diff '--color=auto' -rupN nsis-3.09-orig/Contrib/System/SConscript nsis-3.09-src/Contrib/System/SConscript
    
    2
    +--- nsis-3.09-orig/Contrib/System/SConscript	2024-01-10 11:07:15.161175520 +0100
    
    3
    ++++ nsis-3.09-src/Contrib/System/SConscript	2024-01-10 11:08:47.338628667 +0100
    
    4
    +@@ -76,4 +76,5 @@ resources = Split("""
    
    5
    + 
    
    6
    + env.Depends(res_target, resources)
    
    7
    + 
    
    8
    +-env.SharedLibrary('Resource', res_target + res_main)
    
    9
    ++resource = env.SharedLibrary('Resource', res_target + res_main)
    
    10
    ++env.MakeReproducible(resource)