diff --git a/patches/gcc/5.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch b/patches/gcc/5.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch new file mode 100644 index 00000000..d8986d5f --- /dev/null +++ b/patches/gcc/5.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch @@ -0,0 +1,160 @@ +diff -urN gcc-5.3.0.orig/config/gcc-plugin.m4 gcc-5.3.0/config/gcc-plugin.m4 +--- gcc-5.3.0.orig/config/gcc-plugin.m4 2015-12-19 14:39:04.120734900 +0000 ++++ gcc-5.3.0/config/gcc-plugin.m4 2015-12-20 01:28:45.381965300 +0000 +@@ -20,6 +20,9 @@ + + pluginlibs= + ++ PICFLAG="-fPIC" ++ UNDEFINEDPREAMBLE="extern int X;" ++ UNDEFINEDCODE="return X == 0;" + case "${host}" in + *-*-darwin*) + if test x$build = x$host; then +@@ -30,6 +33,11 @@ + export_sym_check= + fi + ;; ++ *-*-mingw*|*-*-cygwin*|*-*-msys*) ++ PICFLAG="" ++ UNDEFINEDPREAMBLE="" ++ UNDEFINEDCODE="" ++ ;; + *) + if test x$build = x$host; then + export_sym_check="objdump${exeext} -T" +@@ -81,17 +89,17 @@ + case "${host}" in + *-*-darwin*) + CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` +- CFLAGS="$CFLAGS -fPIC" ++ CFLAGS="$CFLAGS ${PICFLAG}" + LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" + ;; + *) +- CFLAGS="$CFLAGS -fPIC" +- LDFLAGS="$LDFLAGS -fPIC -shared" ++ CFLAGS="$CFLAGS ${PICFLAG}" ++ LDFLAGS="$LDFLAGS ${PICFLAG} -shared" + ;; + esac +- AC_MSG_CHECKING([for -fPIC -shared]) ++ AC_MSG_CHECKING([for ${PICFLAG} -shared]) + AC_TRY_LINK( +- [extern int X;],[return X == 0;], ++ [${UNDEFINEDPREAMBLE}],[${UNDEFINEDCODE}], + [AC_MSG_RESULT([yes]); have_pic_shared=yes], + [AC_MSG_RESULT([no]); have_pic_shared=no]) + if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then +diff -urN gcc-5.3.0.orig/gcc/configure gcc-5.3.0/gcc/configure +--- gcc-5.3.0.orig/gcc/configure 2015-12-19 14:40:16.893975900 +0000 ++++ gcc-5.3.0/gcc/configure 2015-12-20 01:28:45.472476700 +0000 +@@ -28386,6 +28386,9 @@ + + pluginlibs= + ++ PICFLAG="-fPIC" ++ UNDEFINEDPREAMBLE="extern int X;" ++ UNDEFINEDCODE="return X == 0;" + case "${host}" in + *-*-darwin*) + if test x$build = x$host; then +@@ -28396,6 +28399,11 @@ + export_sym_check= + fi + ;; ++ *-*-mingw*|*-*-cygwin*|*-*-msys*) ++ PICFLAG="" ++ UNDEFINEDPREAMBLE="" ++ UNDEFINEDCODE="" ++ ;; + *) + if test x$build = x$host; then + export_sym_check="objdump${exeext} -T" +@@ -28508,23 +28516,23 @@ + case "${host}" in + *-*-darwin*) + CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` +- CFLAGS="$CFLAGS -fPIC" ++ CFLAGS="$CFLAGS ${PICFLAG}" + LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" + ;; + *) +- CFLAGS="$CFLAGS -fPIC" +- LDFLAGS="$LDFLAGS -fPIC -shared" ++ CFLAGS="$CFLAGS ${PICFLAG}" ++ LDFLAGS="$LDFLAGS ${PICFLAG} -shared" + ;; + esac +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fPIC -shared" >&5 +-$as_echo_n "checking for -fPIC -shared... " >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${PICFLAG} -shared" >&5 ++$as_echo_n "checking for ${PICFLAG} -shared... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-extern int X; ++${UNDEFINEDPREAMBLE} + int + main () + { +-return X == 0; ++${UNDEFINEDCODE} + ; + return 0; + } +diff -urN gcc-5.3.0.orig/libcc1/configure gcc-5.3.0/libcc1/configure +--- gcc-5.3.0.orig/libcc1/configure 2015-12-19 14:40:20.855979000 +0000 ++++ gcc-5.3.0/libcc1/configure 2015-12-20 01:28:45.504980900 +0000 +@@ -14500,6 +14500,9 @@ + + pluginlibs= + ++ PICFLAG="-fPIC" ++ UNDEFINEDPREAMBLE="extern int X;" ++ UNDEFINEDCODE="return X == 0;" + case "${host}" in + *-*-darwin*) + if test x$build = x$host; then +@@ -14510,6 +14513,11 @@ + export_sym_check= + fi + ;; ++ *-*-mingw*|*-*-cygwin*|*-*-msys*) ++ PICFLAG="" ++ UNDEFINEDPREAMBLE="" ++ UNDEFINEDCODE="" ++ ;; + *) + if test x$build = x$host; then + export_sym_check="objdump${exeext} -T" +@@ -14622,23 +14630,23 @@ + case "${host}" in + *-*-darwin*) + CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` +- CFLAGS="$CFLAGS -fPIC" ++ CFLAGS="$CFLAGS ${PICFLAG}" + LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" + ;; + *) +- CFLAGS="$CFLAGS -fPIC" +- LDFLAGS="$LDFLAGS -fPIC -shared" ++ CFLAGS="$CFLAGS ${PICFLAG}" ++ LDFLAGS="$LDFLAGS ${PICFLAG} -shared" + ;; + esac +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fPIC -shared" >&5 +-$as_echo_n "checking for -fPIC -shared... " >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${PICFLAG} -shared" >&5 ++$as_echo_n "checking for ${PICFLAG} -shared... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-extern int X; ++${UNDEFINEDPREAMBLE} + int + main () + { +-return X == 0; ++${UNDEFINEDCODE} + ; + return 0; + } diff --git a/patches/gcc/5.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch b/patches/gcc/5.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch new file mode 100644 index 00000000..12ef48ee --- /dev/null +++ b/patches/gcc/5.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch @@ -0,0 +1,11 @@ +diff -urN gcc-5.3.0.orig/libcc1/connection.cc gcc-5.3.0/libcc1/connection.cc +--- gcc-5.3.0.orig/libcc1/connection.cc 2015-12-19 14:40:20.860479600 +0000 ++++ gcc-5.3.0/libcc1/connection.cc 2015-12-20 01:31:04.346611500 +0000 +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include "marshall.hh" diff --git a/scripts/build/companion_libs/200-libelf.sh b/scripts/build/companion_libs/200-libelf.sh index 58aa3155..529bba22 100644 --- a/scripts/build/companion_libs/200-libelf.sh +++ b/scripts/build/companion_libs/200-libelf.sh @@ -135,6 +135,13 @@ do_libelf_backend() { CT_DoExecLog ALL ${make} CT_DoLog EXTRA "Installing libelf" + + # Guard against $destdir$prefix == // + # which is a UNC path on Cygwin/MSYS2 + if [[ ${destdir} == / ]] && [[ ${prefix} == /* ]]; then + destdir= + fi + CT_DoExecLog ALL ${make} instroot="${destdir}" install } diff --git a/scripts/build/companion_libs/210-expat.sh b/scripts/build/companion_libs/210-expat.sh old mode 100644 new mode 100755 index 304482cd..7801d339 --- a/scripts/build/companion_libs/210-expat.sh +++ b/scripts/build/companion_libs/210-expat.sh @@ -22,13 +22,18 @@ if [ "${CT_EXPAT}" = "y" ]; then # Do not need expat for build at this time. do_expat_for_host() { + local -a expat_opts + CT_DoStep INFO "Installing expat for host" CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-host-${CT_HOST}" - do_expat_backend host="${CT_HOST}" \ - prefix="${CT_HOST_COMPLIBS_DIR}" \ - cflags="${CT_CFLAGS_FOR_HOST}" \ - ldflags="${CT_LDFLAGS_FOR_HOST}" + expat_opts+=( "host=${CT_HOST}" ) + expat_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" ) + expat_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + expat_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) + expat_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" ) + + do_expat_backend "${expat_opts[@]}" CT_Popd CT_EndStep @@ -37,12 +42,17 @@ fi if [ "${CT_EXPAT_TARGET}" = "y" ]; then do_expat_for_target() { + local -a expat_opts + CT_DoStep INFO "Installing expat for target" CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}" - do_expat_backend host="${CT_TARGET}" \ - prefix="/usr" \ - destdir="${CT_SYSROOT_DIR}" + expat_opts+=( "host=${CT_TARGET}" ) + expat_opts+=( "prefix=/usr" ) + expat_opts+=( "destdir=${CT_SYSROOT_DIR}" ) + expat_opts+=( "static_build=y" ) + + do_expat_backend "${expat_opts[@]}" CT_Popd CT_EndStep @@ -60,11 +70,17 @@ do_expat_backend() { local cflags local ldflags local arg + local -a extra_config for arg in "$@"; do eval "${arg// /\\ }" done + if [ "${static_build}" = "y" ]; then + extra_config+=("--disable-shared") + extra_config+=("--enable-static") + fi + CT_DoLog EXTRA "Configuring expat" CT_DoExecLog CFG \ @@ -74,8 +90,7 @@ do_expat_backend() { --build=${CT_BUILD} \ --host=${host} \ --prefix="${prefix}" \ - --enable-static \ - --disable-shared + "${extra_config[@]}" CT_DoLog EXTRA "Building expat" CT_DoExecLog ALL ${make} ${JOBSFLAGS} diff --git a/scripts/build/companion_libs/320-libiconv.sh b/scripts/build/companion_libs/320-libiconv.sh index 06908b54..0c9e5cf6 100644 --- a/scripts/build/companion_libs/320-libiconv.sh +++ b/scripts/build/companion_libs/320-libiconv.sh @@ -102,6 +102,7 @@ do_libiconv_backend() { --build=${CT_BUILD} \ --host="${host}" \ --prefix="${prefix}" \ + --disable-nls \ "${extra_config[@]}" \ CT_DoLog EXTRA "Building libiconv"