visualboyadvance-m/tools/builder/mingw.sh

374 lines
14 KiB
Bash
Raw Normal View History

#!/bin/sh
set -e
export CROSS_OS=windows
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
[ -n "$BUILD_ENV" ] && eval "$BUILD_ENV"
BUILD_ENV=$BUILD_ENV$(cat <<EOF
export CPPFLAGS="$CPPFLAGS${CPPFLAGS:+ }-DMINGW_HAS_SECURE_API"
export CFLAGS="$CFLAGS${CFLAGS:+ }-static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API -lm"
export CXXFLAGS="$CXXFLAGS${CXXFLAGS:+ }-static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API -lm"
export OBJCXXFLAGS="$OBJCXXFLAGS${OBJCXXFLAGS:+ }-static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API -lm"
export LDFLAGS="$LDFLAGS${LDFLAGS:+ }-static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API -lm"
export LIBS="-lpthread -lm"
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
export UUID_LIBS="-luuid_mingw -luuid"
export PKG_CONFIG="\$BUILD_ROOT/root/bin/pkg-config"
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
EOF
)
export BUILD_ENV
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
: ${HOST_CC:=ccache gcc}
: ${HOST_CXX:=ccache g++}
: ${HOST_CPPFLAGS:="-I\$BUILD_ROOT/root/include"}
: ${HOST_CFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -pthread -lm"}
: ${HOST_CXXFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread -lm"}
: ${HOST_OBJCXXFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread -lm"}
: ${HOST_LDFLAGS:="-fPIC -L\$BUILD_ROOT/root/lib -pthread -lm"}
: ${HOST_LIBS:=-lm}
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
: ${HOST_UUID_LIBS:=}
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
: ${HOST_STRIP:=strip}
. "$(dirname "$0")/../builder/core.sh"
# make separate roots for target and host for cross compiling
if [ ! -L "$BUILD_ROOT/root" ]; then
mv "$BUILD_ROOT/root" "$BUILD_ROOT/target"
mkdir "$BUILD_ROOT/host"
ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root"
cp -a "$BUILD_ROOT/target/"* "$BUILD_ROOT/host"
# share these for both roots
for d in perl5 share etc man doc; do
rmdir "$BUILD_ROOT/host/$d"
ln -s "$BUILD_ROOT/target/$d" "$BUILD_ROOT/host/$d"
done
mkdir "$BUILD_ROOT/host/bin" "$BUILD_ROOT/target/bin"
fi
ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root"
perl_dists="$perl_dists XML-NamespaceSupport XML-SAX-Base XML-SAX"
perl_dists=$(list_remove_duplicates $perl_dists)
host_dists="$host_dists autoconf autoconf-archive automake m4 gsed bison \
flex-2.6.3 flex c2man docbook2x ccache ninja"
host_dists=$(list_remove_duplicates $host_dists)
both_dists="$both_dists openssl zlib bzip2 libiconv"
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
if [ "$os" != windows ]; then
both_dists="$both_dists libuuid"
fi
both_dists=$(list_remove_duplicates $both_dists)
host_env_base() {
rm -f "$BUILD_ROOT/root"
ln -sf "$BUILD_ROOT/host" "$BUILD_ROOT/root"
host_env_hook 2>/dev/null || :
}
host_env() {
if [ -z "$OCC" ]; then
cat <<EOF
OCC="\$CC"
OCXX="\$CXX"
OCPPFLAGS="\$CPPFLAGS"
OCFLAGS="\$CFLAGS"
OCXXFLAGS="\$CXXFLAGS"
OOBJCXXFLAGS="\$OBJCXXFLAGS"
OLDFLAGS="\$LDFLAGS"
OLIBS="\$LIBS"
OUUID_LIBS="\$UUID_LIBS"
OSTRIP="\$STRIP"
OPATH="\$PATH"
$BUILD_ENV
export CC="$HOST_CC"
export CXX="$HOST_CXX"
export CPPFLAGS="$HOST_CPPFLAGS"
export CFLAGS="$HOST_CFLAGS"
export CXXFLAGS="$HOST_CXXFLAGS"
export OBJCXXFLAGS="$HOST_OBJCXXFLAGS"
export LDFLAGS="$HOST_LDFLAGS"
export LIBS="$HOST_LIBS"
export UUID_LIBS="$HOST_UUID_LIBS"
export STRIP="$HOST_STRIP"
export PATH="$BUILD_ROOT/host/bin:\$PATH"
OREQUIRED_CONFIGURE_ARGS="\$REQUIRED_CONFIGURE_ARGS"
OREQUIRED_CMAKE_ARGS="\$REQUIRED_CMAKE_ARGS"
REQUIRED_CONFIGURE_ARGS="\$(puts "\$REQUIRED_CONFIGURE_ARGS" | sed 's/--host[^ ]*//g')"
REQUIRED_CMAKE_ARGS="\$(puts "\$REQUIRED_CMAKE_ARGS" | sed 's/-DCMAKE_TOOLCHAIN_FILE=[^ ]*//g')"
EOF
fi
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
host_env_base 2>/dev/null || :
}
target_env_base() {
rm -f "$BUILD_ROOT/root"
ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root"
# make links to executables in the target as well
IFS=$NL
for exe in $(find "$BUILD_ROOT/host/bin" -maxdepth 1 -type f); do
IFS=$OIFS
basename=${exe##*/}
if ! path_exists "$BUILD_ROOT/target/bin/$basename"; then
ln -s "$exe" "$BUILD_ROOT/target/bin/$basename";
fi
done
IFS=$OIFS
target_env_hook 2>/dev/null || :
}
target_env() {
if [ -n "$OCC" ]; then
cat <<EOF
export CC="\$OCC"
export CXX="\$OCXX"
export CPPFLAGS="\$OCPPFLAGS"
export CFLAGS="\$OCFLAGS"
export CXXFLAGS="\$OCXXFLAGS"
export OBJCXXFLAGS="\$OOBJCXXFLAGS"
export LDFLAGS="\$OLDFLAGS"
export LIBS="\$OLIBS"
export UUID_LIBS="\$OUUID_LIBS"
export STRIP="\$OSTRIP"
export PATH="\$OPATH"
OCC= OCXX= OCPPFLAGS= OCFLAGS= OCXXFLAGS= OOBJCXXFLAGS= OLDFLAGS= OLIBS= OUUID_LIBS= OSTRIP= OPATH=
REQUIRED_CONFIGURE_ARGS="\$OREQUIRED_CONFIGURE_ARGS"
REQUIRED_CMAKE_ARGS="\$OREQUIRED_CMAKE_ARGS"
OREQUIRED_CONFIGURE_ARGS= OREQUIRED_CMAKE_ARGS=
$BUILD_ENV
EOF
fi
target_env_base 2>/dev/null || :
}
# replace install artifact paths with absolute paths into host and target trees
# so that the check for which dists are already built works correctly
pre_build_all() {
new_dists=
IFS=$NL
for dist in $DISTS; do
IFS=$OIFS
set -- $dist
case "$(table_line DIST_PRE_BUILD "$1")" in
*host_env*)
path="$BUILD_ROOT/host/$3"
;;
*)
path="$BUILD_ROOT/target/$3"
;;
esac
new_dists="$new_dists $1 $2 $path $NL"
done
IFS=$OIFS
DISTS=$new_dists
}
for dist in $host_dists $perl_dists; do
table_line_append DIST_PRE_BUILD $dist ':; eval "$(host_env)";'
table_line_replace DIST_POST_BUILD $dist "eval \"\$(target_env)\"; $(table_line DIST_POST_BUILD $dist)"
done
for dist in $both_dists; do
duplicate_dist $dist "${dist}-target"
table_line_append DIST_PRE_BUILD $dist ':; eval "$(host_env)";'
table_line_replace DIST_POST_BUILD $dist "eval \"\$(target_env)\"; $(table_line DIST_POST_BUILD $dist)"
done
remove_dists='graphviz python2 python3 meson swig libxml2-python doxygen bakefile setuptools pip XML-Parser intltool libsecret shared-mime-info'
for dist in $remove_dists; do
if ! list_contains $dist $do_not_remove_dists; then
table_line_remove DISTS "$dist"
fi
done
# build bzip2 for target with autotools patch
bzip2_target=$(table_line DISTS bzip2-target)
table_line_remove DISTS bzip2-target
table_insert_after DISTS libtool "bzip2-target $bzip2_target"
table_line_append DIST_PATCHES bzip2-target 'https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-bzip2/bzip2-buildsystem.all.patch'
table_line_remove DIST_MAKE_ARGS bzip2-target
# done with bzip2-target
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
# use mingw version of libuuid
if [ "$os" != windows ]; then
table_line_remove DISTS libuuid-target
table_insert_after DISTS libuuid "libuuid-target https://github.com/h0tw1r3/libuuid-mingw/archive/1.0.1.tar.gz lib/libuuid_mingw.a"
else
table_line_replace DISTS libuuid "https://github.com/h0tw1r3/libuuid-mingw/archive/1.0.1.tar.gz lib/libuuid_mingw.a"
fi
# done with libuuid
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
table_line_append DIST_PRE_BUILD zlib ":; \
sed -i.bak ' \
s/defined(_WIN32) *|| *defined(__CYGWIN__)/defined(_WIN32)/ \
' gzguts.h; \
"
table_line_append DIST_POST_BUILD zlib-target ":; \
rm -f \$BUILD_ROOT/root/lib/libz.dll.a \$BUILD_ROOT/root/bin/libz.dll; \
"
table_line_replace DIST_CONFIGURE_TYPES zlib-target cmake
table_line_append DIST_ARGS zlib-target -DUNIX=1
table_line_remove DIST_CONFIGURE_OVERRIDES zlib-target
zlib_dist=$(table_line DISTS zlib-target)
table_line_remove DISTS zlib-target
table_insert_after DISTS cmake "zlib-target $zlib_dist"
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
# mingw -ldl equivalent, needed by some things
table_insert_after DISTS cmake "dlfcn https://github.com/dlfcn-win32/dlfcn-win32/archive/v1.1.2.tar.gz lib/libdl.a"
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
table_line_replace DIST_CONFIGURE_TYPES dlfcn cmake
if [ "$target_bits" -eq 32 ]; then
# this is necessary for a linkable libffi on i686 for whatever reason
# see: https://bugzilla.mozilla.org/show_bug.cgi?id=1336569
table_line_append DIST_EXTRA_CPPFLAGS libffi -DSYMBOL_UNDERSCORE
fi
libicu=libicu
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
if [ -n "$(table_line DISTS libicu-target || :)" ]; then
libicu=libicu-target
fi
table_line_append DIST_PATCHES $libicu " \
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0004-move-to-bin.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0007-actually-move-to-bin.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0008-data-install-dir.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0009-fix-bindir-in-config.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0010-msys-rules-for-makefiles.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0011-sbin-dir.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0012-libprefix.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0015-debug.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0016-icu-pkgconfig.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0017-icu-config-versioning.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-icu/0021-mingw-static-libraries-without-s.patch \
"
table_line_append DIST_PRE_BUILD $libicu ":; sed -E -i.bak 's/@echo -n /@printf \"%s\" /g' config/mh-mingw*;"
table_insert_after DISTS libiconv-target '
catgets https://downloads.sourceforge.net/project/mingw/MinGW/Extension/catgets/mingw-catgets-1.0.1/mingw-catgets-1.0.1-src.tar.gz include/langinfo.h
'
table_line_append DIST_PATCHES catgets "\
https://gist.githubusercontent.com/rkitover/4fe26d4af9e20234ba7821100356b0a6/raw/1f11522e9feea3c2a431beca57fc3db07ca44a1c/mingw-catgets-mc_realloc-and-langinfo.patch \
"
table_line_append DIST_POST_BUILD catgets ":; \
rm -f \$BUILD_ROOT/root/lib/libcatgets.dll.a \$BUILD_ROOT/root/bin/libcatgets.dll; \
"
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
table_line_append DIST_PATCHES fontconfig-target " \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-fontconfig/0001-fix-config-linking.all.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-fontconfig/0002-fix-mkdir.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-fontconfig/0004-fix-mkdtemp.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-fontconfig/0005-fix-setenv.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-fontconfig/0007-pkgconfig.mingw.patch \
"
table_line_append DIST_PATCHES libgd 'https://gist.githubusercontent.com/rkitover/c64ea5b83ddea94ace58c40c7de42879/raw/fbaf4885fbefb302116b56626c0e191df514e8c6/libgd-2.2.4-mingw-static.patch'
table_insert_before DISTS sfml '
openal https://github.com/kcat/openal-soft/archive/openal-soft-1.19.1.tar.gz lib/libOpenAL32.a
'
table_line_append DIST_ARGS openal '-DLIBTYPE=STATIC -DALSOFT_UTILS=OFF -DALSOFT_EXAMPLES=OFF -DALSOFT_TESTS=OFF'
table_line_replace DIST_ARGS mp3lame "LDFLAGS='\$LDFLAGS \$BUILD_ROOT/root/lib/libcatgets.a'"
table_line_append DIST_POST_BUILD libgsm ":; \
rm -f \$BUILD_ROOT/root/lib/libgsm.dll.a \$BUILD_ROOT/root/bin/libgsm.dll; \
"
table_line_append DIST_POST_BUILD ffmpeg ":; \
sed -i.bak 's/-lSDL2main//g; s/-lstdc++//g; s/-lgcc_s//g; s/-lgcc//g; s/-lpthread//g' \$BUILD_ROOT/root/lib/pkgconfig/libav*.pc
"
table_line_append DIST_PRE_BUILD xvidcore ":; sed -i.bak 's/STATIC_LIB=\"xvidcore\\./STATIC_LIB=\"libxvidcore./; \
s/SHARED_LIB=\"xvidcore\\./SHARED_LIB=\"libxvidcore./' configure.in; \
"
table_line_replace DIST_CONFIGURE_TYPES xvidcore autoreconf
# this was my attempt to fix the problem with msys paths in the perl configs, but does not help
# so the doc dir is removed from expat
#table_line_append DIST_POST_CONFIGURE docbook2x ":; sed -i.bak 's,q</c/,q<c:/,; /xsltproc-program'\\''/{ s/\([a-z]\)>, *$/\1.exe>,/; }' perl/config.pl;"
table_line_append DIST_ARGS libsoxr '-DWITH_OPENMP=NO'
table_line_append DIST_ARGS ffmpeg "--extra-ldflags='-Wl,-allow-multiple-definition' --extra-libs='-lwsock32 -lws2_32 -liphlpapi -lfreetype'"
table_line_append DIST_ARGS gettext "--enable-threads=windows"
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
table_line_append DIST_ARGS glib "--with-threads=posix --disable-libelf"
table_line_append DIST_PATCHES glib "\
https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-glib2/0001-Update-g_fopen-g_open-and-g_creat-to-open-with-FILE_.patch \
builder: support gentoo crossdev + misc fixes Support the gentoo crossdev mingw environment for the mingw cross builder: - For the cmake toolchains, add /usr/<arch>/usr to root paths, as this is the mingw root for crossdev. - -Wno-error=all no longer works with gcc 8.2, instead remove all -Werror flags in dist_post_configure(). - Also remove all -I/usr/include flags in dist_post_configure(). - Don't prepend ROOT/host/bin to the PATH globally, only in set_host_env(). This way the target config scripts are correctly found in PATH. - Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 -> 2.2.5 and glib 2.57.2 -> 2.58.1. - Add libicu unicode handling library, needed by some deps. Put into the list of dists that must be built for both the host and the target. Use a whole bunch of patches from MSys2 for it. - Make openssl build in parallel by using a sed script to prepend a + to the appropriate make rules. - Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv" because these libs were being stripped out from LIBS and LDFLAGS. - Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see compile/link invocations.) - As a consequence, use dist_ninja_args() for ninja, it will still take options in DIST_MAKE_ARGS. - Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except with -G Ninja to use the ninja generator and built with ninja. Nothing uses this yet. - Fix dist_patch() output for already applied patches. - Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS, because crossdev libpthreads.a is in that directory and it's not in gcc search paths. It cannot go into CPPFLAGS because those are used for windres invocations, and windres errors out with non-cpp flags. - Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the mingw headers in crossdev. - Add -lpthread to a default LIBS env var so that it's often linked last against any libraries that may need it, at least for autoconf. - Set the PKG_CONFIG env var to the path of the built pkg-config binary, not exactly sure why this was necessary. - Overhaul environment variable saving/restoring for set_host_env() so that more variables are covered and have good host defaults. - Add the dlfcn-win32 for mingw for dependencies that need -ldl. - Add some MSys2 patches for fontconfig. - Use a sed script to fix the native tools compilation when cross compiling openal. - Replace the fedora glib patches for mingw with MSys2 ones for the newer glib. - Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
2018-10-11 13:55:53 +00:00
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-glib2/0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch \
https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-glib2/0001-disable-some-tests-when-static.patch \
support mac-hosted mingw builds, misc. fixes - Add the cross root from the mingw-w64 mac brew to the cmake toolchain files. - Remove strerror_r/strerror_s from ConfigManager.cpp because the mingw-w64 brew does not support strerror_s for some reason. - Strip the vbam executable from the builder script in the build_project phase. - Change the bzip2 URL to the github mirror because the bzip.org domain expired. - Add libuuid as it's required by the new fontconfig, use the mingw version for mingw builds, for mingw also set UUID_LIBS to '-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version is called uuid_mingw because uuid is a core win32 library. - Lower glib version to 2.57.2 stable. - Update wxwidgets version to current master sha. - Fix a bug in flex-2.5.3 post_build where it tries to build flex current but flex has been removed, and it was just rebuilding 2.5.3. - Fix "aggressive" relocation and the relocation of .l[ao] and .pc files in install_dist to ignore /usr/local, and only match /usr. - Add a "project" pre_build and post_build hooks. - Add getopt to host-only dists in mingw-cross.sh. - Use perl instead of readlink -f to get the absolute path of the cmake toolchain files in mingw-cross.sh, as readlink -f is linux-only. - In mingw-cross.sh, replace the glib post_build to rebuild gettext-target instead of gettext --without-included-glib. - Add overridable functions set_host_env_hook and unset_host_env_hook in mingw.sh to override in other scripts, in this case mac-cross-builder. - Update mingw glib patches to current fedora versions. - Add tools/win/mac-cross-builder script to build mingw windows binaries on mac, it borrows some necessary parts from the mac native builder for host dists, and inherits from mingw-cross.sh. TODO: currently the resulting mac-built binary segfaults due to gcc 8.2.0, just as the msys2-built binary does, this is a separate issue.
2018-08-09 12:24:12 +00:00
https://gist.githubusercontent.com/rkitover/2edaf9583fb3068bb14016571e6f7d01/raw/ece80116d5618f372464f02392a9bcab670ce6c1/glib-mingw-no-strerror_s.patch \
"
table_line_append DIST_PATCHES graphite2 "\
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-graphite2/001-graphite2-1.3.8-win64.patch \
"
table_line_append DIST_PATCHES libgsm "\
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-gsm/0001-adapt-makefile-to.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-gsm/0002-adapt-config-h-to.mingw.patch \
https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-gsm/0003-fix-ln.mingw.patch \
"
table_line_append DIST_PATCHES libtheora "\
http://src.fedoraproject.org/cgit/rpms/mingw-libtheora.git/plain/mingw-libtheora-1.1.1-rint.patch?id=a35cf93c3068ed4c8a59691a3cf129766d875444 \
"
table_line_append DIST_PRE_BUILD wxwidgets ":; \
if path_exists \$BUILD_ROOT/root/include/langinfo.h; then \
mv \$BUILD_ROOT/root/include/langinfo.h \$BUILD_ROOT/root/include/langinfo.bak; \
fi;
"
table_line_append DIST_POST_BUILD wxwidgets ":; \
if path_exists \$BUILD_ROOT/root/include/langinfo.bak; then \
mv \$BUILD_ROOT/root/include/langinfo.bak \$BUILD_ROOT/root/include/langinfo.h; \
fi;
"