visualboyadvance-m/tools/win/mac-cross-builder

41 lines
1.8 KiB
Plaintext
Raw Normal View History

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
#!/usr/local/bin/bash
set -e
TAR=tar
. "${0%/*}/../builder/mingw-cross.sh"
set_host_env_hook() {
export COMMAND_MODE=unix2003
export CC='ccache clang'
export CXX='ccache clang++'
export CC_ORIG=clang
export CXX_ORIG=clang++
export CPPFLAGS="-I$BUILD_ROOT/root/include -DICONV_CONST="
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
export CFLAGS="-fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export CXXFLAGS="-fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export OBJCXXFLAGS="-fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export LDFLAGS="-fPIC -L$BUILD_ROOT/root/lib -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -Wl,-no_compact_unwind"
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
}
unset_host_env_hook() {
unset COMMAND_MODE
}
table_line_remove DISTS flex
table_line_remove DISTS libsecret
# issues with perl modules linked to our libs and brew perl
table_line_remove DISTS shared-mime-info
# -Wl,-no_compact_unwind must be passed in LDFLAGS to openssl
table_line_append DIST_MAKE_ARGS openssl "LDFLAGS=\"\$LDFLAGS\""
table_line_replace DIST_CONFIGURE_OVERRIDES openssl './Configure darwin64-x86_64-cc no-shared --prefix=/usr --openssldir=/etc/ssl'
# m4 crashes on 10.13
table_line_append DIST_PATCHES m4 '-p0 https://raw.githubusercontent.com/macports/macports-ports/edf0ee1e2cf/devel/m4/files/secure_snprintf.patch'
builder "$@"