mxe/src/gcc.mk

111 lines
4.0 KiB
Makefile
Raw Normal View History

2012-03-28 14:46:58 +01:00
# This file is part of MXE.
2012-03-29 11:14:15 +01:00
# See index.html for further information.
PKG := gcc
$(PKG)_IGNORE :=
2015-10-31 14:20:33 +00:00
$(PKG)_VERSION := 4.9.3
$(PKG)_CHECKSUM := 2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e
$(PKG)_SUBDIR := gcc-$($(PKG)_VERSION)
$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2
add http mirrors to packages hosted at FTP see http://lists.nongnu.org/archive/html/mingw-cross-env-list/2014-07/msg00002.html Many FTP servers block connections from Tor and some VPN servers. HTTP servers don't do this normally. Example of failed FTP download attempt of binutils-2.24.tar.bz: $ torsocks wget ftp://ftp.gnu.org/pub/gnu/binutils/binutils-2.24.tar.bz2 --2014-07-20 13:26:48-- ftp://ftp.gnu.org/pub/gnu/binutils/binutils-2.24.tar.bz2 => `binutils-2.24.tar.bz2' Resolving ftp.gnu.org (ftp.gnu.org)... 208.118.235.20 Connecting to ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /pub/gnu/binutils ... done. ==> SIZE binutils-2.24.tar.bz2 ... 22716802 ==> PASV ... done. ==> RETR binutils-2.24.tar.bz2 ... Error in server response, closing control connection. Retrying. Same package was downloaded via HTTP successfully: $ torsocks wget http://ftp.gnu.org/pub/gnu/binutils/binutils-2.24.tar.bz2 --2014-07-20 13:32:37-- http://ftp.gnu.org/pub/gnu/binutils/binutils-2.24.tar.bz2 Resolving ftp.gnu.org (ftp.gnu.org)... 208.118.235.20 Connecting to ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 22716802 (22M) [application/x-bzip2] Saving to: `binutils-2.24.tar.bz2' 100%[=================>] 22,716,802 721K/s in 24s 2014-07-20 13:33:03 (915 KB/s) - `binutils-2.24.tar.bz2' saved [22716802/22716802] Trying download from Tor Browser, I get error message: 425 Security: Bad IP connecting. HTTP URLs were added to FTP URLs-only packages. In many cases, ftp://ftp.gnu.org can be accessed from http://ftp.gnu.org If both URLs of a package are FTP, then one of them was replaced with HTTP. Command to check that those packages can be build successfully if behind Tor: $ torsocks make autoconf automake binutils bison cloog coreutils file freetds gcc gdb gettext gmp gnutls gperf isl libbluray libffi libgcrypt libgpg_error libidn libmicrohttpd libpng libxml2 libxslt m4 pthreads-w32 sed dcmtk mpfr I've run the test above successfully.
2014-07-20 10:21:48 +01:00
$(PKG)_URL := http://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
2012-09-20 15:25:00 +01:00
$(PKG)_URL_2 := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
2015-10-13 13:44:04 +01:00
$(PKG)_DEPS := binutils mingw-w64
$(PKG)_FILE_$(BUILD) :=
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' | \
$(SORT) -V | \
tail -1
endef
define $(PKG)_CONFIGURE
# configure gcc
mkdir '$(1).build'
cd '$(1).build' && '$(1)/configure' \
--target='$(TARGET)' \
--build='$(BUILD)' \
--prefix='$(PREFIX)' \
--libdir='$(PREFIX)/lib' \
--enable-languages='c,c++,objc,fortran' \
--enable-version-specific-runtime-libs \
--with-gcc \
--with-gnu-ld \
--with-gnu-as \
--disable-nls \
2014-02-17 03:25:48 +00:00
$(if $(BUILD_STATIC),--disable-shared) \
--disable-multilib \
--without-x \
--disable-win32-registry \
--enable-threads=$(MXE_GCC_THREADS) \
--enable-libgomp \
--with-gmp='$(PREFIX)/$(BUILD)' \
--with-isl='$(PREFIX)/$(BUILD)' \
--with-mpc='$(PREFIX)/$(BUILD)' \
--with-mpfr='$(PREFIX)/$(BUILD)' \
2015-10-31 14:12:26 +00:00
--with-cloog='$(PREFIX)/$(BUILD)' \
--with-as='$(PREFIX)/bin/$(TARGET)-as' \
--with-ld='$(PREFIX)/bin/$(TARGET)-ld' \
--with-nm='$(PREFIX)/bin/$(TARGET)-nm' \
$(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'")
endef
2014-02-17 03:25:48 +00:00
define $(PKG)_POST_BUILD
# TODO: find a way to configure the installation of these correctly
rm -f $(addprefix $(PREFIX)/$(TARGET)/bin/, c++ g++ gcc gfortran)
-mv '$(PREFIX)/lib/gcc/$(TARGET)/lib/'* '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'
-mv '$(PREFIX)/lib/gcc/$(TARGET)/'*.dll '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'
-cp '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll '$(PREFIX)/$(TARGET)/bin/'
-cp '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll.a '$(PREFIX)/$(TARGET)/lib/'
2014-02-17 03:25:48 +00:00
endef
define $(PKG)_BUILD_mingw-w64
# install mingw-w64 headers
$(call PREPARE_PKG_SOURCE,mingw-w64,$(1))
mkdir '$(1).headers-build'
cd '$(1).headers-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-headers/configure' \
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)' \
--enable-sdk=all \
--enable-idl
$(MAKE) -C '$(1).headers-build' install
# build standalone gcc
$($(PKG)_CONFIGURE)
$(MAKE) -C '$(1).build' -j '$(JOBS)' all-gcc
$(MAKE) -C '$(1).build' -j 1 install-gcc
# build mingw-w64-crt
mkdir '$(1).crt-build'
cd '$(1).crt-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)' \
@gcc-crt-config-opts@
2013-10-20 02:22:24 +01:00
$(MAKE) -C '$(1).crt-build' -j '$(JOBS)' || $(MAKE) -C '$(1).crt-build' -j '$(JOBS)'
$(MAKE) -C '$(1).crt-build' -j 1 install
# build posix threads
mkdir '$(1).pthread-build'
cd '$(1).pthread-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-libraries/winpthreads/configure' \
$(MXE_CONFIGURE_OPTS)
$(MAKE) -C '$(1).pthread-build' -j '$(JOBS)' || $(MAKE) -C '$(1).pthread-build' -j '$(JOBS)'
$(MAKE) -C '$(1).pthread-build' -j 1 install
# build rest of gcc
cd '$(1).build'
$(MAKE) -C '$(1).build' -j '$(JOBS)'
$(MAKE) -C '$(1).build' -j 1 install
2014-02-17 03:25:48 +00:00
$($(PKG)_POST_BUILD)
endef
$(PKG)_BUILD_x86_64-w64-mingw32 = $(subst @gcc-crt-config-opts@,--disable-lib32,$($(PKG)_BUILD_mingw-w64))
$(PKG)_BUILD_i686-w64-mingw32 = $(subst @gcc-crt-config-opts@,--disable-lib64,$($(PKG)_BUILD_mingw-w64))
define $(PKG)_BUILD_$(BUILD)
for f in c++ cpp g++ gcc gcov; do \
ln -sf "`which $$f`" '$(PREFIX)/bin/$(TARGET)'-$$f ; \
done
endef