tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

build-mingw32-nsis.sh (2295B)


      1 #!/bin/bash
      2 set -x -e -v
      3 
      4 INSTALL_DIR=$MOZ_FETCHES_DIR/nsis
      5 
      6 mkdir -p $INSTALL_DIR
      7 
      8 cd $MOZ_FETCHES_DIR
      9 
     10 export PATH="$MOZ_FETCHES_DIR/binutils/bin:$MOZ_FETCHES_DIR/clang/bin:$PATH"
     11 
     12 # Call.S, included from CallCPP.S contains directives that clang's integrated
     13 # assembler doesn't understand.
     14 cat <<'EOF' >$MOZ_FETCHES_DIR/clang/bin/i686-w64-mingw32-gcc
     15 #!/bin/sh
     16 case "$@" in
     17 */CallCPP.S)
     18  $(dirname $0)/i686-w64-mingw32-clang -fno-integrated-as "$@"
     19  ;;
     20 *)
     21  $(dirname $0)/i686-w64-mingw32-clang "$@"
     22  ;;
     23 esac
     24 EOF
     25 
     26 chmod +x $MOZ_FETCHES_DIR/clang/bin/i686-w64-mingw32-gcc
     27 ln -s i686-w64-mingw32-clang++ $MOZ_FETCHES_DIR/clang/bin/i686-w64-mingw32-g++
     28 
     29 # --------------
     30 
     31 cd zlib-1.3.1
     32 make -f win32/Makefile.gcc PREFIX=i686-w64-mingw32-
     33 
     34 cd ../nsis-3.07-src
     35 patch -p1 < $GECKO_PATH/build/win32/nsis-no-insert-timestamp.patch
     36 patch -p1 < $GECKO_PATH/build/win32/nsis-no-underscore.patch
     37 patch -p1 < $GECKO_PATH/build/win32/nsis-scons.patch
     38 # --exclude-libs is not supported by lld, but is not required anyways.
     39 # /fixed is passed by the build system when building with MSVC but not
     40 # when building with GCC/binutils. The build system doesn't really support
     41 # clang/lld, but apparently binutils and lld don't have the same defaults
     42 # related to this. Unfortunately, /fixed is necessary for the stubs to be
     43 # handled properly by the resource editor in NSIS, which doesn't handle
     44 # relocations, so we pass the equivalent flag to lld-link through lld through
     45 # clang.
     46 sed -i 's/-Wl,--exclude-libs,msvcrt.a/-Wl,-Xlink=-fixed/' SCons/Config/gnu
     47 # memcpy.c and memset.c are built with a C++ compiler so we need to
     48 # avoid their symbols being mangled.
     49 sed -i '2i extern "C"' SCons/Config/{memcpy,memset}.c
     50 # Makensisw is skipped because its resource file fails to build with
     51 # llvm-rc, but we don't need makensisw.
     52 scons \
     53  PATH=$PATH \
     54  CC="clang --sysroot $MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu" \
     55  CXX="clang++ --sysroot $MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu" \
     56  XGCC_W32_PREFIX=i686-w64-mingw32- \
     57  ZLIB_W32=../zlib-1.3.1 \
     58  SKIPUTILS="NSIS Menu,Makensisw" \
     59  PREFIX_DEST=$INSTALL_DIR/ \
     60  PREFIX_BIN=bin \
     61  NSIS_CONFIG_CONST_DATA_PATH=no \
     62  VERSION=3.07 \
     63  install
     64 # --------------
     65 
     66 cd $MOZ_FETCHES_DIR
     67 
     68 tar caf nsis.tar.zst nsis
     69 
     70 mkdir -p $UPLOAD_DIR
     71 cp nsis.tar.* $UPLOAD_DIR