fix msys2 builder script

- add python2 for msys to list of core deps and link it to root/bin,
  harfbuzz requires python to build

- fix double eval in build_project()

- remove duplicates from list of host-only and host/target dists in
  mingw.sh

- fix msys2-builder startup, and assume 64 bit build if MSYSTEM = MSYS

- make sure MSYS has winsymlinks:nativestrict on startup, the user has
  to turn off UAC

- update patch for infozip zip to fix a #define

Overall, the script is far too slow to be practical.

TODO: build both python and perl for the host to not rely on system
versions
This commit is contained in:
Rafael Kitover 2018-04-16 12:01:21 -04:00
parent 70c8dee8bf
commit fe9f06414d
4 changed files with 57 additions and 14 deletions

View File

@ -648,12 +648,15 @@ msys2_install_core_deps() {
# install
# TODO: remove zip and add to dists
pacman --noconfirm --needed -S make tar patch diffutils ccache zip perl m4 msys2-w32api-headers msys2-runtime-devel gcc gcc-libs mpfr windows-default-manifest "$@"
pacman --noconfirm --needed -S make tar patch diffutils ccache zip perl m4 msys2-w32api-headers msys2-runtime-devel gcc gcc-libs mpfr windows-default-manifest python2 "$@"
# make sure msys perl takes precedence over mingw perl if the latter is installed
mkdir -p "$BUILD_ROOT/root/bin"
ln -sf /usr/bin/perl.exe "$BUILD_ROOT/root/bin/perl.exe"
# alias python2 to python
ln -sf /usr/bin/python2.exe "$BUILD_ROOT/root/bin/python.exe"
# activate ccache
eval "$BUILD_ENV"
@ -2292,9 +2295,8 @@ build_project() {
mkdir -p "$BUILD_ROOT/project"
cd "$BUILD_ROOT/project"
eval "set -- $CMAKE_BASE_ARGS"
# FIXME: turn LTO back on when everything works
echo_eval_run "cmake '$CHECKOUT' $REQUIRED_CMAKE_ARGS -DVBAM_STATIC=ON -DENABLE_FFMPEG=OFF -DENABLE_LTO=OFF $PROJECT_ARGS $@"
echo_eval_run cmake "'$CHECKOUT'" $REQUIRED_CMAKE_ARGS -DVBAM_STATIC=ON -DENABLE_FFMPEG=OFF -DENABLE_LTO=OFF $PROJECT_ARGS $CMAKE_BASE_ARGS $@
echo_run make -j$NUM_CPUS
if [ "$os" = mac ]; then
@ -2387,6 +2389,16 @@ list_length() {
puts $#
}
list_remove_duplicates() {
_seen=
for _item; do
if ! list_contains $_item $_seen; then
_seen="$_seen $_item"
fi
done
echo $_seen
}
install_artifact() {
current_dist=$1
[ -n "$current_dist" ] || die 'install_artifact: dist name required'

View File

@ -35,9 +35,14 @@ fi
ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root"
perl_dists="$perl_dists XML-NamespaceSupport XML-SAX-Base XML-SAX"
host_dists="$host_dists m4 gsed bison flex-2.6.3 flex docbook2x"
perl_dists=$(list_remove_duplicates $perl_dists)
host_dists="$host_dists autoconf autoconf-archive automake m4 gsed bison \
flex-2.6.3 flex c2man docbook2x"
host_dists=$(list_remove_duplicates $host_dists)
both_dists="$both_dists openssl zlib bzip2 libiconv"
both_dists=$(list_remove_duplicates $both_dists)
set_host_env() {
rm -f "$BUILD_ROOT/root"

View File

@ -25,14 +25,15 @@ export BUILD_ROOT="$HOME/vbam-build-mingw${target_bits}"
do_not_remove_dists=
host_dists='
unzip zip cmake autoconf autoconf-archive automake libtool help2man texinfo
xmlto pkgconfig nasm yasm c2man 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
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='xz expat libpng freetype fontconfig'
both_dists='openssl zlib bzip2 libiconv xz expat libpng freetype fontconfig'
[ -n "$BUILD_ENV" ] && eval "$BUILD_ENV"

View File

@ -8,7 +8,7 @@ case "$1" in
if [ "$MSYSTEM" != MINGW32 ]; then
OPWD=$PWD
export MSYSTEM=MINGW32
. /etc/profile
. /etc/profile || :
cd "$OPWD"
fi
;;
@ -17,7 +17,7 @@ case "$1" in
if [ "$MSYSTEM" != MINGW64 ]; then
OPWD=$PWD
export MSYSTEM=MINGW64
. /etc/profile
. /etc/profile || :
cd "$OPWD"
fi
;;
@ -36,12 +36,35 @@ case "$MSYSTEM" in
sys_base=/mingw64
BUILD_ROOT="$HOME/vbam-build-msys2-x86_64"
;;
MSYS)
exec "$0" "$@" -64
;;
*)
echo >&2 'You must be in either the MINGW32 or MINGW64 environment.'
exit 1
;;
esac
# 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
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")"
@ -95,7 +118,9 @@ unset_host_env() {
cd "$OPWD"
}
table_line_append DIST_PRE_BUILD c2man ":; sed -i.bak '/test -d c:\\//,/^fi\$/d' Configure"
table_line_append DIST_PRE_BUILD c2man ":; \
sed -i.bak '/test -d c:\\//,/^fi\$/d' Configure; \
"
table_line_append DIST_PATCHES xmlto 'https://gist.githubusercontent.com/rkitover/55d51ab3d55af510b37872a49670436c/raw/b447beaffc2daa747ba6eaf222f69677c7d4a169/xmlto-0.0.28-mingw.patch'
@ -123,7 +148,7 @@ table_line_replace DIST_PRE_BUILD unzip ":; \
s,#include <windows.h>,#include \"../unzip.h\",' win32/win32.c win32/nt.c; \
"
table_line_append DIST_PATCHES zip 'https://gist.githubusercontent.com/rkitover/17e4c90185b7ad533e848b6230a90b8d/raw/67686e2332ae8712177957e4a4b871b24b3d07cf/zip-mingw.patch'
table_line_append DIST_PATCHES zip 'https://gist.githubusercontent.com/rkitover/17e4c90185b7ad533e848b6230a90b8d/raw/434e0f74c872a928e77b93bdbf4ee9a1140fe879/zip-mingw.patch'
table_line_remove DIST_CONFIGURE_OVERRIDES zip
table_line_remove DIST_PRE_BUILD zip