diff options
author | Bryan Hundven <bryanhundven@gmail.com> | 2015-11-12 21:50:31 -0800 |
---|---|---|
committer | Bryan Hundven <bryanhundven@gmail.com> | 2015-11-12 21:50:31 -0800 |
commit | 57de8dcf22d5ddddee6a44f87f45f2c279fdb1ac (patch) | |
tree | 9477fd0a23bbe297fd11178b7ed6cd8c3c8a268a /scripts | |
parent | 4c9218d51dc3c6c84a8d5c488f234ed7575107c6 (diff) | |
parent | 5f3774cd656ba54200cb192fc1454c5232347b70 (diff) | |
download | crosstool-ng-57de8dcf22d5ddddee6a44f87f45f2c279fdb1ac.tar.gz crosstool-ng-57de8dcf22d5ddddee6a44f87f45f2c279fdb1ac.tar.bz2 crosstool-ng-57de8dcf22d5ddddee6a44f87f45f2c279fdb1ac.zip |
Merge pull request #239 from diorcety-ctng/cc-cygwin-mingw-linux
Canadian cross build = x86_64 Cygwin host = x86_64 MinGW_W64 target = x86_64 GNU/Linux
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build/companion_libs/320-libiconv.sh | 113 | ||||
-rwxr-xr-x | scripts/build/companion_libs/330-gettext.sh | 136 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/build/companion_tools/400-libtool.sh | 2 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 14 |
4 files changed, 264 insertions, 1 deletions
diff --git a/scripts/build/companion_libs/320-libiconv.sh b/scripts/build/companion_libs/320-libiconv.sh new file mode 100755 index 00000000..e8417e91 --- /dev/null +++ b/scripts/build/companion_libs/320-libiconv.sh @@ -0,0 +1,113 @@ +# Build script for libiconv + +do_libiconv_get() { :; } +do_libiconv_extract() { :; } +do_libiconv_for_build() { :; } +do_libiconv_for_host() { :; } + +if [ "${CT_LIBICONV}" = "y" ]; then + +do_libiconv_get() { + CT_GetFile "libiconv-${CT_LIBICONV_VERSION}" \ + http://ftp.gnu.org/pub/gnu/libiconv/ +} + +do_libiconv_extract() { + CT_Extract "libiconv-${CT_LIBICONV_VERSION}" + CT_Patch "libiconv" "${CT_LIBICONV_VERSION}" +} + +# Build libiconv for running on build +do_libiconv_for_build() { + local -a libiconv_opts + + case "$CT_BUILD" in + *darwin*|*linux*) + return 0 + ;; + esac + + CT_DoStep INFO "Installing libiconv for build" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libiconv-build-${CT_BUILD}" + + libiconv_opts+=( "host=${CT_BUILD}" ) + libiconv_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) + libiconv_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" ) + libiconv_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" ) + libiconv_opts+=( "static_build=y" ) + do_libiconv_backend "${libiconv_opts[@]}" + + CT_Popd + CT_EndStep +} + +# Build libiconv for running on host +do_libiconv_for_host() { + local -a libiconv_opts + + case "$CT_HOST" in + *darwin*|*linux*) + return 0 + ;; + esac + + CT_DoStep INFO "Installing libiconv for host" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libiconv-host-${CT_HOST}" + + libiconv_opts+=( "host=${CT_HOST}" ) + libiconv_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" ) + libiconv_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + libiconv_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) + libiconv_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" ) + do_libiconv_backend "${libiconv_opts[@]}" + + CT_Popd + CT_EndStep +} + +# Build libiconv +# Parameter : description : type : default +# host : machine to run on : tuple : (none) +# prefix : prefix to install into : dir : (none) +# static_build : build statically : bool : no +# cflags : host cflags to use : string : (empty) +# ldflags : host ldflags to use : string : (empty) +do_libiconv_backend() { + local host + local prefix + local static_build + local cflags + local ldflags + local arg + local -a extra_config + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + CT_DoLog EXTRA "Configuring libiconv" + + CT_DoExecLog ALL cp -aT "${CT_SRC_DIR}/libiconv-${CT_LIBICONV_VERSION}" "." + + if [ "${static_build}" = "y" ]; then + extra_config+=("--disable-shared") + extra_config+=("--enable-static") + fi + + CT_DoExecLog CFG \ + CFLAGS="${cflags}" \ + LDFLAGS="${ldflags}" \ + "${CT_SRC_DIR}/libiconv-${CT_LIBICONV_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host="${host}" \ + --prefix="${prefix}" \ + "${extra_config[@]}" \ + + CT_DoLog EXTRA "Building libiconv" + CT_DoExecLog ALL make CC="${host}-gcc ${cflags}" ${JOBSFLAGS} + + CT_DoLog EXTRA "Installing libiconv" + CT_DoExecLog ALL make install CC="${host}-gcc ${cflags}" +} + +fi diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh new file mode 100755 index 00000000..5a3f461e --- /dev/null +++ b/scripts/build/companion_libs/330-gettext.sh @@ -0,0 +1,136 @@ +# Build script for gettext + +do_gettext_get() { :; } +do_gettext_extract() { :; } +do_gettext_for_build() { :; } +do_gettext_for_host() { :; } + +if [ "${CT_GETTEXT}" = "y" ]; then + +do_gettext_get() { + CT_GetFile "gettext-${CT_GETTEXT_VERSION}" \ + http://ftp.gnu.org/pub/gnu/gettext/ +} + +do_gettext_extract() { + CT_Extract "gettext-${CT_GETTEXT_VERSION}" + CT_Patch "gettext" "${CT_GETTEXT_VERSION}" +} + +# Build gettext for running on build +do_gettext_for_build() { + local -a gettext_opts + + case "$CT_BUILD" in + *linux*) + return 0 + ;; + esac + + CT_DoStep INFO "Installing gettext for build" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-gettext-build-${CT_BUILD}" + + gettext_opts+=( "host=${CT_BUILD}" ) + gettext_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) + gettext_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" ) + gettext_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" ) + gettext_opts+=( "static_build=y" ) + do_gettext_backend "${gettext_opts[@]}" + + CT_Popd + CT_EndStep +} + +# Build gettext for running on host +do_gettext_for_host() { + local -a gettext_opts + + case "$CT_HOST" in + *linux*) + return 0 + ;; + esac + + CT_DoStep INFO "Installing gettext for host" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-gettext-host-${CT_HOST}" + + gettext_opts+=( "host=${CT_HOST}" ) + gettext_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" ) + gettext_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + gettext_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) + gettext_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" ) + do_gettext_backend "${gettext_opts[@]}" + + CT_Popd + CT_EndStep +} + +# Build gettext +# Parameter : description : type : default +# host : machine to run on : tuple : (none) +# prefix : prefix to install into : dir : (none) +# static_build : build statically : bool : no +# cflags : host cflags to use : string : (empty) +# ldflags : host ldflags to use : string : (empty) +do_gettext_backend() { + local host + local prefix + local static_build + local cflags + local ldflags + local arg + local -a extra_config + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + CT_DoLog EXTRA "Configuring gettext" + + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/gettext-${CT_GETTEXT_VERSION}/"/* . + + # A bit ugly. D__USE_MINGW_ANSI_STDIO=1 has its own {v}asprintf functions + # but gettext configure doesn't see this flag when it checks for that. An + # alternative may be to use CC="${host}-gcc ${cflags}" but that didn't + # work. + # -O2 works around bug at http://savannah.gnu.org/bugs/?36443 + # gettext needs some fixing for MinGW-w64 it would seem. + case "${host}" in + *mingw*) + case "${cflags}" in + *D__USE_MINGW_ANSI_STDIO=1*) + extra_config+=( --disable-libasprintf ) + ;; + esac + extra_config+=( --enable-threads=win32 ) + cflags=$cflags" -O2" + ;; + esac + + if [ "${static_build}" = "y" ]; then + extra_config+=("--disable-shared") + extra_config+=("--enable-static") + fi + + CT_DoExecLog CFG \ + CFLAGS="${cflags}" \ + LDFLAGS="${ldflags}" \ + "${CT_SRC_DIR}/gettext-${CT_GETTEXT_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host="${host}" \ + --prefix="${prefix}" \ + --disable-java \ + --disable-native-java \ + --disable-csharp \ + --without-emacs \ + --disable-openmp \ + "${extra_config[@]}" + + CT_DoLog EXTRA "Building gettext" + CT_DoExecLog ALL make ${JOBSFLAGS} + + CT_DoLog EXTRA "Installing gettext" + CT_DoExecLog ALL make install +} + +fi diff --git a/scripts/build/companion_tools/400-libtool.sh b/scripts/build/companion_tools/400-libtool.sh index 9ddf00f7..43d1f053 100644..100755 --- a/scripts/build/companion_tools/400-libtool.sh +++ b/scripts/build/companion_tools/400-libtool.sh @@ -1,6 +1,6 @@ # Build script for libtool -CT_LIBTOOL_VERSION=2.2.6b +CT_LIBTOOL_VERSION=2.4.6 do_companion_tools_libtool_get() { CT_GetFile "libtool-${CT_LIBTOOL_VERSION}" \ diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 6a840174..cfdacf0b 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -377,6 +377,20 @@ do_libc_backend_once() { CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}" extra_make_args+=( "BUILD_CFLAGS=${CT_CFLAGS_FOR_BUILD}" "BUILD_LDFLAGS=${CT_LDFLAGS_FOR_BUILD}" ) + case "$CT_BUILD" in + *mingw*|*cygwin*|*msys*) + # When installing headers on Cygwin, MSYS2 and MinGW-w64 sunrpc needs + # gettext for building cross-rpcgen. + extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" ) + extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -Wl,-Bstatic -lintl -liconv -Wl,-Bdynamic" ) + ;; + *darwin*) + # .. and the same goes for Darwin. + extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" ) + extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -lintl" ) + ;; + esac + if [ "${libc_headers}" = "y" ]; then CT_DoLog EXTRA "Installing C library headers" |