diff src/build-gcc.mk @ 3048:5ef49fb3299d

treat gcc and binutils as build tools use a separate target for building the cmake toolchain file don't unpack gcc or binutils if we are using the system compiler
author John W. Eaton <jwe@octave.org>
date Fri, 14 Jun 2013 16:51:29 -0400
parents src/gcc.mk@951da75fd09c
children 15520bf542ff
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/build-gcc.mk	Fri Jun 14 16:51:29 2013 -0400
@@ -0,0 +1,69 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG             := build-gcc
+$(PKG)_IGNORE   :=
+$(PKG)_CHECKSUM := a464ba0f26eef24c29bcd1e7489421117fb9ee35
+$(PKG)_SUBDIR   := gcc-$($(PKG)_VERSION)
+$(PKG)_FILE     := gcc-$($(PKG)_VERSION).tar.bz2
+$(PKG)_URL      := ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
+$(PKG)_URL_2    := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
+ifeq ($(MXE_NATIVE_BUILD),yes)
+  $(PKG)_DEPS := build-binutils
+else
+  ifeq ($(MXE_SYSTEM),mingw)
+    $(PKG)_DEPS := mingwrt w32api build-binutils
+  endif
+endif
+
+ifneq ($(BUILD_SHARED),yes)
+  $(PKG)_STATIC_FLAG := --static
+endif
+
+ifeq ($(MXE_SYSTEM),mingw)
+  $(PKG)_SYSDEP_CONFIGURE_OPTIONS := \
+    --disable-sjlj-exceptions \
+    --disable-win32-registry \
+    --enable-threads=win32
+endif
+
+
+define $(PKG)_UPDATE
+    $(WGET) -q -O- 'http://ftp.gnu.org/gnu/gcc/?C=M;O=D' | \
+    $(SED) -n 's,.*<a href="gcc-\([0-9][^"]*\)/".*,\1,p' | \
+    grep -v '^4\.[543]\.' | \
+    head -1
+endef
+
+define $(PKG)_BUILD
+    cd '$(1)' && ./contrib/download_prerequisites
+    mkdir '$(1).build'
+    cd    '$(1).build' && '$(1)/configure' \
+        --target='$(TARGET)' \
+        --build='$(BUILD_SYSTEM)' \
+        --prefix='$(BUILD_TOOLS_PREFIX)' \
+        --libdir='$(BUILD_TOOLS_PREFIX)/lib' \
+        --enable-languages='c,c++,fortran' \
+        --enable-version-specific-runtime-libs \
+        --with-gcc \
+        --with-gnu-ld \
+        --with-gnu-as \
+        --disable-nls \
+        $(ENABLE_SHARED_OR_STATIC) \
+        --without-x \
+        $($(PKG)_SYSDEP_CONFIGURE_OPTIONS) \
+        --disable-libgomp \
+        --disable-libmudflap \
+        $(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'")
+    $(MAKE) -C '$(1).build' -j '$(JOBS)'
+    $(MAKE) -C '$(1).build' -j 1 install
+    mkdir -p $(TOP_DIR)/cross-tools/$(HOST_BINDIR)
+    $(MAKE) -C '$(1).build' -j 1 DESTDIR=$(TOP_DIR)/cross-tools install
+
+    # create pkg-config script
+    (echo '#!/bin/sh'; \
+     echo 'PKG_CONFIG_PATH="$$PKG_CONFIG_PATH_$(subst -,_,$(TARGET))" PKG_CONFIG_LIBDIR='\''$(HOST_LIBDIR)/pkgconfig'\'' exec pkg-config $($(PKG)_STATIC_FLAG) "$$@"') \
+             > '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)pkg-config'
+    chmod 0755 '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)pkg-config'
+endef
+