2018-02-24 19:39:29 +00:00
#!/bin/sh
set -e
case "$1" in
-32)
shift
if [ "$MSYSTEM" != MINGW32 ]; then
2018-09-13 00:21:40 +00:00
unset MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX CONFIG_SITE ACLOCAL_PATH PKG_CONFIG_PATH
2018-02-24 19:39:29 +00:00
OPWD=$PWD
export MSYSTEM=MINGW32
2018-04-16 16:01:21 +00:00
. /etc/profile || :
2019-12-24 06:32:01 +00:00
. ~/.bashrc 2>/dev/null || :
2018-02-24 19:39:29 +00:00
cd "$OPWD"
fi
;;
-64)
shift
if [ "$MSYSTEM" != MINGW64 ]; then
2018-09-13 00:21:40 +00:00
unset MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX CONFIG_SITE ACLOCAL_PATH PKG_CONFIG_PATH
2018-02-24 19:39:29 +00:00
OPWD=$PWD
export MSYSTEM=MINGW64
2018-04-16 16:01:21 +00:00
. /etc/profile || :
2019-12-24 06:32:01 +00:00
. ~/.bashrc 2>/dev/null || :
2018-02-24 19:39:29 +00:00
cd "$OPWD"
fi
;;
esac
OMSYSTEM=$MSYSTEM
case "$MSYSTEM" in
MINGW32)
export HOST_SYSTEM=i686-w64-mingw32
sys_base=/mingw32
2018-11-15 09:54:19 +00:00
export BUILD_ROOT="$HOME/vbam-build-msys2-i686"
2018-12-03 08:37:04 +00:00
target_bits=32
target_cpu=i686
2018-02-24 19:39:29 +00:00
;;
MINGW64)
export HOST_SYSTEM=x86_64-w64-mingw32
sys_base=/mingw64
2018-11-15 09:54:19 +00:00
export BUILD_ROOT="$HOME/vbam-build-msys2-x86_64"
2018-12-03 08:37:04 +00:00
target_bits=64
target_cpu=x86_64
2018-02-24 19:39:29 +00:00
;;
2018-04-16 16:01:21 +00:00
MSYS)
exec "$0" "$@" -64
;;
2018-02-24 19:39:29 +00:00
*)
echo >&2 'You must be in either the MINGW32 or MINGW64 environment.'
exit 1
;;
esac
2018-04-16 16:01:21 +00:00
# turn on real symlinks
new_msys= replaced=
for part in $MSYS; do
case "$part" in
winsymlinks:*)
new_msys="$new_msys winsymlinks:nativestrict"
replaced=1
;;
*)
new_msys="$new_msys $part"
;;
esac
done
if [ -n "$replaced" ]; then
export MSYS=$new_msys
else
export MSYS="winsymlinks:nativestrict $new_msys"
fi
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
PATH_SEP=';'
2018-02-24 19:39:29 +00:00
CMAKE_PREFIX_PATH=
for dir in /lib /bin "$HOST_SYSTEM/lib" "$HOST_SYSTEM/bin"; do
CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$(cygpath -m "$sys_base/$dir")"
done
export CMAKE_PREFIX_PATH="$(cygpath -m "$BUILD_ROOT/root");${CMAKE_PREFIX_PATH%;}"
ignore_msys_paths=
for d in /usr /usr/include /usr/lib; do
ignore_msys_paths="$ignore_msys_paths;$(cygpath -m "$d")"
done
ignore_msys_paths=${ignore_msys_paths#;}
2018-11-15 09:54:19 +00:00
export CMAKE_BASE_ARGS="-G 'MSYS Makefiles' -DCMAKE_IGNORE_PATH='$ignore_msys_paths'"
2018-02-24 19:39:29 +00:00
2018-11-15 09:54:19 +00:00
export TMP_DIR="$BUILD_ROOT/tmp_$$"
2018-02-24 19:39:29 +00:00
BUILD_ENV=$BUILD_ENV$(cat <<'EOF'
2019-12-24 06:32:01 +00:00
# don't translate prefix and defines by default
2018-02-24 19:39:29 +00:00
export MSYS2_ARG_CONV_EXCL="-D;/usr;/etc"
EOF
)
2018-11-15 09:54:19 +00:00
export BUILD_ENV
2018-02-24 19:39:29 +00:00
DIST_TAR_ARGS="
help2man --exclude ChangeLog
sfml --exclude libs-osx
expat --exclude README.md
libsoxr --exclude inst-check-soxr-lsr
graphviz --exclude COPYING --exclude graphviz.spec
"
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
. "${0%/*}/../builder/mingw.sh"
2018-02-24 19:39:29 +00:00
2018-11-12 12:00:03 +00:00
host_env() {
cat <<EOF
unset MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX CONFIG_SITE ACLOCAL_PATH PKG_CONFIG_PATH
2018-11-15 09:54:19 +00:00
OPWD="\$PWD"
2018-11-12 12:00:03 +00:00
export MSYSTEM=MSYS
. /etc/profile || :
. ~/.bashrc 2>/dev/null || :
2018-11-16 03:22:56 +00:00
$BUILD_ENV
2018-11-12 12:00:03 +00:00
EOF
2018-09-13 00:21:40 +00:00
2018-02-24 19:39:29 +00:00
cd "$OPWD"
2018-12-03 04:31:39 +00:00
host_env_base 2>/dev/null || :
2018-02-24 19:39:29 +00:00
}
2018-11-12 12:00:03 +00:00
target_env() {
cat <<EOF
unset MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX CONFIG_SITE ACLOCAL_PATH PKG_CONFIG_PATH
2018-11-15 09:54:19 +00:00
OPWD="\$PWD"
export MSYSTEM="\$OMSYSTEM"
2018-11-12 12:00:03 +00:00
. /etc/profile || :
. ~/.bashrc 2>/dev/null || :
2018-11-16 03:22:56 +00:00
$BUILD_ENV
2018-11-12 12:00:03 +00:00
EOF
2018-09-13 00:21:40 +00:00
2018-02-24 19:39:29 +00:00
cd "$OPWD"
2018-12-03 04:31:39 +00:00
target_env_base 2>/dev/null || :
2018-02-24 19:39:29 +00:00
}
2019-11-26 14:31:20 +00:00
table_line_replace DIST_BUILD_OVERRIDES ninja "python configure.py && ninja -j $NUM_CPUS && cp -af ./ninja \"\$BUILD_ROOT/root/bin\""
2018-04-16 16:01:21 +00:00
table_line_append DIST_PRE_BUILD c2man ":; \
sed -i.bak '/test -d c:\\//,/^fi\$/d' Configure; \
"
2018-02-24 19:39:29 +00:00
table_line_append DIST_PATCHES xmlto 'https://gist.githubusercontent.com/rkitover/55d51ab3d55af510b37872a49670436c/raw/b447beaffc2daa747ba6eaf222f69677c7d4a169/xmlto-0.0.28-mingw.patch'
# FIXME: problems with autopoint that need to be sorted
table_line_remove DISTS flex
table_line_replace DIST_CONFIGURE_TYPES fontconfig autoreconf
table_line_append DIST_PRE_BUILD fontconfig ":; \
sed -i.bak 's|ln -s \\\$(templatedir)|cp -af \$(DESTDIR)/\$(templatedir)|g' conf.d/Makefile.am; \
"
if mime_info_libs=$(table_line DIST_EXTRA_LIBS shared-mime-info); then
table_line_replace DIST_EXTRA_LIBS shared-mime-info "$(puts "$mime_info_libs" | sed 's/-ldl//g; s/-lresolv//g;')"
fi
table_line_remove DIST_CONFIGURE_OVERRIDES unzip
table_line_remove DIST_PRE_BUILD unzip
table_line_replace DIST_MAKE_ARGS unzip '-f win32/Makefile.gcc NOASM=1 CC_CPU_OPT='
table_line_replace DIST_INSTALL_OVERRIDES unzip 'cp -af $(find . -name "*.exe") "$BUILD_ROOT/root/bin"'
table_line_replace DIST_PRE_BUILD unzip ":; \
sed -i.bak 's,#include \"../unzip\\.h\",#include <windows.h>,; \
t; \
s,#include <windows.h>,#include \"../unzip.h\",' win32/win32.c win32/nt.c; \
"
2018-04-16 16:01:21 +00:00
table_line_append DIST_PATCHES zip 'https://gist.githubusercontent.com/rkitover/17e4c90185b7ad533e848b6230a90b8d/raw/434e0f74c872a928e77b93bdbf4ee9a1140fe879/zip-mingw.patch'
2018-02-24 19:39:29 +00:00
table_line_remove DIST_CONFIGURE_OVERRIDES zip
table_line_remove DIST_PRE_BUILD zip
table_line_replace DIST_MAKE_ARGS zip '-f win32/Makefile.gcc'
table_line_replace DIST_INSTALL_OVERRIDES zip 'cp -af *.exe "$BUILD_ROOT/root/bin"'
table_line_replace DIST_POST_BUILD unzip ":; \
mkdir -p \"\$BUILD_ROOT/root/bin\"; \
cp -a \"\$BUILD_ROOT/dists/unzip\"/*.exe \"\$BUILD_ROOT/root/bin\"; \
"
table_line_replace DIST_CONFIGURE_OVERRIDES openssl "$(table_line DIST_CONFIGURE_OVERRIDES openssl | sed 's,^./config ,./Configure Cygwin-x86_64 ,')"
builder "$@"