diff --git a/tools/builder/core.sh b/tools/builder/core.sh index caec89d6e..2dd1e90ba 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -1335,6 +1335,10 @@ build_dist() { dist_patch "$current_dist" dist_pre_build "$current_dist" + ORIG_CPPFLAGS=$CPPFLAGS + ORIG_CFLAGS=$CFLAGS + ORIG_CXXFLAGS=$CXXFLAGS + ORIG_OBJCXXFLAGS=$OBJCXXFLAGS ORIG_LDFLAGS=$LDFLAGS ORIG_LIBS=$LIBS @@ -1344,6 +1348,10 @@ build_dist() { export LDFLAGS="$CXXFLAGS $LDFLAGS" fi + export CPPFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cppflags "$current_dist")")" + export CFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cflags "$current_dist")")" + export CXXFLAGS="$LDFLAGS $(eval puts "$(dist_extra_cxxflags "$current_dist")")" + export OBJCXXFLAGS="$LDFLAGS $(eval puts "$(dist_extra_objcxxflags "$current_dist")")" export LDFLAGS="$LDFLAGS $(eval puts "$(dist_extra_ldflags "$current_dist")")" export LIBS="$LIBS $(eval puts "$(dist_extra_libs "$current_dist")")" @@ -1605,6 +1613,10 @@ build_dist() { fi fi + export CPPFLAGS="$ORIG_CPPFLAGS" + export CFLAGS="$ORIG_CFLAGS" + export CXXFLAGS="$ORIG_CXXFLAGS" + export OBJCXXFLAGS="$ORIG_OBJCXXFLAGS" export LDFLAGS="$ORIG_LDFLAGS" export LIBS="$ORIG_LIBS" @@ -2199,6 +2211,34 @@ dist_make_install_args() { puts "$(table_line DIST_MAKE_INSTALL_ARGS $current_dist)" || : } +dist_extra_cppflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_cppflags: dist name required' + + puts "$(table_line DIST_EXTRA_CPPFLAGS $current_dist)" || : +} + +dist_extra_cflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_cflags: dist name required' + + puts "$(table_line DIST_EXTRA_CFLAGS $current_dist)" || : +} + +dist_extra_cxxflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_cxxflags: dist name required' + + puts "$(table_line DIST_EXTRA_CXXFLAGS $current_dist)" || : +} + +dist_extra_objcxxflags() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_extra_objcxxflags: dist name required' + + puts "$(table_line DIST_EXTRA_OBJCXXFLAGS $current_dist)" || : +} + dist_extra_ldflags() { current_dist=$1 [ -n "$current_dist" ] || die 'dist_extra_ldflags: dist name required' diff --git a/tools/builder/mingw.sh b/tools/builder/mingw.sh index 96aa15085..aaf80e213 100644 --- a/tools/builder/mingw.sh +++ b/tools/builder/mingw.sh @@ -256,6 +256,12 @@ table_insert_after DISTS cmake "dlfcn https://github.com/dlfcn-win32/dlfcn-win32 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 if [ -n "$(table_line DISTS libicu-target || :)" ]; then diff --git a/tools/win/msys2-builder b/tools/win/msys2-builder index b320e27fd..5756059b1 100755 --- a/tools/win/msys2-builder +++ b/tools/win/msys2-builder @@ -32,11 +32,15 @@ case "$MSYSTEM" in export HOST_SYSTEM=i686-w64-mingw32 sys_base=/mingw32 export BUILD_ROOT="$HOME/vbam-build-msys2-i686" + target_bits=32 + target_cpu=i686 ;; MINGW64) export HOST_SYSTEM=x86_64-w64-mingw32 sys_base=/mingw64 export BUILD_ROOT="$HOME/vbam-build-msys2-x86_64" + target_bits=64 + target_cpu=x86_64 ;; MSYS) exec "$0" "$@" -64