[tor-commits] [tor-messenger-build/master] Start adding windows-i686 support

boklm at torproject.org boklm at torproject.org
Wed Nov 19 23:14:25 UTC 2014


commit d6e4177f160e0aedb98dc6d40f95df928074f2a2
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Thu Nov 20 00:09:07 2014 +0100

    Start adding windows-i686 support
---
 projects/binutils/build                         |   10 +-
 projects/binutils/config                        |   15 ++
 projects/binutils/enable-reloc-section-ld.patch |  216 +++++++++++++++++++++++
 projects/binutils/peXXigen.patch                |   14 ++
 projects/gcc/config                             |    4 +-
 projects/instantbird/build                      |   12 +-
 projects/instantbird/config                     |   23 ++-
 projects/instantbird/fix-mingw-build.mozpatch   |   39 ++++
 projects/instantbird/mozconfig-windows-i686     |   34 ++++
 projects/libgcrypt/build                        |    3 +-
 projects/libgcrypt/config                       |   11 ++
 projects/libgpg-error/build                     |    1 +
 projects/libgpg-error/config                    |   10 ++
 projects/libotr/build                           |    3 +-
 projects/libotr/config                          |   11 ++
 projects/mingw-w64/build                        |   63 +++++++
 projects/mingw-w64/config                       |   28 +++
 rbm.conf                                        |    6 +
 18 files changed, 494 insertions(+), 9 deletions(-)

diff --git a/projects/binutils/build b/projects/binutils/build
index a7e5b69..d4b9969 100644
--- a/projects/binutils/build
+++ b/projects/binutils/build
@@ -3,7 +3,15 @@ set -e
 distdir=/tmp/dist/binutils
 tar xf [% project %]-[% c("version") %].tar.bz2
 cd [% project %]-[% c("version") %]
-./configure --prefix=$distdir --disable-multilib --enable-gold
+[% IF c('var/windows') -%]
+# 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
+# Needed for the hardening...
+patch -p1 < ../enable-reloc-section-ld.patch
+# Zeroing timestamps in PE headers reliably, see bug 12753.
+patch -p1 < ../peXXigen.patch
+[% END -%]
+./configure --prefix=$distdir [% c('var/configure_opt') %]
 make -j4
 make install
 cd /tmp/dist
diff --git a/projects/binutils/config b/projects/binutils/config
index c7db2dd..ea17db0 100644
--- a/projects/binutils/config
+++ b/projects/binutils/config
@@ -9,9 +9,24 @@ var:
   deps:
     - build-essential
     - bison
+  configure_opt: '--disable-multilib --enable-gold'
+
+targets:
+  windows-i686:
+    var:
+      configure_opt: '--target=i686-w64-mingw32 --disable-multilib'
+    lsb_release:
+      id: Ubuntu
+      release: 12.04
+      codename: precise
+
 input_files:
   - URL: https://ftp.gnu.org/gnu/binutils/binutils-[% c("version") %].tar.bz2
     sig_ext: sig
     file_gpg_id: 1
     gpg_keyring: binutils.gpg
   - project: docker-image
+  - filename: enable-reloc-section-ld.patch
+    enable: '[% c("var/windows") %]'
+  - filename: peXXigen.patch
+    enable: '[% c("var/windows") %]'
diff --git a/projects/binutils/enable-reloc-section-ld.patch b/projects/binutils/enable-reloc-section-ld.patch
new file mode 100644
index 0000000..f393f51
--- /dev/null
+++ b/projects/binutils/enable-reloc-section-ld.patch
@@ -0,0 +1,216 @@
+From 093b08a9e7af23a258306b710ebc4556d12f94f7 Mon Sep 17 00:00:00 2001
+From: Erinn Clark <erinn at torproject.org>
+Date: Fri, 8 Aug 2014 14:23:44 -0400
+Subject: [PATCH] add relocation section so Windows bundles can have ASLR
+
+Patch by skruffy.
+
+---
+ ld/emultempl/pe.em  |  6 +++++
+ ld/emultempl/pep.em |  8 ++++++-
+ ld/pe-dll.c         | 63 ++++++++++++++++++++++++++++++-----------------------
+ ld/pe-dll.h         |  1 +
+ 4 files changed, 50 insertions(+), 28 deletions(-)
+
+diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
+index 5d6da9e..14c07f7 100644
+--- a/ld/emultempl/pe.em
++++ b/ld/emultempl/pe.em
+@@ -268,6 +268,7 @@ fragment <<EOF
+ #define OPTION_TERMINAL_SERVER_AWARE	(OPTION_WDM_DRIVER + 1)
+ /* Determinism.  */
+ #define OPTION_INSERT_TIMESTAMP		(OPTION_TERMINAL_SERVER_AWARE + 1)
++#define OPTION_ENABLE_RELOC_SECTION	(OPTION_INSERT_TIMESTAMP + 1)
+ 
+ static void
+ gld${EMULATION_NAME}_add_options
+@@ -310,6 +311,7 @@ gld${EMULATION_NAME}_add_options
+     {"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL},
+     {"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS},
+     {"exclude-all-symbols", no_argument, NULL, OPTION_EXCLUDE_ALL_SYMBOLS},
++    {"enable-reloc-section", no_argument, NULL, OPTION_ENABLE_RELOC_SECTION},
+     {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS},
+     {"exclude-modules-for-implib", required_argument, NULL, OPTION_EXCLUDE_MODULES_FOR_IMPLIB},
+     {"kill-at", no_argument, NULL, OPTION_KILL_ATS},
+@@ -773,6 +775,9 @@ gld${EMULATION_NAME}_handle_option (int optc)
+     case OPTION_EXCLUDE_ALL_SYMBOLS:
+       pe_dll_exclude_all_symbols = 1;
+       break;
++    case OPTION_ENABLE_RELOC_SECTION:
++      pe_dll_enable_reloc_section = 1;
++      break;
+     case OPTION_EXCLUDE_LIBS:
+       pe_dll_add_excludes (optarg, EXCLUDELIBS);
+       break;
+@@ -1839,6 +1844,7 @@ gld_${EMULATION_NAME}_finish (void)
+   if (link_info.shared
+ #if !defined(TARGET_IS_shpe)
+       || (!link_info.relocatable && pe_def_file->num_exports != 0)
++      || (!link_info.relocatable && pe_dll_enable_reloc_section)
+ #endif
+     )
+     {
+diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
+index b738800..b566903 100644
+--- a/ld/emultempl/pep.em
++++ b/ld/emultempl/pep.em
+@@ -242,7 +242,8 @@ enum options
+   OPTION_NO_BIND,
+   OPTION_WDM_DRIVER,
+   OPTION_INSERT_TIMESTAMP,
+-  OPTION_TERMINAL_SERVER_AWARE
++  OPTION_TERMINAL_SERVER_AWARE,
++  OPTION_ENABLE_RELOC_SECTION
+ };
+ 
+ static void
+@@ -284,6 +285,7 @@ gld${EMULATION_NAME}_add_options
+     {"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL},
+     {"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS},
+     {"exclude-all-symbols", no_argument, NULL, OPTION_EXCLUDE_ALL_SYMBOLS},
++    {"enable-reloc-section", no_argument, NULL, OPTION_ENABLE_RELOC_SECTION},
+     {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS},
+     {"exclude-modules-for-implib", required_argument, NULL, OPTION_EXCLUDE_MODULES_FOR_IMPLIB},
+     {"kill-at", no_argument, NULL, OPTION_KILL_ATS},
+@@ -727,6 +729,9 @@ gld${EMULATION_NAME}_handle_option (int optc)
+     case OPTION_EXCLUDE_ALL_SYMBOLS:
+       pep_dll_exclude_all_symbols = 1;
+       break;
++    case OPTION_ENABLE_RELOC_SECTION:
++      pe_dll_enable_reloc_section = 1;
++      break;
+     case OPTION_EXCLUDE_LIBS:
+       pep_dll_add_excludes (optarg, EXCLUDELIBS);
+       break;
+@@ -1618,6 +1623,7 @@ gld_${EMULATION_NAME}_finish (void)
+ 
+ #ifdef DLL_SUPPORT
+   if (link_info.shared
++      || (!link_info.relocatable && pe_dll_enable_reloc_section)
+       || (!link_info.relocatable && pep_def_file->num_exports != 0))
+     {
+       pep_dll_fill_sections (link_info.output_bfd, &link_info);
+diff --git a/ld/pe-dll.c b/ld/pe-dll.c
+index e9e133b..4230dc3 100644
+--- a/ld/pe-dll.c
++++ b/ld/pe-dll.c
+@@ -152,6 +152,7 @@ def_file * pe_def_file = 0;
+ int pe_dll_export_everything = 0;
+ int pe_dll_exclude_all_symbols = 0;
+ int pe_dll_do_default_excludes = 1;
++int pe_dll_enable_reloc_section = 0;
+ int pe_dll_kill_ats = 0;
+ int pe_dll_stdcall_aliases = 0;
+ int pe_dll_warn_dup_exports = 0;
+@@ -3370,8 +3371,15 @@ pe_dll_build_sections (bfd *abfd, struct bfd_link_info *info)
+   process_def_file_and_drectve (abfd, info);
+ 
+   if (pe_def_file->num_exports == 0 && !info->shared)
+-    return;
+-
++    {
++      if (pe_dll_enable_reloc_section)
++        {
++          build_filler_bfd (0);
++          pe_output_file_set_long_section_names (filler_bfd);
++        }
++      return;
++    }
++    
+   generate_edata (abfd, info);
+   build_filler_bfd (1);
+   pe_output_file_set_long_section_names (filler_bfd);
+@@ -3386,13 +3394,9 @@ pe_exe_build_sections (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
+   pe_output_file_set_long_section_names (filler_bfd);
+ }
+ 
+-void
+-pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
++static void
++pe_dll_create_reloc (bfd *abfd, struct bfd_link_info *info)
+ {
+-  pe_dll_id_target (bfd_get_target (abfd));
+-  pe_output_file_set_long_section_names (abfd);
+-  image_base = pe_data (abfd)->pe_opthdr.ImageBase;
+-
+   generate_reloc (abfd, info);
+   if (reloc_sz > 0)
+     {
+@@ -3409,38 +3413,43 @@ pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
+       lang_do_assignments (lang_final_phase_enum);
+     }
+ 
+-  fill_edata (abfd, info);
+-
+-  if (info->shared && !info->pie)
+-    pe_data (abfd)->dll = 1;
+-
+-  edata_s->contents = edata_d;
+   reloc_s->contents = reloc_d;
+ }
+ 
+ void
+-pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
++pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
+ {
++  if (!reloc_s && !edata_s)
++    return;
+   pe_dll_id_target (bfd_get_target (abfd));
+   pe_output_file_set_long_section_names (abfd);
+   image_base = pe_data (abfd)->pe_opthdr.ImageBase;
+ 
+-  generate_reloc (abfd, info);
+-  if (reloc_sz > 0)
++  if (reloc_s)
++    pe_dll_create_reloc (abfd, info);
++
++  if (edata_s)
+     {
+-      bfd_set_section_size (filler_bfd, reloc_s, reloc_sz);
++      fill_edata (abfd, info);
++      edata_s->contents = edata_d;
++    }
+ 
+-      /* Resize the sections.  */
+-      lang_reset_memory_regions ();
+-      lang_size_sections (NULL, TRUE);
++  if (info->shared && !info->pie)
++    pe_data (abfd)->dll = 1;
+ 
+-      /* Redo special stuff.  */
+-      ldemul_after_allocation ();
+ 
+-      /* Do the assignments again.  */
+-      lang_do_assignments (lang_final_phase_enum);
+-    }
+-  reloc_s->contents = reloc_d;
++}
++
++void
++pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
++{
++  if (!reloc_s)
++    return;
++  pe_dll_id_target (bfd_get_target (abfd));
++  pe_output_file_set_long_section_names (abfd);
++  image_base = pe_data (abfd)->pe_opthdr.ImageBase;
++
++  pe_dll_create_reloc (abfd, info);
+ }
+ 
+ bfd_boolean
+diff --git a/ld/pe-dll.h b/ld/pe-dll.h
+index 4697390..2bf71d9 100644
+--- a/ld/pe-dll.h
++++ b/ld/pe-dll.h
+@@ -31,6 +31,7 @@ extern def_file *pe_def_file;
+ extern int pe_dll_export_everything;
+ extern int pe_dll_exclude_all_symbols;
+ extern int pe_dll_do_default_excludes;
++extern int pe_dll_enable_reloc_section;
+ extern int pe_dll_kill_ats;
+ extern int pe_dll_stdcall_aliases;
+ extern int pe_dll_warn_dup_exports;
+-- 
+2.0.1
+
diff --git a/projects/binutils/peXXigen.patch b/projects/binutils/peXXigen.patch
new file mode 100644
index 0000000..785aa02
--- /dev/null
+++ b/projects/binutils/peXXigen.patch
@@ -0,0 +1,14 @@
+diff -crB binutils-2.24/bfd/peXXigen.c binutils-2.24/bfd/peXXigen.c
+*** binutils-2.24/bfd/peXXigen.c	Tue Nov 26 11:37:33 2013
+--- binutils-2.24/bfd/peXXigen.c	Mon Aug  4 07:10:15 2014
+***************
+*** 795,800 ****
+--- 795,802 ----
+    /* Only use a real timestamp if the option was chosen.  */
+    if ((pe_data (abfd)->insert_timestamp))
+      H_PUT_32 (abfd, time(0), filehdr_out->f_timdat);
++   else
++     H_PUT_32 (abfd, 0, filehdr_out->f_timdat);
+  
+    PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr,
+  		      filehdr_out->f_symptr);
diff --git a/projects/gcc/config b/projects/gcc/config
index b6c0a67..9ef8776 100644
--- a/projects/gcc/config
+++ b/projects/gcc/config
@@ -10,9 +10,9 @@ var:
     - build-essential
     - libmpc-dev
     - libc6-dev-i386
-  setup_gcc: |
+  setup: |
     mkdir -p /tmp/dist
-    tar -C /tmp/dist -xf [% c("gcc_tarfile") %]
+    tar -C /tmp/dist -xf [% c("compiler_tarfile") %]
     export PATH="/tmp/dist/gcc/bin:$PATH"
     [% IF c("var/osname") == "linux-i686" -%]
     export LD_LIBRARY_PATH=/tmp/dist/gcc/lib32
diff --git a/projects/instantbird/build b/projects/instantbird/build
index 1f611a1..b3d8531 100644
--- a/projects/instantbird/build
+++ b/projects/instantbird/build
@@ -3,14 +3,16 @@ set -e
 rootdir=$(pwd)
 export SHELL=/bin/sh
 export HOME=$rootdir
-[% pc('gcc', 'var/setup_gcc', { gcc_tarfile => c('input_files_by_name/gcc') }) %]
+[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 mkdir -p /tmp/dist
 cd /tmp/dist
+[% IF c("var/linux") -%]
 tar xf $rootdir/[% c('input_files_by_name/python') %]
 export PATH="/tmp/dist/python/bin:$PATH"
 python $rootdir/get-pip.py
 tar xf $rootdir/[% c('input_files_by_name/binutils') %]
 export PATH="/tmp/dist/binutils/bin:$PATH"
+[% END -%]
 # LD_BIND_NOW needed to avoid this error:
 # undefined symbol: _ZNSt14error_categoryD2Ev
 export LD_BIND_NOW=1
@@ -19,9 +21,11 @@ export LDFLAGS=-m32
 export CFLAGS=-m32
 export CC='gcc -m32'
 [% END -%]
+[% IF c("var/linux") -%]
 mkdir -p /tmp/dist/yasm/bin
 ln -s /usr/bin/yasm-1 /tmp/dist/yasm/bin/yasm
 export PATH="/tmp/dist/yasm/bin:$PATH"
+[% END -%]
 cd $rootdir
 tar xf [% project %]-[% c('version') %].tar.[% c('compress_tar') %]
 mkdir moz
@@ -33,6 +37,12 @@ for patch in $(ls -1 ../*.patch | sort)
 do
   patch -p1 < $patch
 done
+cd mozilla
+for patch in $(ls -1 $rootdir/*.mozpatch | sort)
+do
+  patch -p1 < $patch
+done
+cd ..
 cp ../[% c('input_files_by_name/mozconfig') %] .mozconfig
 ./mozilla/mach build || ./mozilla/mach build
 ./mozilla/mach package
diff --git a/projects/instantbird/config b/projects/instantbird/config
index 8940c40..82cf506 100644
--- a/projects/instantbird/config
+++ b/projects/instantbird/config
@@ -24,12 +24,23 @@ var:
     - mesa-common-dev
     - libdbus-1-dev
     - libdbus-glib-1-dev
-    - yasm-1
     - libasound2-dev
     - libgstreamer-plugins-base0.10-dev
     - libpulse-dev
     - ccache
 targets:
+  windows-i686:
+    lsb_release:
+      id: Ubuntu
+      release: 12.04
+      codename: precise
+    var:
+      arch_deps:
+        - yasm
+  linux-x86_64:
+    var:
+      arch_deps:
+        - yasm-1
   linux-i686:
     var:
       arch_deps:
@@ -37,6 +48,7 @@ targets:
         - ia32-libs
         - lib32z1-dev
         - lib32asound2-dev
+        - yasm-1
 input_files:
   - name: mozilla-src
     project: mozilla
@@ -50,14 +62,19 @@ input_files:
   - filename: links.patch
   - filename: picture.patch
   - filename: prepare-messages-for-displaying.patch
+  - filename: fix-mingw-build.mozpatch
+    enable: '[% c("var/windows") %]'
   - filename: 'mozconfig-[% c("var/osname") %]'
     name: mozconfig
   - name: python
     project: python
+    enable: '[% c("var/linux") %]'
   - URL: https://bootstrap.pypa.io/get-pip.py
     sha256sum: d43dc33a5670d69dd14a9be1f2b2fa27ebf124ec1b212a47425331040f742a9b
+    enable: '[% c("var/linux") %]'
   - name: binutils
     project: binutils
-  - name: gcc
-    project: gcc
+    enable: '[% c("var/linux") %]'
+  - name: '[% c("var/compiler") %]'
+    project: '[% c("var/compiler") %]'
   - project: docker-image
diff --git a/projects/instantbird/fix-mingw-build.mozpatch b/projects/instantbird/fix-mingw-build.mozpatch
new file mode 100644
index 0000000..b44b1ff
--- /dev/null
+++ b/projects/instantbird/fix-mingw-build.mozpatch
@@ -0,0 +1,39 @@
+diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp
+index 560ab8c2dae5..bd9718ef9582 100644
+--- a/dom/media/gmp/GMPChild.cpp
++++ b/dom/media/gmp/GMPChild.cpp
+@@ -356,7 +356,7 @@ GMPChild::PreLoadLibraries(const std::string& aPluginPath)
+   infoFile->GetPath(path);
+ 
+   std::ifstream stream;
+-  stream.open(path.get());
++  stream.open(NS_ConvertUTF16toUTF8(path).get());
+   if (!stream.good()) {
+     NS_WARNING("Failure opening info file for required DLLs");
+     return false;
+diff --git a/dom/media/gmp/rlz/base/memory/scoped_ptr.h b/dom/media/gmp/rlz/base/memory/scoped_ptr.h
+index 47204742c0a3..c837e04b34f6 100644
+--- a/dom/media/gmp/rlz/base/memory/scoped_ptr.h
++++ b/dom/media/gmp/rlz/base/memory/scoped_ptr.h
+@@ -18,7 +18,7 @@ public:
+   scoped_array(T* t) : nsAutoArrayPtr<T>(t) {}
+   void reset(T* t) {
+     scoped_array<T> other(t);
+-    operator=(other);
++    this->operator=(other);
+   }
+ };
+ 
+diff --git a/dom/media/gmp/rlz/win/lib/machine_id_win.cc b/dom/media/gmp/rlz/win/lib/machine_id_win.cc
+index 668910e5cd8c..fb5454274ec4 100644
+--- a/dom/media/gmp/rlz/win/lib/machine_id_win.cc
++++ b/dom/media/gmp/rlz/win/lib/machine_id_win.cc
+@@ -3,7 +3,7 @@
+ // found in the COPYING file.
+ 
+ #include <windows.h>
+-#include <Sddl.h>  // For ConvertSidToStringSidW.
++#include <sddl.h>  // For ConvertSidToStringSidW.
+ #include <string>
+ 
+ #include "base/memory/scoped_ptr.h"
diff --git a/projects/instantbird/mozconfig-windows-i686 b/projects/instantbird/mozconfig-windows-i686
new file mode 100644
index 0000000..321c873
--- /dev/null
+++ b/projects/instantbird/mozconfig-windows-i686
@@ -0,0 +1,34 @@
+export CROSS_COMPILE=1
+
+no_tooltool=1
+
+export MOZILLA_OFFICIAL=1
+mk_add_options MOZILLA_OFFICIAL=1
+
+ac_add_options --target=i686-w64-mingw32
+ac_add_options --enable-default-toolkit=cairo-windows
+ac_add_options --enable-strip
+
+mk_add_options MOZ_MAKE_FLAGS="-j4"
+
+ac_add_options --enable-application=im
+ac_add_options --enable-update-channel=release
+ac_add_options --enable-update-packaging
+ac_add_options --enable-optimize
+ac_add_options --disable-debug
+
+ac_add_options --enable-official-branding
+ac_add_options --with-l10n-base=..
+
+# sandbox currently fail to build with mingw
+ac_add_options --disable-sandbox
+
+# ICU seems still to have cross-compiling issues:
+# https://bugzilla.mozilla.org/show_bug.cgi?id=1019744#c19
+ac_add_options --without-intl-api
+ac_add_options --disable-crashreporter
+ac_add_options --disable-maintenance-service
+ac_add_options --disable-webrtc
+ac_add_options --disable-tests
+ac_add_options --disable-signmar
+
diff --git a/projects/libgcrypt/build b/projects/libgcrypt/build
index e06636a..d6c0da5 100644
--- a/projects/libgcrypt/build
+++ b/projects/libgcrypt/build
@@ -1,7 +1,8 @@
 #!/bin/sh
 set -e
 rootdir=$(pwd)
-mkdir /tmp/dist
+[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+mkdir -p /tmp/dist
 cd /tmp/dist
 tar xf $rootdir/[% c('input_files_by_name/libgpg-error') %]
 export PATH="/tmp/dist/libgpg-error/bin:$PATH"
diff --git a/projects/libgcrypt/config b/projects/libgcrypt/config
index 88a3c8c..c0454f2 100644
--- a/projects/libgcrypt/config
+++ b/projects/libgcrypt/config
@@ -8,7 +8,16 @@ lsb_release:
 var:
   deps:
     - build-essential
+    - libmpc2
 targets:
+  windows-i686:
+    lsb_release:
+      id: Ubuntu
+      release: 12.04
+      codename: precise
+    var:
+      arch_deps:
+        - gettext
   linux-i686:
     var:
       arch_deps:
@@ -21,4 +30,6 @@ input_files:
   - project: libgpg-error
     name: libgpg-error
     pkg_type: build
+  - name: '[% c("var/compiler") %]'
+    project: '[% c("var/compiler") %]'
   - project: docker-image
diff --git a/projects/libgpg-error/build b/projects/libgpg-error/build
index b1c10e9..5ec67c7 100644
--- a/projects/libgpg-error/build
+++ b/projects/libgpg-error/build
@@ -2,6 +2,7 @@
 set -e
 distdir="/tmp/dist/[% project %]"
 mkdir -p "$distdir"
+[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 tar xf [% project %]-[% c('version') %].tar.bz2
 cd [% project %]-[% c('version') %]
 ./configure --prefix="$distdir" [% c("var/configure_opt") %]
diff --git a/projects/libgpg-error/config b/projects/libgpg-error/config
index af24f3b..54fff82 100644
--- a/projects/libgpg-error/config
+++ b/projects/libgpg-error/config
@@ -9,6 +9,14 @@ var:
   deps:
     - build-essential
 targets:
+  windows-i686:
+    lsb_release:
+      id: Ubuntu
+      release: 12.04
+      codename: precise
+    var:
+      arch_deps:
+        - gettext
   linux-i686:
     var:
       arch_deps:
@@ -18,4 +26,6 @@ input_files:
     sig_ext: sig
     file_gpg_id: 1
     gpg_keyring: libgcrypt.gpg
+  - name: '[% c("var/compiler") %]'
+    project: '[% c("var/compiler") %]'
   - project: docker-image
diff --git a/projects/libotr/build b/projects/libotr/build
index 8f52c71..626ae9b 100644
--- a/projects/libotr/build
+++ b/projects/libotr/build
@@ -1,7 +1,8 @@
 #!/bin/sh
 set -e
 rootdir=$(pwd)
-mkdir /tmp/dist
+[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+mkdir -p /tmp/dist
 cd /tmp/dist
 tar xf $rootdir/[% c('input_files_by_name/libgpg-error') %]
 export PATH="/tmp/dist/libgpg-error/bin:$PATH"
diff --git a/projects/libotr/config b/projects/libotr/config
index e8e4a16..8fa54c7 100644
--- a/projects/libotr/config
+++ b/projects/libotr/config
@@ -8,8 +8,17 @@ lsb_release:
 var:
   deps:
     - build-essential
+    - libmpc2
     - file
 targets:
+  windows-i686:
+    lsb_release:
+      id: Ubuntu
+      release: 12.04
+      codename: precise
+    var:
+      arch_deps:
+        - gettext
   linux-i686:
     var:
       arch_deps:
@@ -24,4 +33,6 @@ input_files:
     name: libgcrypt
   - project: libgpg-error
     name: libgpg-error
+  - name: '[% c("var/compiler") %]'
+    project: '[% c("var/compiler") %]'
   - project: docker-image
diff --git a/projects/mingw-w64/build b/projects/mingw-w64/build
new file mode 100644
index 0000000..131204c
--- /dev/null
+++ b/projects/mingw-w64/build
@@ -0,0 +1,63 @@
+#!/bin/sh
+set -e
+rootdir=$(pwd)
+distdir=/tmp/dist/[% project %]
+
+mkdir /tmp/dist
+cd /tmp/dist
+tar xf $rootdir/[% c('input_files_by_name/binutils') %]
+mv binutils $distdir
+export PATH="$distdir/bin:$PATH"
+cd $rootdir
+
+
+tar xf [% project %]-[% c("version") %].tar.gz
+mkdir -p builddir/mingw-w64/mingw-w64-headers32
+cd builddir/mingw-w64/mingw-w64-headers32
+$rootdir/[% project %]-[% c("version") %]/mingw-w64-headers/configure \
+                --prefix=$distdir/i686-w64-mingw32 --host=i686-w64-mingw32 \
+                --enable-sdk=all --enable-secure-api --enable-idl
+make install
+
+cd $rootdir
+mkdir gcc
+cd gcc
+tar xjf $rootdir/gcc-[% c("var/gcc_version") %].tar.bz2
+# We don't want to link against msvcrt.dll due to bug 9084.
+i686-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
+sed 's/msvcrt/msvcr100/' -i $distdir/msvcr100.spec
+# Linking libgcc against msvcrt is hard-coded...
+sed 's/msvcrt/msvcr100/' -i gcc-[% c("var/gcc_version") %]/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=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase"
+gcc-[% c("var/gcc_version") %]/configure --prefix=$distdir --target=i686-w64-mingw32 --disable-multilib --enable-languages=c,c++
+make -j4 all-gcc
+make install-gcc
+
+mkdir -p $rootdir/builddir/mingw-w64/mingw-w64-crt32
+cd $rootdir/builddir/mingw-w64/mingw-w64-crt32
+$rootdir/[% project %]-[% c("version") %]/mingw-w64-crt/configure \
+                 --host=i686-w64-mingw32 --prefix=$distdir/i686-w64-mingw32
+make -j4
+make install
+
+mkdir -p $rootdir/builddir/mingw-w64/widl32
+cd $rootdir/builddir/mingw-w64/widl32
+$rootdir/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
+                 --prefix=$distdir --target=i686-w64-mingw32
+make -j4
+make install
+
+cd $rootdir/gcc
+make -j4
+make install
+mkdir -p $distdir/gcclibs
+cp i686-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
+cp i686-w64-mingw32/libgcc/shlib/libgcc_s_sjlj-1.dll $distdir/gcclibs
+
+cd /tmp/dist
+[% c('tar', {
+        tar_src => [ project ],
+        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
+        }) %]
diff --git a/projects/mingw-w64/config b/projects/mingw-w64/config
new file mode 100644
index 0000000..8b376ec
--- /dev/null
+++ b/projects/mingw-w64/config
@@ -0,0 +1,28 @@
+filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
+git_url: http://git.code.sf.net/p/mingw-w64/mingw-w64
+#git_hash: 469ed5d227202b373409c8a3b4c1358be39b9983
+git_hash: master
+version: '[% c("abbrev") %]'
+remote_docker: 1
+lsb_release:
+  id: Ubuntu
+  release: 12.04
+  codename: precise
+var:
+  gcc_version: 4.9.1
+  deps:
+    - automake
+    - build-essential
+    - libmpc-dev
+    - g++-mingw-w64-i686
+  setup: |
+    mkdir -p /tmp/dist
+    tar -C /tmp/dist -xf [% c("compiler_tarfile") %]
+    export PATH="/tmp/dist/mingw-w64/bin:$PATH"
+    gcclibs=/tmp/dist/mingw-w64/gcclibs
+input_files:
+  - URL: 'https://ftp.gnu.org/gnu/gcc/gcc-[% c("var/gcc_version") %]/gcc-[% c("var/gcc_version") %].tar.bz2'
+    sha256sum: d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e
+  - name: binutils
+    project: binutils
+  - project: docker-image
diff --git a/rbm.conf b/rbm.conf
index ce4c16e..3996c6a 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -43,17 +43,23 @@ targets:
     var:
       linux: 1
       osname: linux-x86_64
+      compiler: gcc
   linux-i686:
     arch: i686
     var:
       linux: 1
       osname: linux-i686
       configure_opt: '--host=i686-linux-gnu CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32'
+      compiler: gcc
   windows-i686:
     arch: i686
     var:
       windows: 1
       osname: windows-i686
+      configure_opt: '--host=i686-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]"'
+      CFLAGS: '-specs=/tmp/dist/mingw-w64/msvcr100.spec -mwindows -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security'
+      LDFLAGS: '-specs=/tmp/dist/mingw-w64/msvcr100.spec -mwindows -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -lssp -L$gcclibs'
+      compiler: mingw-w64
   osx-x86_64:
     arch: x86_64
     var:



More information about the tor-commits mailing list