Richard Pospesel pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

13 changed files:

Changes:

  • projects/browser/Bundle-Data/mac-applications.dmg/.VolumeIcon.icns
    No preview for this file type
  • projects/browser/Bundle-Data/mac-applications.dmg/Applications deleted
    1
    -/Applications
    \ No newline at end of file

  • projects/browser/build
    ... ... @@ -33,8 +33,9 @@ touch "$GENERATEDPREFSPATH"
    33 33
       TORBINPATH=Contents/MacOS/Tor
    
    34 34
       TORCONFIGPATH=Contents/Resources/TorBrowser/Tor
    
    35 35
     
    
    36
    +  tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/hfsplus-tools') %]
    
    36 37
       tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/libdmg') %]
    
    37
    -  export PATH=/var/tmp/dist/libdmg-hfsplus:$PATH
    
    38
    +  export PATH=/var/tmp/dist/hfsplus-tools:/var/tmp/dist/libdmg-hfsplus:$PATH
    
    38 39
     [% ELSE %]
    
    39 40
       TBDIR=$TB_STAGE_DIR/Browser
    
    40 41
       TBDIRS=("$TBDIR")
    

  • projects/browser/config
    ... ... @@ -33,7 +33,6 @@ targets:
    33 33
       macos:
    
    34 34
         var:
    
    35 35
           arch_deps:
    
    36
    -        - genisoimage
    
    37 36
             - faketime
    
    38 37
             - python3-dev
    
    39 38
             - python3-pip
    
    ... ... @@ -106,6 +105,9 @@ input_files:
    106 105
         sha256sum: 078026ae894fe516ce9e61a1084d1b6dc883cd72c51027de342132141ca7f00d
    
    107 106
       - filename: 'gtk3-settings.ini'
    
    108 107
         enable: '[% c("var/linux") %]'
    
    108
    +  - project: hfsplus-tools
    
    109
    +    name: hfsplus-tools
    
    110
    +    enable: '[% c("var/macos") %]'
    
    109 111
       - project: libdmg-hfsplus
    
    110 112
         name: libdmg
    
    111 113
         enable: '[% c("var/macos") %]'
    

  • projects/browser/ddmg.sh
    ... ... @@ -5,17 +5,26 @@ find [% src %] ! -executable -exec chmod 0644 {} \;
    5 5
     find [% src %] -exec [% c("touch") %] {} \;
    
    6 6
     
    
    7 7
     dmg_tmpdir=\$(mktemp -d)
    
    8
    -[% SET filelist = '"\$dmg_tmpdir/filelist.txt"' %]
    
    9
    -pushd [% src %] 
    
    10
    -find . -type f | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" > [% filelist %]
    
    11
    -find . -type l | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" >> [% filelist %]
    
    8
    +hfsfile="\$dmg_tmpdir/tbb-uncompressed.dmg"
    
    12 9
     
    
    10
    +# hfsplus sets all the times to time(NULL)
    
    13 11
     export LD_PRELOAD=[% c("var/faketime_path") %]
    
    14 12
     export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]"
    
    15 13
     
    
    16
    -genisoimage -D -V "Tor Browser" -no-pad -R -apple -o "\$dmg_tmpdir/tbb-uncompressed.dmg" -path-list [% filelist %] -graft-points -gid 20 -dir-mode 0755 -new-dir-mode 0755
    
    14
    +# Use a similar strategy to Mozilla (they have 1.02, we have 1.1)
    
    15
    +size=\$(du -ms [% src %] | awk '{ print int( \$1 * 1.1 ) }')
    
    16
    +dd if=/dev/zero of="\$hfsfile" bs=1M count=\$size
    
    17
    +newfs_hfs -v "[% c("var/Project_Name") %]" "\$hfsfile"
    
    17 18
     
    
    18
    -dmg dmg "\$dmg_tmpdir/tbb-uncompressed.dmg" [% c('dmg_out', { error_if_undef => 1 }) %]
    
    19
    +pushd [% src %]
    
    20
    +
    
    21
    +hfsplus "\$hfsfile" addall .
    
    22
    +# hfsplus does not play well with dangling links
    
    23
    +hfsplus "\$hfsfile" symlink /Applications /Applications
    
    24
    +# Show the volume icon
    
    25
    +hfsplus "\$hfsfile" attr / C
    
    26
    +
    
    27
    +dmg dmg "\$hfsfile" [% c('dmg_out', { error_if_undef => 1 }) %]
    
    19 28
     popd
    
    20 29
     
    
    21 30
     rm -Rf "\$dmg_tmpdir"

  • projects/hfsplus-tools/build
    1
    +#!/bin/bash
    
    2
    +[% c("var/set_default_env") -%]
    
    3
    +distdir=/var/tmp/dist/[% project %]
    
    4
    +mkdir /var/tmp/dist
    
    5
    +tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/clang') %]
    
    6
    +export PATH="/var/tmp/dist/clang/bin:$PATH"
    
    7
    +
    
    8
    +tar -xf diskdev_cmds-[% c("version") %].tar.gz
    
    9
    +cd diskdev_cmds-[% c("version") %]
    
    10
    +
    
    11
    +patch -p1 < $rootdir/only-newfs_include.diff
    
    12
    +
    
    13
    +make -j[% c("num_procs") %]
    
    14
    +
    
    15
    +mkdir -p "$distdir"
    
    16
    +cp newfs_hfs.tproj/newfs_hfs "$distdir/"
    
    17
    +
    
    18
    +cd /var/tmp/dist
    
    19
    +[% c('tar', {
    
    20
    +        tar_src => [ project ],
    
    21
    +        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    
    22
    +    }) %]

  • projects/hfsplus-tools/config
    1
    +# vim: filetype=yaml sw=2
    
    2
    +version: 540.1.linux3
    
    3
    +filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
    
    4
    +container:
    
    5
    +  use_container: 1
    
    6
    +var:
    
    7
    +  deps:
    
    8
    +    - build-essential
    
    9
    +    - libssl-dev
    
    10
    +    - uuid-dev
    
    11
    +input_files:
    
    12
    +  # See hfsplus-tools in taskcluster/ci/fetch/toolchains.yml
    
    13
    +  - URL: https://src.fedoraproject.org/repo/pkgs/hfsplus-tools/diskdev_cmds-540.1.linux3.tar.gz/0435afc389b919027b69616ad1b05709/diskdev_cmds-[% c("version") %].tar.gz
    
    14
    +    sha256: b01b203a97f9a3bf36a027c13ddfc59292730552e62722d690d33bd5c24f5497
    
    15
    +  - project: container-image
    
    16
    +  # The project uses a flag that is not supported by GCC
    
    17
    +  - name: clang
    
    18
    +    project: clang
    
    19
    +  # Build only newfs (we do not care of fsck), and remove a header that does not
    
    20
    +  # exist on Linux (at that path) and is not required on Linux either.
    
    21
    +  - filename: only-newfs_include.diff

  • projects/hfsplus-tools/only-newfs_include.diff
    1
    +diff '--color=auto' -Naur diskdev_cmds-540.1.linux3_orig/Makefile diskdev_cmds-540.1.linux3/Makefile
    
    2
    +--- diskdev_cmds-540.1.linux3_orig/Makefile	2023-01-13 10:01:32.474525600 +0100
    
    3
    ++++ diskdev_cmds-540.1.linux3/Makefile	2023-01-13 10:01:50.346876760 +0100
    
    4
    +@@ -3,7 +3,7 @@
    
    5
    + CC := clang
    
    6
    + CFLAGS := -g3 -Wall -fblocks -I$(PWD)/BlocksRunTime -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"$(VERSION)\"
    
    7
    + LDFLAGS := -Wl,--build-id -L$(PWD)/BlocksRunTime
    
    8
    +-SUBDIRS := BlocksRunTime newfs_hfs.tproj fsck_hfs.tproj
    
    9
    ++SUBDIRS := newfs_hfs.tproj
    
    10
    +
    
    11
    + all clean:
    
    12
    + 	for d in $(SUBDIRS); do $(MAKE) -C $$d -f Makefile.lnx $@; done
    
    13
    +diff '--color=auto' -Naur diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs.c diskdev_cmds-540.1.linux3/newfs_hfs.tproj/makehfs.c
    
    14
    +--- diskdev_cmds-540.1.linux3_orig/newfs_hfs.tproj/makehfs.c	2023-01-13 10:01:32.474525600 +0100
    
    15
    ++++ diskdev_cmds-540.1.linux3/newfs_hfs.tproj/makehfs.c	2023-01-13 10:02:07.899221800 +0100
    
    16
    +@@ -38,8 +38,8 @@
    
    17
    + #endif
    
    18
    + #include <sys/errno.h>
    
    19
    + #include <sys/stat.h>
    
    20
    +-#include <sys/sysctl.h>
    
    21
    + #if !LINUX
    
    22
    ++#include <sys/sysctl.h>
    
    23
    + #include <sys/vmmeter.h>
    
    24
    + #endif
    
    25
    +

  • projects/libdmg-hfsplus/build
    1 1
     #!/bin/bash
    
    2 2
     [% c("var/set_default_env") -%]
    
    3
    -distdir=$(pwd)/dist
    
    4
    -mkdir -p $distdir/[% project %]
    
    5
    -tar xf [% project %]-[% c('version') %].tar.gz
    
    6
    -cd [% project %]-[% c('version') %]
    
    7
    -patch -p1 < ../libdmg.patch
    
    8
    -cmake -DCMAKE_INSTALL_PREFIX:PATH=$distdir/[% project %] CMakeLists.txt
    
    9
    -cd dmg
    
    10
    -make -j[% c("num_procs") %]
    
    11
    -make install
    
    12
    -cd $distdir
    
    3
    +distdir=/var/tmp/dist/[% project %]
    
    4
    +mkdir -p /var/tmp/dist
    
    5
    +tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
    
    6
    +tar -C /var/tmp/dist -xf [% c('input_files_by_name/ninja') %]
    
    7
    +export PATH="/var/tmp/dist/ninja:/var/tmp/dist/cmake/bin:$PATH"
    
    8
    +
    
    9
    +mkdir /var/tmp/build
    
    10
    +tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
    
    11
    +cd /var/tmp/build/[% project %]-[% c('version') %]
    
    12
    +cmake . -GNinja -DCMAKE_BUILD_TYPE=Release
    
    13
    +ninja -j[% c("num_procs") %] -v
    
    14
    +
    
    15
    +mkdir $distdir
    
    16
    +# We take only dmg and hfsplus like Mozilla does
    
    17
    +cp dmg/dmg hfs/hfsplus $distdir/
    
    18
    +cd /var/tmp/dist
    
    13 19
     [% c('tar', {
    
    14 20
             tar_src => [ project ],
    
    15 21
             tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    
    16
    -        }) %]
    22
    +    }) %]

  • projects/libdmg-hfsplus/config
    1 1
     # vim: filetype=yaml sw=2
    
    2 2
     version: '[% c("abbrev") %]'
    
    3
    -git_url: https://github.com/vasi/libdmg-hfsplus
    
    4
    -git_hash: dfd5e5cc3dc1191e37d3c3a6118975afdd1d7014
    
    3
    +git_url: https://github.com/mozilla/libdmg-hfsplus
    
    4
    +git_hash: 2ee327795680101d36f9700bd0fb618362237718
    
    5 5
     filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
    
    6 6
     container:
    
    7 7
       use_container: 1
    
    8 8
     var:
    
    9 9
       deps:
    
    10 10
         - build-essential
    
    11
    -    - cmake
    
    12 11
         - zlib1g-dev
    
    13 12
         - libbz2-dev
    
    14 13
     input_files:
    
    15 14
       - project: container-image
    
    16
    -  - filename: libdmg.patch
    15
    +  - name: cmake
    
    16
    +    project: cmake
    
    17
    +  - name: ninja
    
    18
    +    project: ninja

  • projects/libdmg-hfsplus/libdmg.patch deleted
    1
    -From d1a5eca891f32103ccda80ee75e158dfc7ece70d Mon Sep 17 00:00:00 2001
    
    2
    -From: Mike Perry <mikeperry-git@torproject.org>
    
    3
    -Date: Thu, 6 Mar 2014 19:47:05 -0800
    
    4
    -Subject: [PATCH] Memset a UDIF header to ensure archive reproducibility.
    
    5
    -
    
    6
    -Some of the struct padding and fields contained unitialized memory, which
    
    7
    -caused two successive invocations to produce archives that differed in some
    
    8
    -bytes.
    
    9
    ----
    
    10
    - dmg/dmglib.c | 6 ++++--
    
    11
    - 1 file changed, 4 insertions(+), 2 deletions(-)
    
    12
    -
    
    13
    -diff --git a/dmg/dmglib.c b/dmg/dmglib.c
    
    14
    -index f481b1f..b74e50b 100644
    
    15
    ---- a/dmg/dmglib.c
    
    16
    -+++ b/dmg/dmglib.c
    
    17
    -@@ -108,7 +108,8 @@ int buildDmg(AbstractFile* abstractIn, AbstractFile* abstractOut) {
    
    18
    - 	ChecksumToken dataForkToken;
    
    19
    - 	
    
    20
    - 	UDIFResourceFile koly;
    
    21
    --	
    
    22
    -+	memset(&koly, 0, sizeof(koly));
    
    23
    -+
    
    24
    - 	off_t plistOffset;
    
    25
    - 	uint32_t plistSize;
    
    26
    - 	uint32_t dataForkChecksum;
    
    27
    -@@ -284,7 +285,8 @@ int convertToDMG(AbstractFile* abstractIn, AbstractFile* abstractOut) {
    
    28
    - 	uint64_t numSectors;
    
    29
    - 	
    
    30
    - 	UDIFResourceFile koly;
    
    31
    --	
    
    32
    -+	memset(&koly, 0, sizeof(koly));
    
    33
    -+
    
    34
    - 	char partitionName[512];
    
    35
    - 	
    
    36
    - 	off_t fileLength;
    
    37
    --- 
    
    38
    -1.8.1.2
    
    39
    -

  • tools/signing/ddmg.sh
    ... ... @@ -21,20 +21,33 @@ find $src_dir ! -executable -exec chmod 0644 {} \; 2> /dev/null
    21 21
     find $src_dir -exec touch -m -t 200001010101 {} \; 2> /dev/null
    
    22 22
     set -e
    
    23 23
     
    
    24
    +VOLUME_LABEL="${VOLUME_LABEL:-Tor Browser}"
    
    25
    +
    
    24 26
     dmg_tmpdir=$(mktemp -d)
    
    25
    -filelist="$dmg_tmpdir/filelist.txt"
    
    26
    -cd $src_dir
    
    27
    -find . -type f | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" > $filelist
    
    28
    -find . -type l | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" >> $filelist
    
    27
    +hfsfile="$dmg_tmpdir/tbb-uncompressed.dmg"
    
    29 28
     
    
    30 29
     export LD_PRELOAD=$faketime_path
    
    31 30
     export FAKETIME="2000-01-01 01:01:01"
    
    32 31
     
    
    33 32
     echo "Starting: " $(basename $dest_file)
    
    34 33
     
    
    35
    -genisoimage -D -V "Tor Browser" -no-pad -R -apple -o "$dmg_tmpdir/tbb-uncompressed.dmg" -path-list $filelist -graft-points -gid 20 -dir-mode 0755 -new-dir-mode 0755
    
    34
    +# Use a similar strategy to Mozilla (they have 1.02, we have 1.1)
    
    35
    +size=$(du -ms "$src_dir" | awk '{ print int( $1 * 1.1 ) }')
    
    36
    +dd if=/dev/zero of="$hfsfile" bs=1M count=$size
    
    37
    +newfs_hfs -v "$VOLUME_LABEL" "$hfsfile"
    
    38
    +
    
    39
    +cd $src_dir
    
    40
    +
    
    41
    +# hfsplus does not play well with dangling links, so remove /Applications, and
    
    42
    +# add it back again with the special command to do so.
    
    43
    +rm -f Applications
    
    44
    +
    
    45
    +hfsplus "$hfsfile" addall .
    
    46
    +hfsplus "$hfsfile" symlink /Applications /Applications
    
    47
    +# Show the volume icon
    
    48
    +hfsplus "$hfsfile" attr / C
    
    36 49
     
    
    37
    -dmg dmg "$dmg_tmpdir/tbb-uncompressed.dmg" "$dest_file"
    
    50
    +dmg dmg "$hfsfile" "$dest_file"
    
    38 51
     
    
    39 52
     echo "Finished: " $(basename $dest_file)
    
    40 53
     
    

  • tools/signing/gatekeeper-bundling.sh
    ... ... @@ -35,18 +35,22 @@ set -e
    35 35
     script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
    
    36 36
     source "$script_dir/functions"
    
    37 37
     
    
    38
    -which genisoimage > /dev/null || \
    
    39
    -  exit_error 'genisoimage is missing. You should install the genisoimage package.'
    
    40 38
     test -f $faketime_path || \
    
    41 39
       exit_error "$faketime_path is missing"
    
    42 40
     test -d $macos_stapled_dir || \
    
    43 41
       exit_error "The stapled macos zip files should be placed in directory $macos_stapled_dir"
    
    44
    -libdmg_file="$script_dir/../../out/libdmg-hfsplus/libdmg-hfsplus-dfd5e5cc3dc1-c9296e.tar.gz"
    
    42
    +libdmg_file="$script_dir/../../out/libdmg-hfsplus/libdmg-hfsplus-2ee327795680-aa3810.tar.gz"
    
    45 43
     test -f "$libdmg_file" || \
    
    46 44
       exit_error "$libdmg_file is missing." \
    
    47 45
                  "You can build it with:" \
    
    48 46
                  "  ./rbm/rbm build --target no_containers libdmg-hfsplus" \
    
    49 47
                  "See var/deps in projects/libdmg-hfsplus/config for the list of build dependencies"
    
    48
    +# hfsplus-tools needs to be compiled with Clang, so its build id might change
    
    49
    +hfstools_file="$script_dir/../../out/hfsplus-tools/hfsplus-tools-540.1.linux3-*.tar.gz"
    
    50
    +test -f "$hfstools_file" || \
    
    51
    +  exit_error "$hfstools_file is missing." \
    
    52
    +             "You can build it with:" \
    
    53
    +             "  ./rbm/rbm build hfsplus-tools --target alpha --target torbrowser-macos-x86_64"
    
    50 54
     
    
    51 55
     test -d "$macos_signed_dir" || mkdir "$macos_signed_dir"
    
    52 56
     tmpdir="$macos_stapled_dir/tmp"
    
    ... ... @@ -55,7 +59,8 @@ mkdir "$tmpdir"
    55 59
     cp -rT "$script_dir/../../projects/browser/Bundle-Data/mac-applications.dmg" "$tmpdir/dmg"
    
    56 60
     
    
    57 61
     tar -C "$tmpdir" -xf "$libdmg_file"
    
    58
    -export PATH="$PATH:$tmpdir/libdmg-hfsplus"
    
    62
    +tar -C "$tmpdir" -xf "$hfstools_file"
    
    63
    +export PATH="$PATH:$tmpdir/libdmg-hfsplus:$tmpdir/hfsplus-tools"
    
    59 64
     
    
    60 65
     for lang in $bundle_locales
    
    61 66
     do