[tbb-commits] [tor-browser-bundle/master] Bug 10120: Part 2: Refactor Windows descriptors.

gk at torproject.org gk at torproject.org
Thu May 8 13:11:23 UTC 2014


commit c67075a87a05505d083a648a47adfbba46f79eff
Author: Georg Koppen <gk at torproject.org>
Date:   Thu May 8 14:08:20 2014 +0000

    Bug 10120: Part 2: Refactor Windows descriptors.
    
    We build the tools needed for the Windows descriptors separately and
    preserve them. This does not (yet) include the tools in the Pluggable
    Transports descriptor which will happen in an other commit.
---
 gitian/descriptors/windows/gitian-firefox.yml |  104 +++---------------
 gitian/descriptors/windows/gitian-tor.yml     |   62 +++--------
 gitian/descriptors/windows/gitian-utils.yml   |  145 +++++++++++++++++++++++++
 gitian/mkbundle-linux.sh                      |   10 +-
 gitian/mkbundle-windows.sh                    |  141 +++++++++++++++---------
 5 files changed, 272 insertions(+), 190 deletions(-)

diff --git a/gitian/descriptors/windows/gitian-firefox.yml b/gitian/descriptors/windows/gitian-firefox.yml
index fefb677..94b5eef 100644
--- a/gitian/descriptors/windows/gitian-firefox.yml
+++ b/gitian/descriptors/windows/gitian-firefox.yml
@@ -12,24 +12,18 @@ packages:
 - "autoconf2.13"
 - "faketime"
 - "yasm"
-- "mingw-w64"
-- "g++-mingw-w64-i686"
-- "mingw-w64-tools"
-- "libmpc-dev"
 reference_datetime: "2000-01-01 00:00:00"
 remotes:
 - "url": "https://git.torproject.org/tor-browser.git"
   "dir": "tor-browser"
 files:
-# XXX: we need to make this input tarball deterministic :/
-- "mingw-w64-svn-snapshot.zip"
-- "binutils.tar.bz2"
-- "gcc.tar.bz2"
+- "mingw-w64-win32-utils.zip"
 - "re-dzip.sh"
 - "dzip.sh"
-- "i686-w64-mingw32-gcc"
-- "i686-w64-mingw32-g++"
-- "i686-w64-mingw32-ld"
+# TODO: Hardening.
+#- "i686-w64-mingw32-gcc"
+#- "i686-w64-mingw32-g++"
+#- "i686-w64-mingw32-ld"
 - "msvcr100.dll"
 - "versions"
 script: |
@@ -43,80 +37,14 @@ script: |
   #
   mkdir -p $INSTDIR/Browser/
   mkdir -p $OUTDIR/
-  # If we ever find out that the 12.04 mingw is buggy/insufficient:
-  #sudo bash -c 'echo "deb http://archive.ubuntu.com/ubuntu raring main restricted universe multiverse" >> /etc/apt/sources.list'
-  #sudo apt-get update
-  #sudo apt-get install -y g++-mingw-w64-i686 mingw-w64-tools mingw-w64
-  
-  # Build the latest MinGW-w64 headers, CRT and runtime libraries to get Tor
-  # Browser going on all Windows platforms >= XP. In order to do so we link
-  # against msvcr100 (which we ship with the browser) as msvcrt on Windows XP
-  # does not contain the secure functions Firefox uses. That in turn makes it
-  # necessary to re-compile the mingw-w64 runtime libraries as well as they are
-  # linked against msvcrt by default. See bug 9084 for a more detailed
-  # discussion.
-
-  # FIXME: We need sudo for all of this because otherwise
-  # the toolchain can't find the alternate prefix for the CRT headers :/ 
-
+  unzip -d $INSTDIR mingw-w64-win32-utils.zip
+  # Make sure our custom mingw gets used.
+  export PATH=$INSTDIR/mingw-w64/bin:$PATH
   # We don't want to link against msvcrt.dll due to bug 9084.
   i686-w64-mingw32-g++ -dumpspecs > msvcr100.spec
   sed 's/msvcrt/msvcr100/' -i msvcr100.spec
 
-  mkdir binutils
-  cd binutils
-  tar -xjvf ../binutils.tar.bz2
-  sed 's/= extern_rt_rel_d;/= extern_rt_rel_d;\n  memset (extern_rt_rel_d, 0, PE_IDATA5_SIZE);/' -i binutils-*/ld/pe-dll.c
-  binutils-*/configure --prefix=/usr --target=i686-w64-mingw32 --disable-multilib
-  make
-  sudo make install
-  cd ..
-
-  mkdir mingw-w64
-  cd mingw-w64
-  unzip ../mingw-w64-svn-snapshot.zip
-  #
-  mkdir mingw-w64-headers32 && cd mingw-w64-headers32
-  ../mingw-w64-svn/mingw-w64-headers/configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/ --enable-sdk=all --enable-secure-api --enable-idl
-  sudo make install
-  sudo ln -s /usr/i686-w64-mingw32 /usr/mingw
-  sudo mkdir -p /usr/i686-w64-mingw32/lib
-  cd ..
-  cd ..
-  # First stage of gcc compilation
-  mkdir gcc 
-  cd gcc
-  tar -xjvf ../gcc.tar.bz2
-  # Linking libgcc against msvcrt is hard-coded...
-  sed 's/msvcrt/msvcr100/' -i gcc-*/gcc/config/i386/t-mingw-w32 
-  # LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take
-  # CFLAGS_FOR_TARGET.
-  export CFLAGS_FOR_TARGET="-specs=/home/ubuntu/build/msvcr100.spec"
-  gcc-*/configure --prefix=/usr --target=i686-w64-mingw32 --disable-multilib --enable-languages=c,c++
-  make all-gcc
-  sudo make install-gcc
-  cd ..
-  #
-  cd mingw-w64
-  mkdir mingw-w64-crt32 && cd mingw-w64-crt32
-  ../mingw-w64-svn/mingw-w64-crt/configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32
-  make
-  sudo make install
-  cd ..
-  #
-  mkdir widl32 && cd widl32
-  ../mingw-w64-svn/mingw-w64-tools/widl/configure --prefix=/usr --target=i686-w64-mingw32
-  make
-  sudo make install
-  cd ..
-  cd ..
-  # Second stage of gcc compilation
-  cd gcc
-  make
-  sudo make install
-  #
-  cd ..
-  #
+  # Building the browser
   cd tor-browser
   mv .mozconfig-mingw .mozconfig
   # FIXME
@@ -130,7 +58,7 @@ script: |
   # is therefore just a workaround which should get fixed but is at least
   # justified as the signature of _strcmpi and _stricmp is the same, see:
   # http://msdn.microsoft.com/en-us/library/k59z8dwe.aspx.
-  sed 's/strcmpi/stricmp/' -i nsprpub/pr/src/linking/prlink.c 
+  sed 's/strcmpi/stricmp/' -i nsprpub/pr/src/linking/prlink.c
   export HOST_LDFLAGS=" "
   export LDFLAGS="-specs=/home/ubuntu/build/msvcr100.spec"
   # Our flags don't get passed to NSS. We need to do that manually using an
@@ -170,14 +98,12 @@ script: |
   # Stripping again updates the PE header checksums to be correct
   i686-w64-mingw32-strip $INSTDIR/Browser/gkmedias.dll
   i686-w64-mingw32-strip $INSTDIR/Browser/xul.dll
-  #
+
+  # Making the .ja files deterministic and grabbing the results
   cd $INSTDIR
   ~/build/re-dzip.sh Browser/omni.ja
-  if [ -f Browser/webapprt/omni.ja ]; then
-    ~/build/re-dzip.sh Browser/webapprt/omni.ja
-  fi
-  if [ -f Browser/browser/omni.ja ]; then
-    ~/build/re-dzip.sh Browser/browser/omni.ja
-  fi
+  ~/build/re-dzip.sh Browser/webapprt/omni.ja
+  ~/build/re-dzip.sh Browser/browser/omni.ja
   ~/build/dzip.sh tor-browser-win32-gbuilt.zip Browser
+
   cp tor-browser-win32-gbuilt.zip $OUTDIR
diff --git a/gitian/descriptors/windows/gitian-tor.yml b/gitian/descriptors/windows/gitian-tor.yml
index bb6998b..3263b48 100644
--- a/gitian/descriptors/windows/gitian-tor.yml
+++ b/gitian/descriptors/windows/gitian-tor.yml
@@ -4,7 +4,7 @@ suites:
 - "precise"
 architectures:
 - "i386"
-packages: 
+packages:
 - "git-core"
 - "unzip"
 - "zip"
@@ -18,10 +18,6 @@ reference_datetime: "2000-01-01 00:00:00"
 remotes:
 - "url": "https://git.torproject.org/tor.git"
   "dir": "tor"
-- "url": "https://github.com/libevent/libevent.git"
-  "dir": "libevent"
-- "url": "https://github.com/madler/zlib.git"
-  "dir": "zlib"
 files:
 - "versions"
 - "bug10297.patch"
@@ -35,60 +31,33 @@ files:
 - "bug8402-master.patch"
 - "binutils.tar.bz2"
 - "dzip.sh"
-- "openssl.tar.gz"
+- "binutils-win32-utils.zip"
+- "openssl-win32-utils.zip"
+- "libevent-win32-utils.zip"
+- "zlib-win32-utils.zip"
 script: |
   INSTDIR="$HOME/install"
   source versions
-  export LIBRARY_PATH="$INSTDIR/lib"
   export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
   export FAKETIME=$REFERENCE_DATETIME
   export TZ=UTC
   export LC_ALL=C
-  # XXX: Hardening options cause the exe's to crash.. not sure why
-  #export CFLAGS="-mwindows -fstack-protector-all -fPIE -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat-security"
-  #export LDFLAGS="-mwindows -Wl,--dynamicbase -Wl,--nxcompat -lssp -L/usr/lib/gcc/i686-w64-mingw32/4.6/"
   umask 0022
-  # 
+  #
   mkdir -p $INSTDIR/bin/
   mkdir -p $INSTDIR/Tor/
   mkdir -p $INSTDIR/Data/Tor/
-  mkdir -p $OUTDIR/
-  #
-  mkdir binutils
-  cd binutils
-  tar -xjvf ../binutils.tar.bz2
-  sed 's/= extern_rt_rel_d;/= extern_rt_rel_d;\n  memset (extern_rt_rel_d, 0, PE_IDATA5_SIZE);/' -i binutils-*/ld/pe-dll.c
-  binutils-*/configure --prefix=/usr --target=i686-w64-mingw32 --disable-multilib
-  make
-  sudo make install
-  cd ..
-  #
-  export CFLAGS="-mwindows"
-  export LDFLAGS="-mwindows"
-  cd zlib
-  find -type f | xargs touch --date="$REFERENCE_DATETIME"
-  make BINARY_PATH=$INSTDIR/zlib/lib INCLUDE_PATH=$INSTDIR/zlib/include LIBRARY_PATH=$INSTDIR/zlib/lib -f win32/Makefile.gcc PREFIX=i686-w64-mingw32- $MAKEOPTS SHARED_MODE=1
-  make BINARY_PATH=$INSTDIR/zlib/lib INCLUDE_PATH=$INSTDIR/zlib/include LIBRARY_PATH=$INSTDIR/zlib/lib -f win32/Makefile.gcc PREFIX=i686-w64-mingw32- $MAKEOPTS SHARED_MODE=1 install
+  unzip -d $INSTDIR binutils-win32-utils.zip
+  unzip -d $INSTDIR zlib-win32-utils.zip
+  unzip -d $INSTDIR libevent-win32-utils.zip
+  unzip -d $INSTDIR openssl-win32-utils.zip
   cp $INSTDIR/zlib/lib/*.dll $INSTDIR/Tor/
-  cd ..
-  #
-  cd libevent
-  ./autogen.sh
-  find -type f | xargs touch --date="$REFERENCE_DATETIME"
-  ./configure --disable-static --host=i686-w64-mingw32 --prefix=$INSTDIR/libevent
-  make $MAKEOPTS
-  make install
   cp $INSTDIR/libevent/bin/*.dll $INSTDIR/Tor/
-  cd ..
-  #
-  tar xzf openssl.tar.gz
-  cd openssl-*
-  find -type f | xargs touch --date="$REFERENCE_DATETIME"
-  ./Configure -shared --cross-compile-prefix=i686-w64-mingw32- mingw --prefix=$INSTDIR/openssl #enable-ec_nistp_64_gcc_128
-  make
-  make install
   cp $INSTDIR/openssl/bin/*.dll $INSTDIR/Tor/
-  cd ..
+  # Make sure our custom ld gets used.
+  # See the we-need-only-the-binutils-comment in gitian-utils.yml for the
+  # reasoning behind the "mingw-w64" dir instead of an expected "binutils" one.
+  export PATH=$INSTDIR/mingw-w64/bin:$PATH
   #
   cd tor
   git update-index --refresh -q
@@ -114,7 +83,7 @@ script: |
     fi
   fi
   mkdir -p $OUTDIR/src
-  git archive HEAD | tar -x -C $OUTDIR/src
+  #git archive HEAD | tar -x -C $OUTDIR/src
   ./autogen.sh
   find -type f | xargs touch --date="$REFERENCE_DATETIME"
   ./configure --disable-asciidoc --host=i686-w64-mingw32 --with-libevent-dir=$INSTDIR/libevent --with-openssl-dir=$INSTDIR/openssl --prefix=$INSTDIR --with-zlib-dir=$INSTDIR/zlib/
@@ -124,7 +93,6 @@ script: |
   install -s $INSTDIR/bin/tor.exe $INSTDIR/Tor/
   cp $INSTDIR/share/tor/geoip $INSTDIR/Data/Tor/
   # XXX: Geoip files..
-  #
   cp -a /usr/lib/gcc/i686-w64-mingw32/4.6/libgcc_s_sjlj-1.dll $INSTDIR/Tor/
   cp -a /usr/lib/gcc/i686-w64-mingw32/4.6/libssp*.dll $INSTDIR/Tor/
   #
diff --git a/gitian/descriptors/windows/gitian-utils.yml b/gitian/descriptors/windows/gitian-utils.yml
new file mode 100644
index 0000000..4e321a0
--- /dev/null
+++ b/gitian/descriptors/windows/gitian-utils.yml
@@ -0,0 +1,145 @@
+---
+name: "utils-windows"
+suites:
+- "precise"
+architectures:
+- "i386"
+packages:
+- "git-core"
+- "unzip"
+- "zip"
+- "autoconf"
+- "autoconf2.13"
+- "automake"
+- "mingw-w64"
+- "faketime"
+- "libtool"
+# XXX: Only needed to dump the spec.
+- "g++-mingw-w64-i686"
+# Needed for compiling gcc.
+- "libmpc-dev"
+reference_datetime: "2000-01-01 00:00:00"
+remotes:
+- "url": "https://github.com/libevent/libevent.git"
+  "dir": "libevent"
+- "url": "https://github.com/madler/zlib.git"
+  "dir": "zlib"
+files:
+# XXX: we need to make this input tarball deterministic :/
+- "mingw-w64-svn-snapshot.zip"
+- "binutils.tar.bz2"
+- "gcc.tar.bz2"
+- "openssl.tar.gz"
+- "versions"
+- "dzip.sh"
+script: |
+  INSTDIR="$HOME/install"
+  source versions
+  export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
+  export FAKETIME=$REFERENCE_DATETIME
+  export TZ=UTC
+  export LC_ALL=C
+  umask 0022
+
+  # Building binutils
+  tar xjf binutils.tar.bz2
+  cd binutils*
+  # XXX: This is needed due to bug 10102.
+  sed 's/= extern_rt_rel_d;/= extern_rt_rel_d;\n  memset (extern_rt_rel_d, 0, PE_IDATA5_SIZE);/' -i ld/pe-dll.c
+  ./configure --prefix=$INSTDIR/mingw-w64 --target=i686-w64-mingw32 --disable-multilib
+  make $MAKEOPTS
+  make install
+  # XXX: We currently do this as we are not using our own compiler but only our
+  # own binutils for compiling tor. See bug 10077. Nevertheless, we need both
+  # for cross-compiling Tor Browser.
+  cd $INSTDIR
+  ~/build/dzip.sh binutils-$BINUTILS_VER-win32-utils.zip mingw-w64
+  # Make sure our ld etc. is found and used.
+  export PATH=$INSTDIR/mingw-w64/bin:$PATH
+  cd ~/build
+
+  # Building mingw-w64
+  mkdir -p mingw-w64/mingw-w64-headers32
+  cd mingw-w64
+  unzip ../mingw-w64-svn-snapshot.zip
+  cd mingw-w64-headers32
+  ../mingw-w64-svn/mingw-w64-headers/configure --host=i686-w64-mingw32 --prefix=$INSTDIR/mingw-w64/i686-w64-mingw32 --enable-sdk=all --enable-secure-api --enable-idl
+  make install
+  cd ..
+  cd ..
+  # First stage of gcc compilation
+  mkdir gcc
+  cd gcc
+  tar -xjvf ../gcc.tar.bz2
+  # We don't want to link against msvcrt.dll due to bug 9084.
+  i686-w64-mingw32-g++ -dumpspecs > ~/build/msvcr100.spec
+  sed 's/msvcrt/msvcr100/' -i ~/build/msvcr100.spec
+  # Linking libgcc against msvcrt is hard-coded...
+  sed 's/msvcrt/msvcr100/' -i gcc-*/gcc/config/i386/t-mingw-w32
+  # LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take
+  # CFLAGS_FOR_TARGET.
+  export CFLAGS_FOR_TARGET="-specs=/home/ubuntu/build/msvcr100.spec"
+  gcc-*/configure --prefix=$INSTDIR/mingw-w64 --target=i686-w64-mingw32 --disable-multilib --enable-languages=c,c++
+  # XXX: Using $MAKEOPTS (tested with -j4) breaks the build which does not
+  # happen in a non-gitian environment. This is probably related to bug 11459.
+  make all-gcc
+  make install-gcc
+  cd ..
+  #
+  cd mingw-w64
+  mkdir mingw-w64-crt32 && cd mingw-w64-crt32
+  ../mingw-w64-svn/mingw-w64-crt/configure --host=i686-w64-mingw32 --prefix=$INSTDIR/mingw-w64/i686-w64-mingw32
+  make $MAKEOPTS
+  make install
+  cd ..
+  #
+  mkdir widl32 && cd widl32
+  ../mingw-w64-svn/mingw-w64-tools/widl/configure --prefix=$INSTDIR/mingw-w64 --target=i686-w64-mingw32
+  make $MAKEOPTS
+  make install
+  cd ..
+  cd ..
+  # Second stage of gcc compilation
+  cd gcc
+  make $MAKEOPTS
+  make install
+  cd ..
+
+  # Building zlib
+  export CFLAGS="-mwindows"
+  export LDFLAGS="-mwindows"
+  cd zlib
+  find -type f | xargs touch --date="$REFERENCE_DATETIME"
+  make BINARY_PATH=$INSTDIR/zlib/lib INCLUDE_PATH=$INSTDIR/zlib/include LIBRARY_PATH=$INSTDIR/zlib/lib -f win32/Makefile.gcc PREFIX=i686-w64-mingw32- $MAKEOPTS SHARED_MODE=1
+  make BINARY_PATH=$INSTDIR/zlib/lib INCLUDE_PATH=$INSTDIR/zlib/include LIBRARY_PATH=$INSTDIR/zlib/lib -f win32/Makefile.gcc PREFIX=i686-w64-mingw32- $MAKEOPTS SHARED_MODE=1 install
+  cd ..
+
+  # Building Libevent
+  cd libevent
+  ./autogen.sh
+  find -type f | xargs touch --date="$REFERENCE_DATETIME"
+  ./configure --disable-static --host=i686-w64-mingw32 --prefix=$INSTDIR/libevent
+  make $MAKEOPTS
+  make install
+  cd ..
+
+  # Building OpenSSL
+  tar xzf openssl.tar.gz
+  cd openssl-*
+  find -type f | xargs touch --date="$REFERENCE_DATETIME"
+  # TODO: Add enable-ec_nistp_64_gcc_128 for 64bit Windows.
+  ./Configure -shared --cross-compile-prefix=i686-w64-mingw32- mingw --prefix=$INSTDIR/openssl
+  # Using $MAKEOPTS breaks the build. Might be the issue mentioned on
+  # http://cblfs.cross-lfs.org/index.php/OpenSSL.
+  make
+  make install
+  cd ..
+
+  # Grabbing the remaining results
+  cd $INSTDIR
+  ~/build/dzip.sh mingw-w64-$GCC_VER-win32-utils.zip mingw-w64
+  ~/build/dzip.sh zlib-${ZLIB_TAG#v}-win32-utils.zip zlib
+  ~/build/dzip.sh libevent-${LIBEVENT_TAG#release-}-win32-utils.zip libevent
+  ~/build/dzip.sh openssl-$OPENSSL_VER-win32-utils.zip openssl
+
+  cp *-utils.zip $OUTDIR/
diff --git a/gitian/mkbundle-linux.sh b/gitian/mkbundle-linux.sh
index 4c9de72..574f578 100755
--- a/gitian/mkbundle-linux.sh
+++ b/gitian/mkbundle-linux.sh
@@ -114,7 +114,7 @@ then
   ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit libevent=$LIBEVENT_TAG $DESCRIPTOR_DIR/linux/gitian-utils.yml
   if [ $? -ne 0 ];
   then
-    #mv var/build.log ./tor-fail-linux.log.`date +%Y%m%d%H%M%S`
+    #mv var/build.log ./utils-fail-linux.log.`date +%Y%m%d%H%M%S`
     exit 1
   fi
 
@@ -129,7 +129,7 @@ then
   ln -sf lxml-$LXML_VER-linux32-utils.zip lxml-linux32-utils.zip
   ln -sf lxml-$LXML_VER-linux64-utils.zip lxml-linux64-utils.zip
   cd ..
-  #cp -a result/tor-linux-res.yml $GITIAN_DIR/inputs/
+  #cp -a result/utils-linux-res.yml inputs/
 else
   echo
   echo "****** SKIPPING already built Utilities Component of Linux Bundle (1/5 for Linux) ******"
@@ -164,7 +164,7 @@ then
 
   cp -a build/out/tor-linux*-gbuilt.zip inputs/
   cp -a build/out/tor-linux*-debug.zip inputs/
-  #cp -a result/tor-linux-res.yml $GITIAN_DIR/inputs/
+  #cp -a result/tor-linux-res.yml inputs/
 else
   echo
   echo "****** SKIPPING already built Tor Component of Linux Bundle (2/5 for Linux) ******"
@@ -188,7 +188,7 @@ then
 
   cp -a build/out/tor-browser-linux*-gbuilt.zip inputs/
   cp -a build/out/tor-browser-linux*-debug.zip inputs/
-  #cp -a result/torbrowser-linux-res.yml $GITIAN_DIR/inputs/
+  #cp -a result/torbrowser-linux-res.yml inputs/
 else
   echo
   echo "****** SKIPPING already built TorBrowser Component of Linux Bundle (3/5 for Linux) ******"
@@ -211,7 +211,7 @@ then
 
   cp -a build/out/pluggable-transports-linux*-gbuilt.zip inputs/
   cp -a build/out/pluggable-transports-linux*-debug.zip inputs/
-  #cp -a result/pluggable-transports-linux-res.yml $GITIAN_DIR/inputs/
+  #cp -a result/pluggable-transports-linux-res.yml inputs/
 else
   echo
   echo "****** SKIPPING already built Pluggable Transports Component of Linux Bundle (4/5 for Linux) ******"
diff --git a/gitian/mkbundle-windows.sh b/gitian/mkbundle-windows.sh
index f93fb57..dcb9012 100755
--- a/gitian/mkbundle-windows.sh
+++ b/gitian/mkbundle-windows.sh
@@ -17,7 +17,6 @@ fi
 
 . $VERSIONS_FILE
 
-
 WRAPPER_DIR=$PWD
 GITIAN_DIR=$PWD/../../gitian-builder
 DESCRIPTOR_DIR=$PWD/descriptors/
@@ -43,7 +42,7 @@ fi
 cd $GITIAN_DIR
 export PATH=$PATH:$PWD/libexec
 
-echo "pref(\"torbrowser.version\", \"$TORBROWSER_VERSION-Windows\");" > $GITIAN_DIR/inputs/torbrowser.version 
+echo "pref(\"torbrowser.version\", \"$TORBROWSER_VERSION-Windows\");" > $GITIAN_DIR/inputs/torbrowser.version
 echo "$TORBROWSER_VERSION" > $GITIAN_DIR/inputs/bare-version
 cp -a $WRAPPER_DIR/$VERSIONS_FILE $GITIAN_DIR/inputs/versions
 
@@ -53,7 +52,7 @@ cp $WRAPPER_DIR/gpg/ubuntu-wine.gpg $GITIAN_DIR/inputs/
 
 cd $WRAPPER_DIR/..
 rm -f $GITIAN_DIR/inputs/relativelink-src.zip
-$WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/relativelink-src.zip ./RelativeLink/ 
+$WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/relativelink-src.zip ./RelativeLink/
 
 cd ./Bundle-Data/
 rm -f $GITIAN_DIR/inputs/tbb-docs.zip
@@ -74,6 +73,12 @@ die_msg() {
   exit 1
 }
 
+# Let's preserve the original $FOO for creating proper symlinks after building
+# the utils both if we verify tags and if we don't.
+
+LIBEVENT_TAG_ORIG=$LIBEVENT_TAG
+ZLIB_TAG_ORIG=$ZLIB_TAG
+
 if [ "z$VERIFY_TAGS" = "z1" ];
 then
   ./verify-tags.sh $GITIAN_DIR/inputs $VERSIONS_FILE || die_msg "You should run 'make prep' to ensure your inputs are up to date"
@@ -95,32 +100,73 @@ fi
 
 cd $GITIAN_DIR
 
-if [ ! -f $GITIAN_DIR/inputs/tor-win32-gbuilt.zip ];
+if [ ! -f inputs/binutils-$BINUTILS_VER-win32-utils.zip -o \
+     ! -f inputs/mingw-w64-$GCC_VER-win32-utils.zip -o \
+     ! -f inputs/zlib-${ZLIB_TAG_ORIG#v}-win32-utils.zip -o \
+     ! -f inputs/libevent-${LIBEVENT_TAG_ORIG#release-}-win32-utils.zip -o \
+     ! -f inputs/openssl-$OPENSSL_VER-win32-utils.zip ];
 then
-  echo 
-  echo "****** Starting Tor Component of Windows Bundle (1/4 for Windows) ******"
-  echo 
+  echo
+  echo "****** Starting Utilities Component of Windows Bundle (1/5 for Windows) ******"
+  echo
 
-  ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit zlib=$ZLIB_TAG,libevent=$LIBEVENT_TAG,tor=$TOR_TAG $DESCRIPTOR_DIR/windows/gitian-tor.yml
+  ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit zlib=$ZLIB_TAG,libevent=$LIBEVENT_TAG $DESCRIPTOR_DIR/windows/gitian-utils.yml
+  if [ $? -ne 0 ];
+  then
+    #mv var/build.log ./utils-fail-win.log.`date +%Y%m%d%H%M%S`
+    exit 1
+  fi
+
+  cd inputs
+  cp -a ../build/out/*-utils.zip .
+  ln -sf binutils-$BINUTILS_VER-win32-utils.zip binutils-win32-utils.zip
+  ln -sf mingw-w64-$GCC_VER-win32-utils.zip mingw-w64-win32-utils.zip
+  ln -sf zlib-${ZLIB_TAG_ORIG#v}-win32-utils.zip zlib-win32-utils.zip
+  ln -sf libevent-${LIBEVENT_TAG_ORIG#release-}-win32-utils.zip libevent-win32-utils.zip
+  ln -sf openssl-$OPENSSL_VER-win32-utils.zip openssl-win32-utils.zip
+  cd ..
+  #cp -a result/utils-win-res.yml inputs/
+else
+  echo
+  echo "****** SKIPPING already built Utilities Component of Windows Bundle (1/5 for Windows) ******"
+  echo
+  # We might have built the utilities in the past but maybe the links are
+  # pointing to the wrong version. Refresh them.
+  cd inputs
+  ln -sf binutils-$BINUTILS_VER-win32-utils.zip binutils-win32-utils.zip
+  ln -sf mingw-w64-$GCC_VER-win32-utils.zip mingw-w64-win32-utils.zip
+  ln -sf zlib-${ZLIB_TAG_ORIG#v}-win32-utils.zip zlib-win32-utils.zip
+  ln -sf libevent-${LIBEVENT_TAG_ORIG#release-}-win32-utils.zip libevent-win32-utils.zip
+  ln -sf openssl-$OPENSSL_VER-win32-utils.zip openssl-win32-utils.zip
+  cd ..
+fi
+
+if [ ! -f inputs/tor-win32-gbuilt.zip ];
+then
+  echo
+  echo "****** Starting Tor Component of Windows Bundle (2/5 for Windows) ******"
+  echo
+
+  ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit tor=$TOR_TAG $DESCRIPTOR_DIR/windows/gitian-tor.yml
   if [ $? -ne 0 ];
   then
     #mv var/build.log ./tor-fail-win32.log.`date +%Y%m%d%H%M%S`
     exit 1
   fi
-  
-  cp -a build/out/tor-win32-gbuilt.zip $GITIAN_DIR/inputs/
-  #cp -a result/tor-windows-res.yml $GITIAN_DIR/inputs/
+
+  cp -a build/out/tor-win32-gbuilt.zip inputs/
+  #cp -a result/tor-windows-res.yml inputs/
 else
-  echo 
-  echo "****** SKIPPING already built Tor Component of Windows Bundle (1/4 for Windows) ******"
-  echo 
+  echo
+  echo "****** SKIPPING already built Tor Component of Windows Bundle (2/5 for Windows) ******"
+  echo
 fi
 
-if [ ! -f $GITIAN_DIR/inputs/tor-browser-win32-gbuilt.zip ];
+if [ ! -f inputs/tor-browser-win32-gbuilt.zip ];
 then
-  echo 
-  echo "****** Starting Torbrowser Component of Windows Bundle (2/4 for Windows) ******"
-  echo 
+  echo
+  echo "****** Starting Torbrowser Component of Windows Bundle (3/5 for Windows) ******"
+  echo
 
   ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit tor-browser=$TORBROWSER_TAG $DESCRIPTOR_DIR/windows/gitian-firefox.yml
   if [ $? -ne 0 ];
@@ -129,19 +175,19 @@ then
     exit 1
   fi
 
-  cp -a build/out/tor-browser-win32-gbuilt.zip $GITIAN_DIR/inputs/
-  #cp -a result/torbrowser-windows-res.yml $GITIAN_DIR/inputs/
+  cp -a build/out/tor-browser-win32-gbuilt.zip inputs/
+  #cp -a result/torbrowser-windows-res.yml inputs/
 else
-  echo 
-  echo "****** SKIPPING already built Torbrowser Component of Windows Bundle (2/4 for Windows) ******"
-  echo 
+  echo
+  echo "****** SKIPPING already built Torbrowser Component of Windows Bundle (3/5 for Windows) ******"
+  echo
 fi
 
-if [ ! -f $GITIAN_DIR/inputs/pluggable-transports-win32-gbuilt.zip ];
+if [ ! -f inputs/pluggable-transports-win32-gbuilt.zip ];
 then
-  echo 
-  echo "****** Starting Pluggable Transports Component of Windows Bundle (3/4 for Windows) ******"
-  echo 
+  echo
+  echo "****** Starting Pluggable Transports Component of Windows Bundle (4/5 for Windows) ******"
+  echo
 
   ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit pyptlib=$PYPTLIB_TAG,obfsproxy=$OBFSPROXY_TAG,flashproxy=$FLASHPROXY_TAG,fteproxy=$FTEPROXY_TAG,txsocksx=$TXSOCKSX_TAG $DESCRIPTOR_DIR/windows/gitian-pluggable-transports.yml
   if [ $? -ne 0 ];
@@ -150,42 +196,39 @@ then
     exit 1
   fi
 
-  cp -a build/out/pluggable-transports-win32-gbuilt.zip $GITIAN_DIR/inputs/
-  #cp -a result/pluggable-transports-windows-res.yml $GITIAN_DIR/inputs/
+  cp -a build/out/pluggable-transports-win32-gbuilt.zip inputs/
+  #cp -a result/pluggable-transports-windows-res.yml inputs/
 else
-  echo 
-  echo "****** SKIPPING already built Pluggable Transports Component of Windows Bundle (3/4 for Windows) ******"
-  echo 
+  echo
+  echo "****** SKIPPING already built Pluggable Transports Component of Windows Bundle (4/5 for Windows) ******"
+  echo
 fi
 
-if [ ! -f $GITIAN_DIR/inputs/bundle-windows.gbuilt ];
-then 
-  echo 
-  echo "****** Starting Bundling+Localization of Windows Bundle (4/4 for Windows) ******"
-  echo 
-  
-  cp -a $WRAPPER_DIR/$VERSIONS_FILE $GITIAN_DIR/inputs/versions
+if [ ! -f inputs/bundle-windows.gbuilt ];
+then
+  echo
+  echo "****** Starting Bundling+Localization of Windows Bundle (5/5 for Windows) ******"
+  echo
+
   cd $WRAPPER_DIR && ./record-inputs.sh $VERSIONS_FILE && cd $GITIAN_DIR
-  
+
   ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit https-everywhere=$HTTPSE_TAG,torbutton=$TORBUTTON_TAG,tor-launcher=$TORLAUNCHER_TAG,tbb-windows-installer=$NSIS_TAG $DESCRIPTOR_DIR/windows/gitian-bundle.yml
   if [ $? -ne 0 ];
   then
     #mv var/build.log ./bundle-fail-win32.log.`date +%Y%m%d%H%M%S`
     exit 1
   fi
-  
+
   mkdir -p $WRAPPER_DIR/$TORBROWSER_VERSION/
   cp -a build/out/*.exe $WRAPPER_DIR/$TORBROWSER_VERSION/ || exit 1
-  touch $GITIAN_DIR/inputs/bundle-windows.gbuilt
+  touch inputs/bundle-windows.gbuilt
 else
-  echo 
-  echo "****** SKIPPING Bundling+Localization of Windows Bundle (4/4 for Windows) ******"
-  echo 
+  echo
+  echo "****** SKIPPING Bundling+Localization of Windows Bundle (5/5 for Windows) ******"
+  echo
 fi
 
-echo 
+echo
 echo "****** Windows Bundle complete ******"
-echo 
-
-# FIXME: docs
+echo
 



More information about the tbb-commits mailing list