builder: mingw: fix libffi for i686 + improvemnts

Add the tables DIST_EXTRA_{CPPFLAGS,CFLAGS,CXXFLAGS,OBJCXXFLAGS} for
adjustments during builds.

Add -DSYMBOL_UNDERSCORE to DIST_EXTRA_CPPFLAGS for libffi on mingw when
the target is i686, see:

https://bugzilla.mozilla.org/show_bug.cgi?id=1336569

Also set target_bits and target_cpu appropriately in the msys2 script.
This commit is contained in:
Rafael Kitover 2018-12-03 00:37:04 -08:00
parent 5b0f2e8aa6
commit 36e412df53
3 changed files with 50 additions and 0 deletions

View File

@ -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'

View File

@ -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

View File

@ -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