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.
This commit is contained in:
Rafael Kitover 2018-10-11 06:55:53 -07:00
parent b60cd3326f
commit ed8c928adb
6 changed files with 177 additions and 58 deletions

View File

@ -13,7 +13,7 @@ find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc) find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++) find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/sys-root/mingw /usr/local/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX}) SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/usr /usr/${COMPILER_PREFIX}/sys-root/mingw /usr/local/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX})
if(CMAKE_PREFIX_PATH) if(CMAKE_PREFIX_PATH)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH})

View File

@ -13,7 +13,7 @@ find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc) find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++) find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/sys-root/mingw /usr/local/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX}) SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/${COMPILER_PREFIX}/usr /usr/${COMPILER_PREFIX}/sys-root/mingw /usr/local/opt/mingw-w64/toolchain-${CROSS_ARCH}/${COMPILER_PREFIX})
if(CMAKE_PREFIX_PATH) if(CMAKE_PREFIX_PATH)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_PREFIX_PATH})

View File

@ -44,10 +44,10 @@ export CC_ORIG="\${CC_ORIG:-\$CC}"
export CXX_ORIG="\${CXX_ORIG:-\$CXX}" export CXX_ORIG="\${CXX_ORIG:-\$CXX}"
export CPPFLAGS="$CPPFLAGS -I$BUILD_ROOT/root/include" export CPPFLAGS="$CPPFLAGS -I$BUILD_ROOT/root/include"
export CFLAGS="$CFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -Wno-error=all" export CFLAGS="$CFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -pthread"
export CXXFLAGS="$CXXFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -Wno-error=all -fpermissive" export CXXFLAGS="$CXXFLAGS -fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread"
export OBJCXXFLAGS="$OBJCXXFLAGS -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 -fpermissive -pthread"
export LDFLAGS="$LDFLAGS -fPIC -L$BUILD_ROOT/root/lib -Wno-error=all" export LDFLAGS="$LDFLAGS -fPIC -L$BUILD_ROOT/root/lib -pthread"
export STRIP="${STRIP:-strip}" export STRIP="${STRIP:-strip}"
if [ -z "\$OPENMP" ] && echo "\$CC" | grep -Eq gcc; then if [ -z "\$OPENMP" ] && echo "\$CC" | grep -Eq gcc; then
@ -77,7 +77,7 @@ case "\$PATH" in
*"$BUILD_ROOT"*) *"$BUILD_ROOT"*)
;; ;;
*) *)
export PATH="$BUILD_ROOT/host/bin:$BUILD_ROOT/root/bin:$BUILD_ROOT/root/perl5/bin:\$PATH" export PATH="$BUILD_ROOT/root/bin:$BUILD_ROOT/root/perl5/bin:\$PATH"
;; ;;
esac esac
@ -117,8 +117,8 @@ DISTS=$DISTS'
zlib https://zlib.net/zlib-1.2.11.tar.gz lib/libz.a zlib https://zlib.net/zlib-1.2.11.tar.gz lib/libz.a
ccache https://www.samba.org/ftp/ccache/ccache-3.4.3.tar.xz bin/ccache ccache https://www.samba.org/ftp/ccache/ccache-3.4.3.tar.xz bin/ccache
zip https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz bin/zip zip https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz bin/zip
openssl https://www.openssl.org/source/openssl-1.0.2o.tar.gz lib/libssl.a openssl https://www.openssl.org/source/openssl-1.0.2p.tar.gz lib/libssl.a
cmake https://cmake.org/files/v3.10/cmake-3.10.3.tar.gz bin/cmake cmake https://cmake.org/files/v3.13/cmake-3.13.0-rc1.tar.gz bin/cmake
m4 http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz bin/m4 m4 http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz bin/m4
autoconf https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz bin/autoconf autoconf https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz bin/autoconf
autoconf-archive http://mirror.team-cymru.org/gnu/autoconf-archive/autoconf-archive-2017.09.28.tar.xz share/aclocal/ax_check_gl.m4 autoconf-archive http://mirror.team-cymru.org/gnu/autoconf-archive/autoconf-archive-2017.09.28.tar.xz share/aclocal/ax_check_gl.m4
@ -136,6 +136,7 @@ DISTS=$DISTS'
flex https://github.com/westes/flex/archive/e7d45afc6aeb49745f17d21ddba4848e0c0118fc.tar.gz bin/flex flex https://github.com/westes/flex/archive/e7d45afc6aeb49745f17d21ddba4848e0c0118fc.tar.gz bin/flex
xmlto https://releases.pagure.org/xmlto/xmlto-0.0.28.tar.bz2 bin/xmlto xmlto https://releases.pagure.org/xmlto/xmlto-0.0.28.tar.bz2 bin/xmlto
gperf http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz bin/gperf gperf http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz bin/gperf
libicu https://github.com/unicode-org/icu/releases/download/release-63-rc/icu4c-63rc-src.tgz lib/libicud*t*.a
pkgconfig https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz bin/pkg-config pkgconfig https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz bin/pkg-config
nasm http://repo.or.cz/nasm.git/snapshot/53371ddd17b685f8880c22b8b698e494e0f1059b.tar.gz bin/nasm nasm http://repo.or.cz/nasm.git/snapshot/53371ddd17b685f8880c22b8b698e494e0f1059b.tar.gz bin/nasm
yasm http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz bin/yasm yasm http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz bin/yasm
@ -156,7 +157,7 @@ DISTS=$DISTS'
libuuid https://downloads.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz lib/libuuid.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 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 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 libgd https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.xz lib/libgd.a
dejavu https://downloads.sourceforge.net/project/dejavu/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2 share/fonts/dejavu/DejaVuSansMono.ttf dejavu https://downloads.sourceforge.net/project/dejavu/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2 share/fonts/dejavu/DejaVuSansMono.ttf
liberation https://releases.pagure.org/liberation-fonts/liberation-fonts-ttf-2.00.1.tar.gz share/fonts/liberation/LiberationMono-Regular.ttf liberation https://releases.pagure.org/liberation-fonts/liberation-fonts-ttf-2.00.1.tar.gz share/fonts/liberation/LiberationMono-Regular.ttf
urw http://git.ghostscript.com/?p=urw-core35-fonts.git;a=snapshot;h=91edd6ece36e84a1c6d63a1cf63a1a6d84bd443a;sf=tgz share/fonts/urw/URWBookman-Light.ttf urw http://git.ghostscript.com/?p=urw-core35-fonts.git;a=snapshot;h=91edd6ece36e84a1c6d63a1cf63a1a6d84bd443a;sf=tgz share/fonts/urw/URWBookman-Light.ttf
@ -179,7 +180,7 @@ DISTS=$DISTS'
intltool https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz bin/intltoolize 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 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 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/2.57.2.tar.gz lib/libglib-2.0.a glib https://github.com/GNOME/glib/archive/2.58.1.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 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 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 libsecret http://ftp.gnome.org/pub/gnome/sources/libsecret/0.18/libsecret-0.18.5.tar.xz lib/libsecret-1.a
@ -257,6 +258,7 @@ DIST_TAR_ARGS="$DIST_TAR_ARGS
DIST_CONFIGURE_TYPES="$DIST_CONFIGURE_TYPES DIST_CONFIGURE_TYPES="$DIST_CONFIGURE_TYPES
unzip make unzip make
zip make zip make
libgd autoreconf
harfbuzz autoconf harfbuzz autoconf
python2 autoreconf python2 autoreconf
python3 autoreconf python3 autoreconf
@ -273,6 +275,7 @@ DIST_RELOCATION_TYPES="$DIST_RELOCATION_TYPES
DIST_PRE_BUILD="$DIST_PRE_BUILD DIST_PRE_BUILD="$DIST_PRE_BUILD
# xz mkdir -p build-aux; touch build-aux/config.rpath; mkdir -p po; touch po/Makefile.in.in; sed -i.bak 's/ po / /g' Makefile.am; # xz mkdir -p build-aux; touch build-aux/config.rpath; mkdir -p po; touch po/Makefile.in.in; sed -i.bak 's/ po / /g' Makefile.am;
getopt sed -i.bak 's/\\\$(LDFLAGS)\\(.*\\)\$/\\1 \$(LDFLAGS)/' Makefile; getopt sed -i.bak 's/\\\$(LDFLAGS)\\(.*\\)\$/\\1 \$(LDFLAGS)/' Makefile;
libicu cd source;
# flex-2.6.3 sed -i.bak '/^'\"\$TAB\"'tests \\\\\$/d' Makefile.am; # flex-2.6.3 sed -i.bak '/^'\"\$TAB\"'tests \\\\\$/d' Makefile.am;
flex mkdir -p build-aux; touch build-aux/config.rpath; mkdir -p po; touch po/Makefile.in.in; sed -i.bak '/po \\\\$/d' Makefile.am; flex mkdir -p build-aux; touch build-aux/config.rpath; mkdir -p po; touch po/Makefile.in.in; sed -i.bak '/po \\\\$/d' Makefile.am;
python3 sed -i.bak '/-Wl,-stack_size,/d' configure.ac; python3 sed -i.bak '/-Wl,-stack_size,/d' configure.ac;
@ -319,6 +322,9 @@ DIST_POST_BUILD="$DIST_POST_BUILD
" "
DIST_POST_CONFIGURE="$DIST_POST_CONFIGURE DIST_POST_CONFIGURE="$DIST_POST_CONFIGURE
openssl sed -E -i.bak ' \
s/([^\\t]+\\\$\\((BUILD_ONE_CMD|RECURSIVE_BUILD_CMD|RECURSIVE_MAKE)\\))/+ \1/ \
' \$(find . -name Makefile);
" "
DIST_CONFIGURE_OVERRIDES="$DIST_CONFIGURE_OVERRIDES DIST_CONFIGURE_OVERRIDES="$DIST_CONFIGURE_OVERRIDES
@ -395,6 +401,8 @@ DIST_ARGS="$DIST_ARGS
DIST_BARE_MAKE_ARGS='CC="$CC"' DIST_BARE_MAKE_ARGS='CC="$CC"'
ALL_MAKE_ARGS='V=1 VERBOSE=1'
# have to disable ccache for openssl # have to disable ccache for openssl
DIST_MAKE_ARGS="$DIST_MAKE_ARGS DIST_MAKE_ARGS="$DIST_MAKE_ARGS
openssl CC=\"\$CC_ORIG -fPIC\" CXX=\"\$CXX_ORIG -fPIC\" openssl CC=\"\$CC_ORIG -fPIC\" CXX=\"\$CXX_ORIG -fPIC\"
@ -404,6 +412,7 @@ DIST_MAKE_ARGS="$DIST_MAKE_ARGS
zip generic zip generic
expat DOCBOOK_TO_MAN=docbook2man expat DOCBOOK_TO_MAN=docbook2man
shared-mime-info -j1 shared-mime-info -j1
fontconfig LIBS=\"-lintl -liconv\"
" "
DIST_MAKE_INSTALL_ARGS="$DIST_MAKE_INSTALL_ARGS DIST_MAKE_INSTALL_ARGS="$DIST_MAKE_INSTALL_ARGS
@ -419,7 +428,6 @@ DIST_EXTRA_LDFLAGS="$DIST_EXTRA_LDFLAGS
DIST_EXTRA_LIBS="$DIST_EXTRA_LIBS DIST_EXTRA_LIBS="$DIST_EXTRA_LIBS
gettext -liconv gettext -liconv
fontconfig -lintl -liconv
shared-mime-info \$LD_START_GROUP -lxml2 -lgio-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -llzma -lz -lm -lffi -lpthread -liconv -lresolv -ldl \$LD_END_GROUP shared-mime-info \$LD_START_GROUP -lxml2 -lgio-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -llzma -lz -lm -lffi -lpthread -liconv -lresolv -ldl \$LD_END_GROUP
python3 -lintl python3 -lintl
harfbuzz -lz harfbuzz -lz
@ -1361,7 +1369,7 @@ build_dist() {
echo_run meson .. "$@" echo_run meson .. "$@"
fi fi
dist_post_configure "$current_dist" dist_post_configure "$current_dist"
eval "set -- $(dist_make_args "$current_dist")" eval "set -- $(dist_ninja_args "$current_dist")"
echo_run ninja -j $NUM_CPUS "$@" echo_run ninja -j $NUM_CPUS "$@"
if [ -z "$install_override" ]; then if [ -z "$install_override" ]; then
@ -1454,6 +1462,39 @@ build_dist() {
echo_eval_run "$install_override $(dist_make_install_args "$current_dist")" echo_eval_run "$install_override $(dist_make_install_args "$current_dist")"
fi fi
path_exists "$(install_artifact $current_dist)"
elif [ "$config_type" = cmakeninja ]; then
if ! command -v ninja >/dev/null; then
error "configure type 'cmakeninja' requested but ninja is not available yet";
fi
mkdir -p build
cd build
if [ -n "$configure_override" ]; then
eval "set -- $extra_dist_args"
echo_eval_run "$configure_override $@"
else
eval "set -- $REQUIRED_CMAKE_ARGS $(dist_args "$current_dist" cmake) $extra_dist_args -G Ninja"
echo_run cmake .. "$@"
fi
dist_post_configure "$current_dist"
eval "set -- $(dist_ninja_args "$current_dist")"
echo_run ninja -j$NUM_CPUS "$@"
if [ -z "$install_override" ]; then
rm -rf destdir
mkdir destdir
eval "set -- $(dist_make_install_args "$current_dist")"
echo_run make "$@" install DESTDIR="$PWD/destdir" || :
install_dist "$current_dist"
else
echo_eval_run "$install_override $(dist_make_install_args "$current_dist")"
fi
path_exists "$(install_artifact $current_dist)" path_exists "$(install_artifact $current_dist)"
elif [ "$config_type" = cmake ] || [ -z "$config_type" -a -f CMakeLists.txt ]; then elif [ "$config_type" = cmake ] || [ -z "$config_type" -a -f CMakeLists.txt ]; then
mkdir -p build mkdir -p build
@ -2136,7 +2177,14 @@ dist_make_args() {
current_dist=$1 current_dist=$1
[ -n "$current_dist" ] || die 'dist_make_args: dist name required' [ -n "$current_dist" ] || die 'dist_make_args: dist name required'
puts "$(table_line DIST_MAKE_ARGS $current_dist)" || : puts "$ALL_MAKE_ARGS $(table_line DIST_MAKE_ARGS $current_dist)" || :
}
dist_ninja_args() {
current_dist=$1
[ -n "$current_dist" ] || die 'dist_ninja_args: dist name required'
puts "-v $(table_line DIST_MAKE_ARGS $current_dist)" || :
} }
dist_make_install_args() { dist_make_install_args() {
@ -2185,9 +2233,11 @@ dist_patch() {
# reset patch level to 1 which is default # reset patch level to 1 which is default
_patch_level=-p1 _patch_level=-p1
fi
done_msg done_msg
else
puts "${NL}Patch $_patch_url to $current_dist is already appplied...${NL}${NL}"
fi
done done
} }
@ -2222,6 +2272,18 @@ dist_post_configure() {
eval "$_cmd" eval "$_cmd"
fi fi
# sometimes PREFIX/include gets added to header search
# definitely don't want this
# also definitely don't want any kind of -Werror
find . -name Makefile | while IFS=$NL read -r make_file; do
sed -i.bak '
s,-I/usr/include , ,g
s,-I/usr/include$,,g
s,-Werror[^ ]* , ,g
s,-Werror[^ ]*$,,g
' "$make_file"
done
} }
dist_post_build() { dist_post_build() {

View File

@ -4,6 +4,7 @@ set -e
target_bits=64 target_bits=64
target_cpu=x86_64 target_cpu=x86_64
lib_suffix=64
case "$1" in case "$1" in
-64) -64)
@ -12,6 +13,7 @@ case "$1" in
-32) -32)
target_bits=32 target_bits=32
target_cpu=i686 target_cpu=i686
lib_suffix=
shift shift
;; ;;
esac esac
@ -44,6 +46,12 @@ export CC='${target_arch}-gcc'
export CXX='${target_arch}-g++' export CXX='${target_arch}-g++'
export STRIP='${target_arch}-strip' export STRIP='${target_arch}-strip'
export CFLAGS="\$CFLAGS -L/usr/${target_arch}/usr/lib${lib_suffix}"
export CPPFLAGS="\$CPPFLAGS"
export CXXFLAGS="\$CXXFLAGS -L/usr/${target_arch}/usr/lib${lib_suffix}"
export OBJCXXFLAGS="\$OBJCXXFLAGS -L/usr/${target_arch}/usr/lib${lib_suffix}"
export LDFLAGS="-L/usr/${target_arch}/usr/lib${lib_suffix} \$LDFLAGS"
EOF EOF
) )
@ -66,10 +74,6 @@ table_line_replace DIST_POST_BUILD glib "$(table_line DIST_POST_BUILD glib
table_line_append DIST_ARGS libsoxr '-DHAVE_WORDS_BIGENDIAN_EXITCODE=0' table_line_append DIST_ARGS libsoxr '-DHAVE_WORDS_BIGENDIAN_EXITCODE=0'
# don't want mingw libuuid for host fontconfig
table_line_append DIST_PRE_BUILD fontconfig ':; unset UUID_LIBS;'
table_line_append DIST_POST_BUILD fontconfig ':; eval "$BUILD_ENV";'
vpx_target=x86-win32-gcc vpx_target=x86-win32-gcc
[ "$target_bits" -eq 64 ] && vpx_target=x86_64-win64-gcc [ "$target_bits" -eq 64 ] && vpx_target=x86_64-win64-gcc

View File

@ -8,13 +8,17 @@ CROSS_OS=windows
BUILD_ENV=$BUILD_ENV$(cat <<EOF BUILD_ENV=$BUILD_ENV$(cat <<EOF
export CFLAGS="$CFLAGS -static-libgcc -static-libstdc++ -static -lpthread" export CPPFLAGS="$CPPFLAGS -DMINGW_HAS_SECURE_API"
export CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++ -static -lpthread" export CFLAGS="$CFLAGS -static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API"
export OBJCXXFLAGS="$OBJCXXFLAGS -static-libgcc -static-libstdc++ -static -lpthread" export CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API"
export LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -static -lpthread" export OBJCXXFLAGS="$OBJCXXFLAGS -static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API"
export LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -static -lpthread -DMINGW_HAS_SECURE_API"
export LIBS="-lpthread"
export UUID_LIBS="-luuid_mingw -luuid" export UUID_LIBS="-luuid_mingw -luuid"
export PKG_CONFIG="$BUILD_ROOT/root/bin/pkg-config"
EOF EOF
) )
@ -22,6 +26,13 @@ EOF
: ${HOST_CXX:=ccache g++} : ${HOST_CXX:=ccache g++}
: ${HOST_CC_ORIG:=gcc} : ${HOST_CC_ORIG:=gcc}
: ${HOST_CXX_ORIG:=g++} : ${HOST_CXX_ORIG:=g++}
: ${HOST_CPPFLAGS:="-I$BUILD_ROOT/root/include"}
: ${HOST_CFLAGS:="-fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -pthread"}
: ${HOST_CXXFLAGS:="-fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread"}
: ${HOST_OBJCXXFLAGS:="-fPIC -I$BUILD_ROOT/root/include -L$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread"}
: ${HOST_LDFLAGS:="-fPIC -L$BUILD_ROOT/root/lib -pthread"}
: ${HOST_LIBS:=}
: ${HOST_UUID_LIBS:=}
: ${HOST_STRIP:=strip} : ${HOST_STRIP:=strip}
. "$(dirname "$0")/../builder/core.sh" . "$(dirname "$0")/../builder/core.sh"
@ -52,7 +63,7 @@ host_dists="$host_dists autoconf autoconf-archive automake m4 gsed bison \
flex-2.6.3 flex c2man docbook2x ccache" flex-2.6.3 flex c2man docbook2x ccache"
host_dists=$(list_remove_duplicates $host_dists) host_dists=$(list_remove_duplicates $host_dists)
both_dists="$both_dists openssl zlib bzip2 libiconv" both_dists="$both_dists openssl zlib bzip2 libiconv libicu"
if [ "$os" != windows ]; then if [ "$os" != windows ]; then
both_dists="$both_dists libuuid" both_dists="$both_dists libuuid"
@ -68,20 +79,29 @@ set_host_env() {
OCXX=$CXX OCXX=$CXX
OCC_ORIG=$CC_ORIG OCC_ORIG=$CC_ORIG
OCXX_ORIG=$CXX_ORIG OCXX_ORIG=$CXX_ORIG
OCPPFLAGS=$CPPFLAGS
OCFLAGS=$CFLAGS
OCXXFLAGS=$CXXFLAGS
OOBJCXXFLAGS=$OBJCXXFLAGS
OLDFLAGS=$LDFLAGS
OLIBS=$LIBS
OUUID_LIBS=$UUID_LIBS
OSTRIP=$STRIP OSTRIP=$STRIP
OPATH=$PATH
export CC="$HOST_CC" export CC="$HOST_CC"
export CXX="$HOST_CXX" export CXX="$HOST_CXX"
export CC_ORIG="$HOST_CC_ORIG" export CC_ORIG="$HOST_CC_ORIG"
export CXX_ORIG="$HOST_CXX_ORIG" export CXX_ORIG="$HOST_CXX_ORIG"
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 STRIP="$HOST_STRIP"
export PATH="$BUILD_ROOT/host/bin:$PATH"
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')
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_CONFIGURE_ARGS=$REQUIRED_CONFIGURE_ARGS
OREQUIRED_CMAKE_ARGS=$REQUIRED_CMAKE_ARGS OREQUIRED_CMAKE_ARGS=$REQUIRED_CMAKE_ARGS
@ -102,20 +122,20 @@ unset_host_env() {
export CXX="$OCXX" export CXX="$OCXX"
export CC_ORIG="$OCC_ORIG" export CC_ORIG="$OCC_ORIG"
export CXX_ORIG="$OCXX_ORIG" export CXX_ORIG="$OCXX_ORIG"
export STRIP="$OSTRIP"
OCC= OCXX= OCC_ORIG= OCXX_ORIG= OSTRIP=
export CFLAGS="$OCFLAGS"
export CPPFLAGS="$OCPPFLAGS" export CPPFLAGS="$OCPPFLAGS"
export CFLAGS="$OCFLAGS"
export CXXFLAGS="$OCXXFLAGS" export CXXFLAGS="$OCXXFLAGS"
export OBJCXXFLAGS="$OOBJCXXFLAGS" export OBJCXXFLAGS="$OOBJCXXFLAGS"
export LDFLAGS="$OLDFLAGS" export LDFLAGS="$OLDFLAGS"
OCFLAGS= OCPPFLAGS= OCXXFLAGS= OOBJCXXFLAGS= OLDFLAGS= export LIBS="$OLIBS"
export UUID_LIBS="$OUUID_LIBS"
export STRIP="$OSTRIP"
export PATH="$OPATH"
OCC= OCXX= OCC_ORIG= OCXX_ORIG= OCPPFLAGS= OCFLAGS= OCXXFLAGS= OOBJCXXFLAGS= OLDFLAGS= OLIBS= OUUID_LIBS= OSTRIP= OPATH=
REQUIRED_CONFIGURE_ARGS=$OREQUIRED_CONFIGURE_ARGS REQUIRED_CONFIGURE_ARGS=$OREQUIRED_CONFIGURE_ARGS
REQUIRED_CMAKE_ARGS=$OREQUIRED_CMAKE_ARGS REQUIRED_CMAKE_ARGS=$OREQUIRED_CMAKE_ARGS
OREQUIRED_CONFIGURE_ARGS= OREQUIRED_CONFIGURE_ARGS= OREQUIRED_CMAKE_ARGS=
OREQUIRED_CMAKE_ARGS=
fi fi
# make links to executables in the target as well # make links to executables in the target as well
@ -201,6 +221,37 @@ fi
# done with libuuid # done with libuuid
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; \
"
# mingw -ldl equivalent, needed by some things
table_insert_after DISTS zlib "dlfcn https://github.com/dlfcn-win32/dlfcn-win32/archive/v1.1.2.tar.gz lib/libdl.a"
table_line_replace DIST_CONFIGURE_TYPES dlfcn cmake
table_line_append DIST_ARGS libicu-target "--with-cross-build=$BUILD_ROOT/dists/libicu/source"
table_line_append DIST_PATCHES libicu-target " \
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_insert_after DISTS libiconv-target ' 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 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
' '
@ -213,6 +264,16 @@ table_line_append DIST_POST_BUILD catgets ":; \
rm -f \$BUILD_ROOT/root/lib/libcatgets.dll.a \$BUILD_ROOT/root/bin/libcatgets.dll; \ rm -f \$BUILD_ROOT/root/lib/libcatgets.dll.a \$BUILD_ROOT/root/bin/libcatgets.dll; \
" "
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_replace DIST_CONFIGURE_TYPES fontconfig-target autoreconf
table_line_append DIST_PATCHES libgd 'https://gist.githubusercontent.com/rkitover/c64ea5b83ddea94ace58c40c7de42879/raw/fbaf4885fbefb302116b56626c0e191df514e8c6/libgd-2.2.4-mingw-static.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 ' table_insert_before DISTS sfml '
@ -221,18 +282,11 @@ table_insert_before DISTS sfml '
table_line_append DIST_ARGS openal '-DLIBTYPE=STATIC -DALSOFT_UTILS=OFF -DALSOFT_EXAMPLES=OFF -DALSOFT_TESTS=OFF' table_line_append DIST_ARGS openal '-DLIBTYPE=STATIC -DALSOFT_UTILS=OFF -DALSOFT_EXAMPLES=OFF -DALSOFT_TESTS=OFF'
# this is necessary so the native tools openal uses to build compile when cross-compiling
table_line_append DIST_PRE_BUILD openal ":; sed -i.bak 's/\\(-G \"\\\${CMAKE_GENERATOR}\"\\)/\\1 -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache/' CMakeLists.txt;"
table_line_replace DIST_ARGS mp3lame "LDFLAGS='$LDFLAGS $BUILD_ROOT/root/lib/libcatgets.a'" table_line_replace DIST_ARGS mp3lame "LDFLAGS='$LDFLAGS $BUILD_ROOT/root/lib/libcatgets.a'"
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_replace DIST_CONFIGURE_TYPES zlib-target cmake
table_line_append DIST_ARGS zlib-target -DUNIX=1 table_line_append DIST_ARGS zlib-target -DUNIX=1
table_line_remove DIST_CONFIGURE_OVERRIDES zlib-target table_line_remove DIST_CONFIGURE_OVERRIDES zlib-target
@ -260,12 +314,11 @@ table_line_append DIST_ARGS ffmpeg "--extra-ldflags='-Wl,-allow-multiple-definit
table_line_append DIST_ARGS gettext "--enable-threads=windows" table_line_append DIST_ARGS gettext "--enable-threads=windows"
table_line_append DIST_ARGS glib "--with-threads=posix --disable-libelf"
table_line_append DIST_PATCHES glib "\ table_line_append DIST_PATCHES glib "\
https://src.fedoraproject.org/rpms/mingw-glib2/raw/master/f/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch \ https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-glib2/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://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-glib2/0001-win32-Make-the-static-build-work-with-MinGW-when-pos.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 \ https://gist.githubusercontent.com/rkitover/2edaf9583fb3068bb14016571e6f7d01/raw/ece80116d5618f372464f02392a9bcab670ce6c1/glib-mingw-no-strerror_s.patch \
" "

View File

@ -13,10 +13,10 @@ set_host_env_hook() {
export CC_ORIG=clang export CC_ORIG=clang
export CXX_ORIG=clang++ export CXX_ORIG=clang++
export CPPFLAGS="-I$BUILD_ROOT/root/include -DICONV_CONST=" 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 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 -Wno-error=all -fpermissive -stdlib=libc++ -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 -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 -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" export LDFLAGS="-fPIC -L$BUILD_ROOT/root/lib -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -Wl,-no_compact_unwind"
} }
unset_host_env_hook() { unset_host_env_hook() {