Merge pull request #291 from diorcety-ctng/cygwin-more-fixes

Cygwin more fixes
This commit is contained in:
Bryan Hundven 2016-01-03 08:10:24 -08:00
commit 9375a9e411
5 changed files with 203 additions and 9 deletions

View File

@ -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;
}

View File

@ -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 <string>
#include <unistd.h>
#include <sys/types.h>
+#include <sys/select.h>
#include <string.h>
#include <errno.h>
#include "marshall.hh"

View File

@ -135,6 +135,13 @@ do_libelf_backend() {
CT_DoExecLog ALL ${make} CT_DoExecLog ALL ${make}
CT_DoLog EXTRA "Installing libelf" 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 CT_DoExecLog ALL ${make} instroot="${destdir}" install
} }

33
scripts/build/companion_libs/210-expat.sh Normal file → Executable file
View File

@ -22,13 +22,18 @@ if [ "${CT_EXPAT}" = "y" ]; then
# Do not need expat for build at this time. # Do not need expat for build at this time.
do_expat_for_host() { do_expat_for_host() {
local -a expat_opts
CT_DoStep INFO "Installing expat for host" CT_DoStep INFO "Installing expat for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-host-${CT_HOST}" CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-host-${CT_HOST}"
do_expat_backend host="${CT_HOST}" \ expat_opts+=( "host=${CT_HOST}" )
prefix="${CT_HOST_COMPLIBS_DIR}" \ expat_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
cflags="${CT_CFLAGS_FOR_HOST}" \ expat_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
ldflags="${CT_LDFLAGS_FOR_HOST}" expat_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
expat_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
do_expat_backend "${expat_opts[@]}"
CT_Popd CT_Popd
CT_EndStep CT_EndStep
@ -37,12 +42,17 @@ fi
if [ "${CT_EXPAT_TARGET}" = "y" ]; then if [ "${CT_EXPAT_TARGET}" = "y" ]; then
do_expat_for_target() { do_expat_for_target() {
local -a expat_opts
CT_DoStep INFO "Installing expat for target" CT_DoStep INFO "Installing expat for target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}" CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}"
do_expat_backend host="${CT_TARGET}" \ expat_opts+=( "host=${CT_TARGET}" )
prefix="/usr" \ expat_opts+=( "prefix=/usr" )
destdir="${CT_SYSROOT_DIR}" expat_opts+=( "destdir=${CT_SYSROOT_DIR}" )
expat_opts+=( "static_build=y" )
do_expat_backend "${expat_opts[@]}"
CT_Popd CT_Popd
CT_EndStep CT_EndStep
@ -60,11 +70,17 @@ do_expat_backend() {
local cflags local cflags
local ldflags local ldflags
local arg local arg
local -a extra_config
for arg in "$@"; do for arg in "$@"; do
eval "${arg// /\\ }" eval "${arg// /\\ }"
done done
if [ "${static_build}" = "y" ]; then
extra_config+=("--disable-shared")
extra_config+=("--enable-static")
fi
CT_DoLog EXTRA "Configuring expat" CT_DoLog EXTRA "Configuring expat"
CT_DoExecLog CFG \ CT_DoExecLog CFG \
@ -74,8 +90,7 @@ do_expat_backend() {
--build=${CT_BUILD} \ --build=${CT_BUILD} \
--host=${host} \ --host=${host} \
--prefix="${prefix}" \ --prefix="${prefix}" \
--enable-static \ "${extra_config[@]}"
--disable-shared
CT_DoLog EXTRA "Building expat" CT_DoLog EXTRA "Building expat"
CT_DoExecLog ALL ${make} ${JOBSFLAGS} CT_DoExecLog ALL ${make} ${JOBSFLAGS}

View File

@ -102,6 +102,7 @@ do_libiconv_backend() {
--build=${CT_BUILD} \ --build=${CT_BUILD} \
--host="${host}" \ --host="${host}" \
--prefix="${prefix}" \ --prefix="${prefix}" \
--disable-nls \
"${extra_config[@]}" \ "${extra_config[@]}" \
CT_DoLog EXTRA "Building libiconv" CT_DoLog EXTRA "Building libiconv"