1#!/bin/bash
2set -x -e -v
3
4# We set the INSTALL_DIR to match the directory that it will run in exactly,
5# otherwise we get an NSIS error of the form:
6#   checking for NSIS version...
7#   DEBUG: Executing: `/home/worker/workspace/build/src/mingw32/
8#   DEBUG: The command returned non-zero exit status 1.
9#   DEBUG: Its error output was:
10#   DEBUG: | Error: opening stub "/home/worker/workspace/mingw32/
11#   DEBUG: | Error initalizing CEXEBuild: error setting
12#   ERROR: Failed to get nsis version.
13
14INSTALL_DIR=$MOZ_FETCHES_DIR/mingw32
15
16mkdir -p $INSTALL_DIR
17
18cd $MOZ_FETCHES_DIR
19
20# As explained above, we have to build nsis to the directory it
21# will eventually be run from, which is the same place we just
22# installed our compiler. But at the end of the script we want
23# to package up what we just built. If we don't move the compiler,
24# we will package up the compiler we downloaded along with the
25# stuff we just built.
26mv mingw32 mingw32-gcc
27export PATH="$MOZ_FETCHES_DIR/mingw32-gcc/bin:$PATH"
28
29# --------------
30
31cd zlib-1.2.11
32make -f win32/Makefile.gcc PREFIX=i686-w64-mingw32-
33
34cd ../nsis-3.01-src
35patch -p1 < $GECKO_PATH/build/win32/nsis-no-insert-timestamp.patch
36# I don't know how to make the version work with the environment variables/config flags the way the author appears to
37sed -i "s/'VERSION', 'Version of NSIS', cvs_version/'VERSION', 'Version of NSIS', '3.01'/" SConstruct
38scons XGCC_W32_PREFIX=i686-w64-mingw32- ZLIB_W32=../zlib-1.2.11 SKIPUTILS="NSIS Menu" PREFIX=$INSTALL_DIR/ install
39
40# --------------
41
42cd $MOZ_FETCHES_DIR
43
44tar caf nsis.tar.xz mingw32
45
46mkdir -p $UPLOAD_DIR
47cp nsis.tar.* $UPLOAD_DIR
48