changeset 3804:7e15ef9bf1e5

Update build-gcc, nsis to compile when in w64 mode. * src/build-binutils.mk: add windows 64 conditionals to binutils to compile multilib * src/build-gcc.mk:add windows 64 conditionals to gcc to compile multilib * src/nsis.mk: add PKG_BUILD target for windows 64 * src/win64-nsis.patch: new file. * dist-files.mk: add reference to win64-nsis.patch.
author John D
date Tue, 17 Feb 2015 14:48:23 -0500
parents f2776007d295
children 496c393c1d3e
files dist-files.mk src/build-binutils.mk src/build-gcc.mk src/nsis.mk src/win64-nsis.patch
diffstat 5 files changed, 95 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Tue Feb 17 18:55:38 2015 -0500
+++ b/dist-files.mk	Tue Feb 17 14:48:23 2015 -0500
@@ -644,6 +644,7 @@
   wavpack-1-exec_prefix.patch \
   wavpack.mk \
   wget.mk \
+  win64-nsis.patch \
   winpcap-1-fixes.patch \
   winpcap.mk \
   wt-1-fixes.patch \
--- a/src/build-binutils.mk	Tue Feb 17 18:55:38 2015 -0500
+++ b/src/build-binutils.mk	Tue Feb 17 14:48:23 2015 -0500
@@ -12,11 +12,13 @@
 $(PKG)_DEPS     :=
 
 ifneq ($(MXE_NATIVE_BUILD),yes)
+ifneq ($(ENABLE_WINDOWS_64),yes)
   define $(PKG)_POST_BUILD
     $(INSTALL) -d '$(BUILD_TOOLS_PREFIX)/bin/$(TARGET)'
     mv $(addprefix $(HOST_PREFIX)/bin/, ar as dlltool ld ld.bfd nm objcopy objdump ranlib strip) '$(BUILD_TOOLS_PREFIX)/bin/$(TARGET)'
   endef
 endif
+endif
 
 define $(PKG)_UPDATE
     $(WGET) -q -O- 'http://ftp.gnu.org/gnu/binutils/?C=M;O=D' | \
@@ -31,9 +33,18 @@
   $(PKG)_SYSDEP_CONFIGURE_OPTIONS := \
     --target='$(TARGET)' \
     --build='$(BUILD_SYSTEM)' \
-    --libdir='$(BUILD_TOOLS_PREFIX)/lib' \
-    --disable-multilib \
-    --with-sysroot='$(HOST_PREFIX)'
+
+  ifeq ($(ENABLE_WINDOWS_64),yes)
+    $(PKG)_SYSDEP_CONFIGURE_OPTIONS += \
+      --enable-multilib \
+      --with-sysroot='$(BUILD_TOOLS_PREFIX)' \
+      --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32
+  else
+    $(PKG)_SYSDEP_CONFIGURE_OPTIONS += \
+      --libdir='$(BUILD_TOOLS_PREFIX)/lib' \
+      --disable-multilib \
+      --with-sysroot='$(HOST_PREFIX)'
+  endif
 endif
 
 define $(PKG)_BUILD
--- a/src/build-gcc.mk	Tue Feb 17 18:55:38 2015 -0500
+++ b/src/build-gcc.mk	Tue Feb 17 14:48:23 2015 -0500
@@ -24,7 +24,6 @@
 
 ifeq ($(MXE_SYSTEM),mingw)
   $(PKG)_SYSDEP_CONFIGURE_OPTIONS := \
-    --libdir='$(BUILD_TOOLS_PREFIX)/lib' \
     --enable-version-specific-runtime-libs \
     --with-gcc \
     --with-gnu-ld \
@@ -32,11 +31,26 @@
     --disable-nls \
     --without-x \
     --disable-win32-registry \
-    --with-native-system-header-dir='/include' \
     --enable-threads=win32
   ifneq ($(TARGET),x86_64-w64-mingw32)
     $(PKG)_SYSDEP_CONFIGURE_OPTIONS += \
+    --libdir='$(BUILD_TOOLS_PREFIX)/lib' \
+    --with-native-system-header-dir='/include' \
       --disable-sjlj-exceptions
+  else
+    define $(PKG)_PRE_BUILD
+      echo "Shortcuts"
+      # create shortcuts
+      if ! [ -L $(HOST_PREFIX)/lib64 ]; then \
+        ln -s $(HOST_PREFIX)/lib $(HOST_PREFIX)/lib64; \
+      fi
+      if ! [ -d $(HOST_PREFIX)/lib32 ]; then \
+        mkdir -p $(HOST_PREFIX)/lib32; \
+      fi
+      if ! [ -L $(BUILD_TOOLS_PREFIX)/mingw ]; then \
+        ln -s $(HOST_PREFIX) $(BUILD_TOOLS_PREFIX)/mingw; \
+      fi
+    endef
   endif
   define $(PKG)_BUILD_SYSTEM_RUNTIME
     # build standalone gcc
@@ -60,10 +74,21 @@
   $(PKG)_SYSDEP_CONFIGURE_OPTIONS += \
     --target='$(TARGET)' \
     --build='$(BUILD_SYSTEM)' \
-    --with-sysroot='$(HOST_PREFIX)' \
     --with-as='$(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-as' \
     --with-ld='$(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-ld' \
     --with-nm='$(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-nm'
+
+  ifeq ($(ENABLE_WINDOWS_64),yes)
+    $(PKG)_SYSDEP_CONFIGURE_OPTIONS += --with-sysroot='$(BUILD_TOOLS_PREFIX)' \
+      --enable-multilib  --with-host-libstdcxx="-lstdc++ -lsupc++" --with-system-zlib \
+      --enable-64bit --enable-fully-dynamic-string
+  else
+    $(PKG)_SYSDEP_CONFIGURE_OPTIONS += --with-sysroot='$(HOST_PREFIX)' \
+      --disable-multilib
+  endif
+else
+  $(PKG)_SYSDEP_CONFIGURE_OPTIONS += \
+      --disable-multilib
 endif
 
 define $(PKG)_UPDATE
@@ -79,7 +104,6 @@
     cd    '$(1).build' && '$(1)/configure' \
         --prefix='$(BUILD_TOOLS_PREFIX)' \
         --enable-languages='c,c++,fortran' \
-        --disable-multilib \
         --disable-libsanitizer \
         $($(PKG)_SYSDEP_CONFIGURE_OPTIONS) \
         $(ENABLE_SHARED_OR_STATIC) \
@@ -93,6 +117,8 @@
 endef
 
 define $(PKG)_BUILD
+  $($(PKG)_PRE_BUILD)
+
   $($(PKG)_CONFIGURE)
 
   $($(PKG)_BUILD_SYSTEM_RUNTIME)
@@ -105,6 +131,11 @@
     mv $(BUILD_TOOLS_PREFIX)/lib/gcc/$(TARGET)/lib/libgcc_s.a $(BUILD_TOOLS_PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/libgcc_s.a; \
   fi
 
+  if [ -f $(BUILD_TOOLS_PREFIX)/lib/gcc/$(TARGET)/lib32/libgcc_s.a ]; then \
+    mv $(BUILD_TOOLS_PREFIX)/lib/gcc/$(TARGET)/lib32/libgcc_s.a $(BUILD_TOOLS_PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/32/libgcc_s.a; \
+  fi
+
+
   # create pkg-config script
   if [ '$(MXE_NATIVE_BUILD)' = 'no' ]; then \
     (echo '#!/bin/sh'; \
--- a/src/nsis.mk	Tue Feb 17 18:55:38 2015 -0500
+++ b/src/nsis.mk	Tue Feb 17 14:48:23 2015 -0500
@@ -16,7 +16,19 @@
     $(SED) -n 's,.*<a href="v\([0-9]\)\([^"]*\)".*,\1.\2,p' | \
     tail -1
 endef
+ifeq ($(ENABLE_WINDOWS_64),yes)
+define $(PKG)_BUILD
+    cd '$(1)' && patch -p1 < $(TOP_DIR)/src/win64-nsis.patch
 
+    cd '$(1)' && scons VERBOSE=1 \
+        MINGW_CROSS_PREFIX='$(MXE_TOOL_PREFIX)' \
+        PREFIX='$(HOST_PREFIX)' PREFIX_BIN=$(BUILD_TOOLS_PREFIX)/bin \
+        APPEND_LIBPATH='$(HOST_PREFIX)/lib32' \
+        SKIPUTILS='NSIS Menu' \
+        install
+    $(INSTALL) -m755 '$(BUILD_TOOLS_PREFIX)/bin/makensis' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)makensis'
+endef
+else
 define $(PKG)_BUILD
     cd '$(1)' && scons VERBOSE=1 \
         MINGW_CROSS_PREFIX='$(MXE_TOOL_PREFIX)' \
@@ -27,3 +39,4 @@
         install
     $(INSTALL) -m755 '$(BUILD_TOOLS_PREFIX)/bin/makensis' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)makensis'
 endef
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/win64-nsis.patch	Tue Feb 17 14:48:23 2015 -0500
@@ -0,0 +1,32 @@
+diff -ur nsis-2.46-src.orig/SCons/Tools/crossmingw.py nsis-2.46-src/SCons/Tools/crossmingw.py
+--- nsis-2.46-src.orig/SCons/Tools/crossmingw.py	2015-02-08 20:55:24.129440718 -0500
++++ nsis-2.46-src/SCons/Tools/crossmingw.py	2015-02-08 20:58:12.005446948 -0500
+@@ -145,15 +145,15 @@
+         SCons.Tool.Tool(tool)(env)
+ 
+     #... but a few things differ:
+-    env['CC'] = mingw_prefix + 'gcc'
++    env['CC'] = mingw_prefix + 'gcc -m32'
+     env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
+-    env['CXX'] = mingw_prefix + 'g++'
++    env['CXX'] = mingw_prefix + 'g++ -m32'
+     env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
+     env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
+     env['SHLINKCOM']   = shlib_action
+     env.Append(SHLIBEMITTER = [shlib_emitter])
+-    env['LINK'] = mingw_prefix + 'g++'
+-    env['AS'] = mingw_prefix + 'as'
++    env['LINK'] = mingw_prefix + 'g++ -m32'
++    env['AS'] = mingw_prefix + 'as -m32'
+     env['AR'] = mingw_prefix + 'ar'
+     env['RANLIB'] = mingw_prefix + 'ranlib'
+     env['WIN32DEFPREFIX']        = ''
+@@ -161,7 +161,7 @@
+     env['SHOBJSUFFIX'] = '.o'
+     env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
+ 
+-    env['RC'] = mingw_prefix + 'windres'
++    env['RC'] = mingw_prefix + 'windres --target=pe-i386'
+     env['RCFLAGS'] = SCons.Util.CLVar('')
+     env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS ${INCPREFIX}${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET'
+     env['BUILDERS']['RES'] = res_builder