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.
This commit is contained in:
Rafael Kitover 2018-08-09 05:24:12 -07:00
parent e32e7c5de2
commit 571ecbe3e8
7 changed files with 146 additions and 39 deletions

View File

@ -1,6 +1,7 @@
SET(CMAKE_SYSTEM_NAME Windows)
set(COMPILER_PREFIX "i686-w64-mingw32")
set(CROSS_ARCH i686)
set(COMPILER_PREFIX "${CROSS_ARCH}-w64-mingw32")
unset(CMAKE_RC_COMPILER CACHE)
unset(CMAKE_C_COMPILER CACHE)
@ -12,7 +13,7 @@ find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/sys-root/mingw)
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/sys-root/mingw /usr/local/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX})
if(CMAKE_PREFIX_PATH)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH})

View File

@ -1,6 +1,7 @@
SET(CMAKE_SYSTEM_NAME Windows)
set(COMPILER_PREFIX "x86_64-w64-mingw32")
set(CROSS_ARCH x86_64)
set(COMPILER_PREFIX "${CROSS_ARCH}-w64-mingw32")
unset(CMAKE_RC_COMPILER CACHE)
unset(CMAKE_C_COMPILER CACHE)
@ -12,7 +13,7 @@ find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/sys-root/mingw)
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/sys-root/mingw /usr/local/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX})
if(CMAKE_PREFIX_PATH)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH})

View File

@ -763,11 +763,7 @@ void SaveConfigFile()
FILE *f = fopen(configFile, "w");
if (f == NULL) {
char err_msg[4096] = "unknown error";
#ifdef _WIN32
strerror_s(err_msg, errno, 4096);
#else
strerror_r(errno, err_msg, 4096);
#endif
strncpy(err_msg, strerror(errno), 4096);
fprintf(stderr, "Configuration file '%s' could not be written to: %s\n", configFile, err_msg);
return;
}

View File

@ -48,6 +48,7 @@ export CFLAGS="$CFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -
export CXXFLAGS="$CXXFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -Wno-error=all -fpermissive"
export OBJCXXFLAGS="$OBJCXXFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -Wno-error=all -fpermissive"
export LDFLAGS="$LDFLAGS -fPIC -L$BUILD_ROOT/root/lib -Wno-error=all"
export STRIP="${STRIP:-strip}"
if [ -z "\$OPENMP" ] && echo "\$CC" | grep -Eq gcc; then
export CFLAGS="\$CFLAGS -fopenmp"
@ -110,7 +111,7 @@ eval "$BUILD_ENV"
PRE_BUILD_DISTS="$PRE_BUILD_DISTS bzip2 xz unzip"
DISTS=$DISTS'
bzip2 http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz lib/libbz2.a
bzip2 https://github.com/nemequ/bzip2/releases/download/v1.0.6/bzip2-1.0.6.tar.gz lib/libbz2.a
xz https://tukaani.org/xz/xz-5.2.3.tar.gz lib/liblzma.a
unzip https://downloads.sourceforge.net/project/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/unzip60.tar.gz bin/unzip
zip https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz bin/zip
@ -151,6 +152,7 @@ DISTS=$DISTS'
libjpeg-turbo https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.5.2.tar.gz lib/libjpeg.a
libtiff http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz lib/libtiff.a
# libcroco http://ftp.gnome.org/pub/gnome/sources/libcroco/0.6/libcroco-0.6.12.tar.xz lib/libcroco-0.6.a
libuuid https://downloads.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz lib/libuuid.a
freetype http://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.bz2 lib/libfreetype.a
fontconfig https://freedesktop.org/software/fontconfig/release/fontconfig-2.13.0.tar.bz2 lib/libfontconfig.a
libgd https://github.com/libgd/libgd/releases/download/gd-2.2.4/libgd-2.2.4.tar.xz lib/libgd.a
@ -176,7 +178,7 @@ DISTS=$DISTS'
intltool https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz bin/intltoolize
ninja https://github.com/ninja-build/ninja/archive/v1.8.2.tar.gz bin/ninja
meson https://github.com/mesonbuild/meson/releases/download/0.44.0/meson-0.44.0.tar.gz bin/meson
glib https://github.com/GNOME/glib/archive/8213793f341e6052d04aa24bba7bcf1be3e25ed5.tar.gz lib/libglib-2.0.a
glib https://github.com/GNOME/glib/archive/2.57.2.tar.gz lib/libglib-2.0.a
libgpg-error https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.bz2 lib/libgpg-error.a
libgcrypt https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.2.tar.bz2 lib/libgcrypt.a
libsecret http://ftp.gnome.org/pub/gnome/sources/libsecret/0.18/libsecret-0.18.5.tar.xz lib/libsecret-1.a
@ -187,7 +189,7 @@ DISTS=$DISTS'
harfbuzz https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.7.5.tar.bz2 lib/libharfbuzz.a
sfml https://github.com/SFML/SFML/archive/013d053277c980946bc7761a2a088f1cbb788f8c.tar.gz lib/libsfml-system-s.a
shared-mime-info http://freedesktop.org/~hadess/shared-mime-info-1.9.tar.xz bin/update-mime-database
wxwidgets https://github.com/wxWidgets/wxWidgets/archive/148079c61858ad04a8faa7fa9c2e2949753f35b6.tar.gz lib/libwx_baseu-3.1*.a
wxwidgets https://github.com/wxWidgets/wxWidgets/archive/e09d11c7acf768a40adb156c5a32fffb53231432.tar.gz lib/libwx_baseu-3.1*.a
graphite2 https://github.com/silnrsi/graphite/releases/download/1.3.10/graphite2-1.3.10.tgz lib/libgraphite2.a
xvidcore http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.bz2 lib/libxvidcore.a
fribidi https://github.com/fribidi/fribidi/releases/download/v1.0.1/fribidi-1.0.1.tar.bz2 lib/libfribidi.a
@ -1307,6 +1309,11 @@ build_dist() {
shift
extra_dist_args=$@
if ! [ -n "$(table_line DISTS $current_dist)" ]; then
warn "no such dist: $current_dist"
return
fi
cd "$DISTS_DIR/$current_dist"
puts "${NL}Building $current_dist${NL}${NL}"
@ -1719,11 +1726,17 @@ EOF
EOF
# if the relocation mode for the dist is 'aggressive', rewrite all '/usr'
# prefixes everywhere except for the shebang on the first line.
# prefixes everywhere except for the shebang on the first line and /usr/local
if [ "$(dist_relocation_type "$current_dist")" = aggressive ]; then
cat >>"${sed_scr}.work" <<EOF
2,\${
s|/usr/local$|/USRLOCAL|
s|/usr/local/|/USRLOCAL/|g
s|/usr|$inst_root|g
s|/USRLOCAL/|/usr/local/|g
s|/USRLOCAL$|/usr/local|
}
EOF
fi
@ -1839,9 +1852,15 @@ ln -sf \"$link_dest\" \"$dest_f\"
cp "$dest_f" "${dest_f}.work"
LANG=C sed '
/\/usr/{
s|/usr/local$|/USRLOCAL|
s|/usr/local/|/USRLOCAL/|g
s|\([^a-zA-Z0-9]\)/usr$|\1'"$inst_root"'|
s|\([^a-zA-Z0-9]\)/usr/|\1'"$inst_root/"'|g
s|\(-[IL]\)/usr/|\1'"$inst_root/"'|g
s|/USRLOCAL/|/usr/local/|g
s|/USRLOCAL$|/usr/local|
}
' "${dest_f}.work" > "$dest_f"
rm -f "${dest_f}.work"
@ -2435,6 +2454,10 @@ die() {
build_project() {
puts "${NL}Building project: $CHECKOUT${NL}${NL}"
target_os=${CROSS_OS:-$os}
dist_pre_build project
mkdir -p "$BUILD_ROOT/project"
cd "$BUILD_ROOT/project"
@ -2442,15 +2465,21 @@ build_project() {
echo_eval_run cmake "'$CHECKOUT'" $REQUIRED_CMAKE_ARGS -DVBAM_STATIC=ON -DENABLE_LTO=OFF $PROJECT_ARGS $CMAKE_BASE_ARGS $@
echo_run make -j$NUM_CPUS
if [ "$os" = mac ]; then
if [ "$target_os" = mac ]; then
$STRIP visualboyadvance-m.app/Contents/MacOS/visualboyadvance-m
codesign -s "Developer ID Application" --deep ./visualboyadvance-m.app || :
rm -f ./visualboyadvance-m-Mac.zip
zip -9r ./visualboyadvance-m-Mac.zip ./visualboyadvance-m.app
elif [ "$os" != windows ] && path_exists visualboyadvance-m; then
strip visualboyadvance-m
elif [ "$target_os" != windows ] && path_exists visualboyadvance-m; then
$STRIP visualboyadvance-m
elif [ "$target_os" = windows ] && path_exists visualboyadvance-m.exe; then
$STRIP visualboyadvance-m.exe
fi
dist_post_build project
puts "${NL}Build Successful!!!${NL}${NL}Build results can be found in: $BUILD_ROOT/project${NL}${NL}"
}

View File

@ -23,12 +23,12 @@ export BUILD_ROOT="$HOME/vbam-build-mingw${target_bits}"
do_not_remove_dists=
host_dists='
unzip zip cmake autoconf autoconf-archive automake m4 gsed bison flex-2.6.3
flex c2man docbook2x libtool help2man texinfo xmlto pkgconfig nasm yasm
xorg-macros dejavu liberation urw graphviz docbook4.2 docbook4.1.2
docbook4.3 docbook4.4 docbook4.5 docbook5.0 docbook-xsl docbook-xsl-ns
python2 python3 swig doxygen bakefile setuptools pip intltool ninja meson
shared-mime-info gperf
unzip zip cmake autoconf autoconf-archive automake getopt m4 gsed bison
flex-2.6.3 flex c2man docbook2x libtool help2man texinfo xmlto pkgconfig
nasm yasm xorg-macros dejavu liberation urw graphviz docbook4.2
docbook4.1.2 docbook4.3 docbook4.4 docbook4.5 docbook5.0 docbook-xsl
docbook-xsl-ns python2 python3 swig doxygen bakefile setuptools pip
intltool ninja meson shared-mime-info gperf
'
both_dists='
@ -42,13 +42,14 @@ BUILD_ENV=$BUILD_ENV$(cat <<EOF
export CC='${target_arch}-gcc'
export CXX='${target_arch}-g++'
export STRIP='${target_arch}-strip'
EOF
)
REQUIRED_CONFIGURE_ARGS="--host=${target_arch}"
REQUIRED_CMAKE_ARGS="$REQUIRED_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE='$(readlink -f "${0%/*}/../../cmake/Toolchain-cross-MinGW-w64-${target_cpu}.cmake")'"
REQUIRED_CMAKE_ARGS="$REQUIRED_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE='$(perl -MCwd=abs_path -le "print abs_path(q{${0%/*}/../../cmake/Toolchain-cross-MinGW-w64-${target_cpu}.cmake})")'"
. "${0%/*}/../builder/mingw.sh"
@ -61,6 +62,8 @@ table_line_append DIST_PRE_BUILD bzip2-target ':; sed -i.bak '\''s,include <sys\
table_line_replace DIST_POST_BUILD harfbuzz "$(table_line DIST_POST_BUILD harfbuzz | sed 's/rebuild_dist freetype /rebuild_dist freetype-target /')"
table_line_replace DIST_POST_BUILD glib "$(table_line DIST_POST_BUILD glib | sed 's/rebuild_dist gettext /rebuild_dist gettext-target /')"
table_line_append DIST_ARGS libsoxr '-DHAVE_WORDS_BIGENDIAN_EXITCODE=0'
vpx_target=x86-win32-gcc

View File

@ -2,17 +2,28 @@
set -e
CROSS_OS=windows
[ -n "$BUILD_ENV" ] && eval "$BUILD_ENV"
BUILD_ENV=$BUILD_ENV$(cat <<EOF
export CFLAGS="$CFLAGS -static-libgcc -static-libstdc++ -static -lpthread"
export CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++ -static -lpthread"
export OBJCXXFLAGS="$OBJCXXFLAGS -static-libgcc -static-libstdc++ -static -lpthread"
export LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -static -lpthread"
export UUID_LIBS="-luuid_mingw -luuid"
EOF
)
: ${HOST_CC:=ccache gcc}
: ${HOST_CXX:=ccache g++}
: ${HOST_CC_ORIG:=gcc}
: ${HOST_CXX_ORIG:=g++}
: ${HOST_STRIP:=strip}
. "$(dirname "$0")/../builder/core.sh"
# make separate roots for target and host for cross compiling
@ -42,6 +53,11 @@ host_dists="$host_dists autoconf autoconf-archive automake m4 gsed bison \
host_dists=$(list_remove_duplicates $host_dists)
both_dists="$both_dists openssl zlib bzip2 libiconv"
if [ "$os" != windows ]; then
both_dists="$both_dists libuuid"
fi
both_dists=$(list_remove_duplicates $both_dists)
set_host_env() {
@ -52,17 +68,20 @@ set_host_env() {
OCXX=$CXX
OCC_ORIG=$CC_ORIG
OCXX_ORIG=$CXX_ORIG
OSTRIP=$STRIP
export CC='ccache gcc'
export CXX='ccache g++'
export CC_ORIG="gcc"
export CXX_ORIG="g++"
export CC="$HOST_CC"
export CXX="$HOST_CXX"
export CC_ORIG="$HOST_CC_ORIG"
export CXX_ORIG="$HOST_CXX_ORIG"
export STRIP="$HOST_STRIP"
OCFLAGS=$CFLAGS OCXXFLAGS=$CXXFLAGS OLDFLAGS=$LDFLAGS
OCFLAGS=$CFLAGS OCPPFLAGS=$CPPFLAGS OCXXFLAGS=$CXXFLAGS OOBJCXXFLAGS=$OBJCXXFLAGS OLDFLAGS=$LDFLAGS
CFLAGS=$( puts "$CFLAGS" | sed 's/ -static-libgcc -static-libstdc++ -static -lpthread//g')
CXXFLAGS=$(puts "$CXXFLAGS" | sed 's/ -static-libgcc -static-libstdc++ -static -lpthread//g')
LDFLAGS=$( puts "$LDFLAGS" | sed 's/ -static-libgcc -static-libstdc++ -static -lpthread//g')
CFLAGS=$( puts "$CFLAGS" | sed 's/ -static-libgcc -static-libstdc++ -static -lpthread//g')
CXXFLAGS=$( puts "$CXXFLAGS" | sed 's/ -static-libgcc -static-libstdc++ -static -lpthread//g')
OBJCXXFLAGS=$(puts "$OBJCXXFLAGS" | sed 's/ -static-libgcc -static-libstdc++ -static -lpthread//g')
LDFLAGS=$( puts "$LDFLAGS" | sed 's/ -static-libgcc -static-libstdc++ -static -lpthread//g')
OREQUIRED_CONFIGURE_ARGS=$REQUIRED_CONFIGURE_ARGS
OREQUIRED_CMAKE_ARGS=$REQUIRED_CMAKE_ARGS
@ -70,6 +89,8 @@ set_host_env() {
REQUIRED_CONFIGURE_ARGS=$(puts "$REQUIRED_CONFIGURE_ARGS" | sed 's/--host[^ ]*//g')
REQUIRED_CMAKE_ARGS=$(puts "$REQUIRED_CMAKE_ARGS" | sed 's/-DCMAKE_TOOLCHAIN_FILE=[^ ]*//g')
fi
set_host_env_hook 2>/dev/null || :
}
unset_host_env() {
@ -81,12 +102,15 @@ unset_host_env() {
export CXX="$OCXX"
export CC_ORIG="$OCC_ORIG"
export CXX_ORIG="$OCXX_ORIG"
OCC= OCXX= OCC_ORIG= OCXX_ORIG=
export STRIP="$OSTRIP"
OCC= OCXX= OCC_ORIG= OCXX_ORIG= OSTRIP=
export CFLAGS="$OCFLAGS"
export CPPFLAGS="$OCPPFLAGS"
export CXXFLAGS="$OCXXFLAGS"
export OBJCXXFLAGS="$OOBJCXXFLAGS"
export LDFLAGS="$OLDFLAGS"
OCFLAGS= OCXXFLAGS= OLDFLAGS=
OCFLAGS= OCPPFLAGS= OCXXFLAGS= OOBJCXXFLAGS= OLDFLAGS=
REQUIRED_CONFIGURE_ARGS=$OREQUIRED_CONFIGURE_ARGS
REQUIRED_CMAKE_ARGS=$OREQUIRED_CMAKE_ARGS
@ -104,6 +128,8 @@ unset_host_env() {
fi
done
IFS=$OIFS
unset_host_env_hook 2>/dev/null || :
}
# replace install artifact paths with absolute paths into host and target trees
@ -164,6 +190,17 @@ table_line_append DIST_PATCHES bzip2-target 'https://raw.githubusercontent.com/A
table_line_remove DIST_MAKE_ARGS bzip2-target
# done with bzip2-target
# 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
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
'
@ -223,13 +260,13 @@ table_line_append DIST_ARGS ffmpeg "--extra-ldflags='-Wl,-allow-multiple-definit
table_line_append DIST_ARGS gettext "--enable-threads=windows"
table_line_replace DISTS glib 'https://download.gnome.org/sources/glib/2.54/glib-2.54.1.tar.xz lib/libglib-2.0.a'
table_line_append DIST_PATCHES glib "\
http://src.fedoraproject.org/cgit/rpms/mingw-glib2.git/plain/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch?id=f68d4a3ff32fb12f5d4467f4abfec6d2fb95b9fe \
http://src.fedoraproject.org/cgit/rpms/mingw-glib2.git/plain/0002-GNetworkMonitorBase-don-t-fail-when-IPv6-support-is-.patch?id=f68d4a3ff32fb12f5d4467f4abfec6d2fb95b9fe \
http://src.fedoraproject.org/cgit/rpms/mingw-glib2.git/plain/glib-include-time-h-for-localtime_r.patch?id=f68d4a3ff32fb12f5d4467f4abfec6d2fb95b9fe \
http://src.fedoraproject.org/cgit/rpms/mingw-glib2.git/plain/glib-prefer-constructors-over-DllMain.patch?id=f68d4a3ff32fb12f5d4467f4abfec6d2fb95b9fe \
https://src.fedoraproject.org/rpms/mingw-glib2/raw/master/f/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch \
https://src.fedoraproject.org/rpms/mingw-glib2/raw/master/f/glib-formaterror.patch \
https://src.fedoraproject.org/rpms/mingw-glib2/raw/master/f/glib-include-time-h-for-localtime_r.patch \
https://src.fedoraproject.org/rpms/mingw-glib2/raw/master/f/glib-ipmreqsource.patch \
https://src.fedoraproject.org/rpms/mingw-glib2/raw/master/f/glib-prefer-constructors-over-DllMain.patch \
https://gist.githubusercontent.com/rkitover/2edaf9583fb3068bb14016571e6f7d01/raw/ece80116d5618f372464f02392a9bcab670ce6c1/glib-mingw-no-strerror_s.patch \
"
table_line_append DIST_PATCHES graphite2 "\

40
tools/win/mac-cross-builder Executable file
View File

@ -0,0 +1,40 @@
#!/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="
export CFLAGS="-fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -Wno-error=all -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 -Wno-error=all -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 -Wno-error=all -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 -Wno-error=all -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -Wl,-no_compact_unwind"
}
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 "$@"