Merge pull request #1659 from tonytheodore/gcc5-fix

Cleanups and fixes after gcc5 update
This commit is contained in:
Boris Nagaev 2017-02-05 08:57:28 +00:00 committed by GitHub
commit 27facf1c6f
10 changed files with 209 additions and 123 deletions

View File

@ -9,7 +9,7 @@ $(PKG)_FILE = $(gcc_FILE)
$(PKG)_PATCHES = $(realpath $(sort $(wildcard $(addsuffix /gcc-[0-9]*.patch, $(TOP_DIR)/src))))
$(PKG)_URL = $(gcc_URL)
$(PKG)_URL_2 = $(gcc_URL_2)
$(PKG)_DEPS := gcc binutils-host cloog gmp isl mpfr mpc pthreads
$(PKG)_DEPS := gcc binutils-host gmp isl mpfr mpc pthreads
define $(PKG)_UPDATE
echo $(gcc_VERSION)
@ -35,7 +35,7 @@ define $(PKG)_BUILD
--disable-win32-registry \
--enable-threads=$(MXE_GCC_THREADS) \
--enable-libgomp \
--with-{cloog,gmp,isl,mpc,mpfr}='$(PREFIX)/$(TARGET)' \
--with-{gmp,isl,mpc,mpfr}='$(PREFIX)/$(TARGET)' \
$($(PKG)_CONFIGURE_OPTS)
$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)'

View File

@ -2,8 +2,3 @@
GCC 4.9.4 was used before [GCC 5.4.0](https://github.com/mxe/mxe/pull/1541).
This plugin is a backup in case of problems with GCC 5.4.0.
The only package known not to work with this plugin is hyperscan.
It was changed to work with GCC 5.4.0 (`-latomic` was added) and
that change broke support of GCC 4.9.4.
See [the comment](https://github.com/mxe/mxe/pull/1541#issuecomment-274389620).

View File

@ -20,10 +20,3 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.bz2
$(PKG)_URL := http://isl.gforge.inria.fr/$($(PKG)_FILE)
$(PKG)_URL_2 := ftp://gcc.gnu.org/pub/gcc/infrastructure/$($(PKG)_FILE)
PKG := gcc
$(PKG)_VERSION := 4.9.4
$(PKG)_CHECKSUM := 6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092
$(PKG)_SUBDIR := gcc-$($(PKG)_VERSION)
$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2
$(PKG)_URL := http://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)

130
plugins/gcc4/gcc4.mk Normal file
View File

@ -0,0 +1,130 @@
# This file is part of MXE. See LICENSE.md for licensing information.
PKG := gcc
$(PKG)_WEBSITE := http://gcc.gnu.org/
$(PKG)_DESCR := GCC
$(PKG)_IGNORE := 5%
$(PKG)_VERSION := 4.9.4
$(PKG)_CHECKSUM := 6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092
$(PKG)_SUBDIR := gcc-$($(PKG)_VERSION)
$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2
$(PKG)_PATCHES := $(basename $(lastword $(MAKEFILE_LIST))).patch
$(PKG)_URL := http://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)
$(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 \
$(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)' \
--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
define $(PKG)_POST_BUILD
# - no non-trivial way to configure installation of *.dlls
# each sudbir has it's own variations of variables like:
# `toolexeclibdir` `install-toolexeclibLTLIBRARIES` etc.
# and maintaining those would be cumbersome
# - need to keep `--enable-version-specific-runtime-libs` otherwise
# libraries go directly into $(PREFIX)/$(TARGET)/lib and are
# harder to cleanup
# - ignore rm failure as parallel build may have cleaned up, but
# don't wildcard all libs so future additions will be detected
$(and $(BUILD_SHARED),
mv -v '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll '$(PREFIX)/$(TARGET)/bin/'
-rm -v '$(PREFIX)/lib/gcc/$(TARGET)/'libgcc_s*.dll
-rm -v '$(PREFIX)/lib/gcc/$(TARGET)/lib/'libgcc_s*.a
-rmdir '$(PREFIX)/lib/gcc/$(TARGET)/lib/')
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 \
--enable-secure-api \
$(mingw-w64-headers_CONFIGURE_OPTS)
$(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_STRIP_TOOLCHAIN)-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@
$(MAKE) -C '$(1).crt-build' -j '$(JOBS)' || $(MAKE) -C '$(1).crt-build' -j '$(JOBS)'
$(MAKE) -C '$(1).crt-build' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
# 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_STRIP_TOOLCHAIN)
# build rest of gcc
cd '$(1).build'
$(MAKE) -C '$(1).build' -j '$(JOBS)'
$(MAKE) -C '$(1).build' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
# shared libgcc isn't installed to version-specific locations
# so install correctly to simplify cleanup
$(and $(BUILD_SHARED),
$(MAKE) -C '$(1).build/$(TARGET)/libgcc' -j 1 \
toolexecdir='$(PREFIX)/$(TARGET)/bin' \
SHLIB_SLIBDIR_QUAL= \
install-shared)
$($(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

View File

@ -10,7 +10,6 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz
$(PKG)_URL := http://www.bastoul.net/cloog/pages/download/$($(PKG)_FILE)
$(PKG)_URL_2 := ftp://gcc.gnu.org/pub/gcc/infrastructure/$($(PKG)_FILE)
$(PKG)_TARGETS := $(MXE_TARGETS)
$(PKG)_DEPS := gcc gmp isl
define $(PKG)_UPDATE

27
src/gcc-1-fixes.patch Normal file
View File

@ -0,0 +1,27 @@
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Thu, 2 Feb 2017 02:05:50 +1100
Subject: [PATCH] allow native cpu detection when building with clang
function was disabled for non-gcc5 in:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b587c12551143c14f023860a1dbdf7316ae71f27;hp=43096b526a9f23008b9769372f11475ae63487bc
clang can build it correctly and this should probably be a feature test
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 1111111..2222222 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
const char *host_detect_local_cpu (int argc, const char **argv);
-#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__))
+#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__)) || defined(__clang__)
#include "cpuid.h"
struct cache_desc

View File

@ -12,8 +12,6 @@ $(PKG)_URL := http://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)
$(PKG)_URL_2 := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
$(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' | \
@ -23,8 +21,7 @@ endef
define $(PKG)_CONFIGURE
# configure gcc
mkdir '$(1).build'
cd '$(1).build' && '$(1)/configure' \
cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
--target='$(TARGET)' \
--build='$(BUILD)' \
--prefix='$(PREFIX)' \
@ -45,85 +42,78 @@ define $(PKG)_CONFIGURE
--with-isl='$(PREFIX)/$(BUILD)' \
--with-mpc='$(PREFIX)/$(BUILD)' \
--with-mpfr='$(PREFIX)/$(BUILD)' \
--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
define $(PKG)_BUILD_mingw-w64
# install mingw-w64 headers
$(call PREPARE_PKG_SOURCE,mingw-w64,$(BUILD_DIR))
mkdir '$(BUILD_DIR).headers'
cd '$(BUILD_DIR).headers' && '$(BUILD_DIR)/$(mingw-w64_SUBDIR)/mingw-w64-headers/configure' \
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)' \
--enable-sdk=all \
--enable-idl \
--enable-secure-api \
$(mingw-w64-headers_CONFIGURE_OPTS)
$(MAKE) -C '$(BUILD_DIR).headers' install
# build standalone gcc
$($(PKG)_CONFIGURE)
$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' all-gcc
$(MAKE) -C '$(BUILD_DIR)' -j 1 $(INSTALL_STRIP_TOOLCHAIN)-gcc
# build mingw-w64-crt
mkdir '$(BUILD_DIR).crt'
cd '$(BUILD_DIR).crt' && '$(BUILD_DIR)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)' \
@gcc-crt-config-opts@
$(MAKE) -C '$(BUILD_DIR).crt' -j '$(JOBS)' || $(MAKE) -C '$(BUILD_DIR).crt' -j '$(JOBS)'
$(MAKE) -C '$(BUILD_DIR).crt' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
# build posix threads
mkdir '$(BUILD_DIR).pthreads'
cd '$(BUILD_DIR).pthreads' && '$(BUILD_DIR)/$(mingw-w64_SUBDIR)/mingw-w64-libraries/winpthreads/configure' \
$(MXE_CONFIGURE_OPTS)
$(MAKE) -C '$(BUILD_DIR).pthreads' -j '$(JOBS)' || $(MAKE) -C '$(BUILD_DIR).pthreads' -j '$(JOBS)'
$(MAKE) -C '$(BUILD_DIR).pthreads' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
# build rest of gcc
$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)'
$(MAKE) -C '$(BUILD_DIR)' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
$($(PKG)_POST_BUILD)
endef
define $(PKG)_POST_BUILD
# - no non-trivial way to configure installation of *.dlls
# each sudbir has it's own variations of variables like:
# `toolexeclibdir` `install-toolexeclibLTLIBRARIES` etc.
# and maintaining those would be cumbersome
# - shared libgcc isn't installed to version-specific locations
# - need to keep `--enable-version-specific-runtime-libs` otherwise
# libraries go directly into $(PREFIX)/$(TARGET)/lib and are
# harder to cleanup
# - ignore rm failure as parallel build may have cleaned up, but
# don't wildcard all libs so future additions will be detected
$(and $(BUILD_SHARED),
$(MAKE) -C '$(BUILD_DIR)/$(TARGET)/libgcc' -j 1 \
toolexecdir='$(PREFIX)/$(TARGET)/bin' \
SHLIB_SLIBDIR_QUAL= \
install-shared
mv -v '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll '$(PREFIX)/$(TARGET)/bin/'
-rm -v '$(PREFIX)/lib/gcc/$(TARGET)/'libgcc_s*.dll
-rm -v '$(PREFIX)/lib/gcc/$(TARGET)/lib/'libgcc_s*.a
-rmdir '$(PREFIX)/lib/gcc/$(TARGET)/lib/')
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 \
--enable-secure-api \
$(mingw-w64-headers_CONFIGURE_OPTS)
$(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_STRIP_TOOLCHAIN)-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@
$(MAKE) -C '$(1).crt-build' -j '$(JOBS)' || $(MAKE) -C '$(1).crt-build' -j '$(JOBS)'
$(MAKE) -C '$(1).crt-build' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
# 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_STRIP_TOOLCHAIN)
# build rest of gcc
cd '$(1).build'
$(MAKE) -C '$(1).build' -j '$(JOBS)'
$(MAKE) -C '$(1).build' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
# shared libgcc isn't installed to version-specific locations
# so install correctly to simplify cleanup
$(and $(BUILD_SHARED),
$(MAKE) -C '$(1).build/$(TARGET)/libgcc' -j 1 \
toolexecdir='$(PREFIX)/$(TARGET)/bin' \
SHLIB_SLIBDIR_QUAL= \
install-shared)
$($(PKG)_POST_BUILD)
# cc1libdir isn't passed to subdirs so install correctly and rm
$(MAKE) -C '$(BUILD_DIR)/libcc1' -j 1 install cc1libdir='$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)'
-rm -f '$(PREFIX)/lib/'libcc1*
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

View File

@ -422,50 +422,3 @@ index 1111111..2222222 100644
Libs.private: @PRIVATE_LIBS@
-Cflags: -I${includedir}/hs
+Cflags: -I${includedir}/hs -posix
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Sat, 21 Jan 2017 14:41:17 +1100
Subject: [PATCH] add libatomic linking for gcc54 on macos
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 1111111..2222222 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -7,7 +7,7 @@ endif()
add_executable(simplegrep simplegrep.c)
set_source_files_properties(simplegrep.c PROPERTIES COMPILE_FLAGS
"-Wall -Wno-unused-parameter")
-target_link_libraries(simplegrep hs)
+target_link_libraries(simplegrep hs atomic)
if (PCAP_LIBRARY)
add_executable(pcapscan pcapscan.cc)
diff --git a/libhs.pc.in b/libhs.pc.in
index 1111111..2222222 100644
--- a/libhs.pc.in
+++ b/libhs.pc.in
@@ -7,5 +7,5 @@ Name: libhs
Description: Intel(R) Hyperscan Library
Version: @HS_VERSION@
Libs: -L${libdir} -lhs
-Libs.private: @PRIVATE_LIBS@
+Libs.private: @PRIVATE_LIBS@ -latomic
Cflags: -I${includedir}/hs -posix
diff --git a/unit/CMakeLists.txt b/unit/CMakeLists.txt
index 1111111..2222222 100644
--- a/unit/CMakeLists.txt
+++ b/unit/CMakeLists.txt
@@ -113,9 +113,9 @@ set(unit_hyperscan_SOURCES
)
add_executable(unit-hyperscan ${unit_hyperscan_SOURCES})
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
-target_link_libraries(unit-hyperscan hs_shared gtest expressionutil)
+target_link_libraries(unit-hyperscan hs_shared gtest expressionutil atomic)
else()
-target_link_libraries(unit-hyperscan hs gtest expressionutil)
+target_link_libraries(unit-hyperscan hs gtest expressionutil atomic)
endif()
#

View File

@ -21,7 +21,6 @@ define $(PKG)_BUILD
# Add the following options to run on (virtual) machine without AVX2
# -DCMAKE_C_FLAGS="-march=core2" -DCMAKE_CXX_FLAGS="-march=core2"
cd '$(1).build' && '$(TARGET)-cmake' \
-DCMAKE_C_FLAGS="-msse4" -DCMAKE_CXX_FLAGS="-msse4" \
-DRAGEL='$(PREFIX)/$(BUILD)/bin/ragel' \
'$(1)'
$(MAKE) -C '$(1).build' -j '$(JOBS)'