visualboyadvance-m/tools/builder/mingw-cross.sh

80 lines
2.3 KiB
Bash
Raw Normal View History

add cygwin cross build support Put shared code for linux cross builds and cygwin cross builds into builder/mingw-cross.sh . Call wxrc when the build platform is cygwin with files resolved via `cygpath -m` in case the wxrc is a native binary. Add -fpermissive to CXX/OBJCXX flags. Reenable libzvbi support for ffmpeg. Stop building ffmpeg and related dists by default until we fix game recording. Set CMAKE_PREFIX_PATH in cmake args as a FILEPATH type variable. Support xml catalog made with native libxml2 using cygpath in related commands, make cygpath a noop on non-cygwin platforms. Remove gdb and zip from msys2 deps. Add a cygwin installdeps routine using a copy of cyg-apt that it fetches. When creating symlinks in install_dist() fully resolve all symlinks in path parts for the source file, so that host and target binaries are correctly linked. When cp -af fails to preserve permission related data, fall back to cp -rf. When installing libs with a cross suffix, make a symlink for the lib without the cross suffix. Make sure cygwin runs with CYGWIN=winsymlinks:native . Add paths to host gettext executables to cmake args, otherwise it tries to use the target executables and fails on paths. For the pkgconfig bundled glib, turn off win32 platform for the cygwin host build. For gettext, remove --disable-auto-import from link flags. Compile target freetype on cygwin with cmake and manually install the pkgconfig .pc file using sed. Add a relocation type 'aggressive', when a dist is marked with this type, rewrite all '/usr' prefixes to the build root. By default only files that exist in the dist are matched and rewritten. Fix regression in linux build by adding some iconv related flags to the cmake invocation for doxygen and disabling -Werror for xorg dists. When relocating scripts, use the actual resolved root path for host or target. Build libxslt --without-python so that it doesn't try to pick up the msys2 python. Other misc. minor tweaks and cleanups.
2018-05-01 08:09:41 +00:00
#!/bin/sh
set -e
target_bits=64
target_cpu=x86_64
case "$1" in
-64)
shift
;;
-32)
target_bits=32
target_cpu=i686
shift
;;
esac
target_arch="${target_cpu}-w64-mingw32"
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
'
both_dists='
openssl zlib bzip2 libiconv gettext xz libxml2 expat libpng freetype
fontconfig
'
[ -n "$BUILD_ENV" ] && eval "$BUILD_ENV"
BUILD_ENV=$BUILD_ENV$(cat <<EOF
export CC='ccache ${target_arch}-gcc'
export CXX='ccache ${target_arch}-g++'
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")'"
. "${0%/*}/../builder/mingw.sh"
openssl_host=mingw
[ "$target_bits" -eq 64 ] && openssl_host=mingw64
table_line_replace DIST_CONFIGURE_OVERRIDES openssl-target "./Configure $openssl_host no-shared --prefix=/usr --openssldir=/etc/ssl --cross-compile-prefix=${target_arch}-"
table_line_append DIST_PRE_BUILD bzip2-target ':; sed -i.bak '\''s,include <sys\\stat.h>,include <sys/stat.h>,g'\'' *.c;'
table_line_replace DIST_POST_BUILD harfbuzz "$(table_line DIST_POST_BUILD harfbuzz | sed 's/rebuild_dist freetype;/rebuild_dist freetype-target;/')"
table_line_append DIST_ARGS libsoxr '-DHAVE_WORDS_BIGENDIAN_EXITCODE=0'
vpx_target=x86-win32-gcc
[ "$target_bits" -eq 64 ] && vpx_target=x86_64-win64-gcc
table_line_replace DIST_CONFIGURE_OVERRIDES libvpx "./configure --target=$vpx_target $CONFIGURE_ARGS $(table_line DIST_ARGS libvpx)"
table_line_remove DIST_ARGS libvpx
table_line_replace DIST_CONFIGURE_OVERRIDES ffmpeg "\
./configure --arch=$target_cpu --target-os=mingw32 --cross-prefix=${target_arch}- \
--pkg-config='$BUILD_ROOT/host/bin/pkg-config' \
$CONFIGURE_ARGS $(table_line DIST_ARGS ffmpeg) \
"
table_line_remove DIST_ARGS ffmpeg