Commit b37e0bdd authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

vlc-debian-llvm-mingw: Bump LLVM & mingw-w64 versions

parent 7919a8a8
FROM debian:testing-20200514-slim
FROM debian:sid-20201012-slim
MAINTAINER VideoLAN roots <roots@videolan.org>
ENV IMAGE_DATE=202008191706
ENV IMAGE_DATE=202010270958
RUN apt-get update -qq && mkdir -p /usr/share/man/man1 && \
apt-get upgrade -y && \
apt-get install -qqy --no-install-suggests --no-install-recommends \
git wget bzip2 file unzip libtool-bin pkg-config build-essential \
automake yasm gettext autopoint vim python git-svn ninja-build libwine-development \
automake yasm gettext autopoint vim git-svn ninja-build libwine-development \
wine-development flex ragel bison zip dos2unix p7zip-full subversion gperf nsis nasm \
python3 locales meson libltdl-dev ca-certificates curl default-jdk-headless && \
python3 python3-setuptools locales meson libltdl-dev ca-certificates curl default-jdk-headless && \
dpkg --add-architecture i386 && \
apt-get update && apt-get -y install --no-install-suggests --no-install-recommends wine32-development && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
ENV LANG=en_US.UTF-8
......@@ -42,12 +43,13 @@ RUN CMAKE_VERSION=3.17.0 && \
ENV PATH=/opt/tools/bin:$PATH
# Build everything that uses the llvm monorepo. We need to build the mingw runtime before the compiler-rt/libunwind/libcxxabi/libcxx runtimes.
COPY build-llvm.sh strip-llvm.sh install-wrappers.sh build-mingw-w64.sh build-compiler-rt.sh build-mingw-w64-libraries.sh build-libcxx.sh ./
COPY build-llvm.sh strip-llvm.sh install-wrappers.sh build-mingw-w64.sh build-mingw-w64-tools.sh build-compiler-rt.sh build-mingw-w64-libraries.sh build-libcxx.sh ./
COPY wrappers/*.sh wrappers/*.c wrappers/*.h ./wrappers/
RUN ./build-llvm.sh $TOOLCHAIN_PREFIX && \
./strip-llvm.sh $TOOLCHAIN_PREFIX && \
./install-wrappers.sh $TOOLCHAIN_PREFIX && \
MINGW_W64_VERSION=ceb3ac2f42d56504fae5bd5cfe7f681643baccd6 ./build-mingw-w64.sh $TOOLCHAIN_PREFIX --with-default-msvcrt=msvcrt && \
MINGW_W64_VERSION=af56acd2c36af609e701fa4880f25c5f37abe502 ./build-mingw-w64.sh $TOOLCHAIN_PREFIX --with-default-msvcrt=msvcrt && \
./build-mingw-w64-tools.sh $TOOLCHAIN_PREFIX && \
./build-compiler-rt.sh $TOOLCHAIN_PREFIX && \
./build-mingw-w64-libraries.sh $TOOLCHAIN_PREFIX && \
./build-libcxx.sh $TOOLCHAIN_PREFIX && \
......
......@@ -51,7 +51,7 @@ fi
cd llvm-project
LIBCXX=$(pwd)/libcxx
LLVM_PATH="$(pwd)/llvm"
if [ -n "$(which ninja)" ]; then
CMAKE_GENERATOR="Ninja"
......@@ -101,6 +101,7 @@ build_all() {
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER_WORKS=TRUE \
-DCMAKE_CXX_COMPILER_WORKS=TRUE \
-DLLVM_PATH="$LLVM_PATH" \
-DLLVM_COMPILER_CHECKED=TRUE \
-DCMAKE_AR="$PREFIX/bin/llvm-ar" \
-DCMAKE_RANLIB="$PREFIX/bin/llvm-ranlib" \
......@@ -124,15 +125,17 @@ build_all() {
done
cd ..
cd libcxxabi
# Configure, but don't build, libcxx, so that libcxxabi has
# proper headers to refer to
cd libcxx
for arch in $ARCHS; do
[ -z "$CLEAN" ] || rm -rf build-$arch-$type
mkdir -p build-$arch-$type
cd build-$arch-$type
if [ "$type" = "shared" ]; then
LIBCXXABI_VISIBILITY_FLAGS="-D_LIBCPP_BUILDING_LIBRARY= -U_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"
LIBCXX_VISIBILITY_FLAGS="-D_LIBCXXABI_BUILDING_LIBRARY"
else
LIBCXXABI_VISIBILITY_FLAGS="-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"
LIBCXX_VISIBILITY_FLAGS="-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"
fi
cmake \
${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \
......@@ -147,31 +150,44 @@ build_all() {
-DLLVM_COMPILER_CHECKED=TRUE \
-DCMAKE_AR="$PREFIX/bin/llvm-ar" \
-DCMAKE_RANLIB="$PREFIX/bin/llvm-ranlib" \
-DLIBCXXABI_USE_COMPILER_RT=ON \
-DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
-DLIBCXXABI_ENABLE_THREADS=ON \
-DLIBCXXABI_TARGET_TRIPLE=$arch-w64-mingw32 \
-DLIBCXXABI_ENABLE_SHARED=OFF \
-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include \
-DLIBCXXABI_LIBDIR_SUFFIX="" \
-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS=OFF \
-DCXX_SUPPORTS_CXX_STD=TRUE \
-DCMAKE_CXX_FLAGS="$LIBCXXABI_VISIBILITY_FLAGS -D_LIBCPP_HAS_THREAD_API_WIN32" \
-DLLVM_PATH="$LLVM_PATH" \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_INSTALL_HEADERS=ON \
-DLIBCXX_ENABLE_EXCEPTIONS=ON \
-DLIBCXX_ENABLE_THREADS=ON \
-DLIBCXX_HAS_WIN32_THREAD_API=ON \
-DLIBCXX_ENABLE_MONOTONIC_CLOCK=ON \
-DLIBCXX_ENABLE_SHARED=$SHARED \
-DLIBCXX_ENABLE_STATIC=$STATIC \
-DLIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG=TRUE \
-DLIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB=TRUE \
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-DLIBCXX_ENABLE_FILESYSTEM=OFF \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE \
-DLIBCXX_ENABLE_NEW_DELETE_DEFINITIONS=ON \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi/include \
-DLIBCXX_CXX_ABI_LIBRARY_PATH=../../libcxxabi/build-$arch-$type/lib \
-DLIBCXX_LIBDIR_SUFFIX="" \
-DLIBCXX_INCLUDE_TESTS=FALSE \
-DCMAKE_CXX_FLAGS="$LIBCXX_VISIBILITY_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="-lunwind" \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=FALSE \
..
$BUILDCMD ${CORES+-j$CORES}
$BUILDCMD ${CORES+-j$CORES} generate-cxx-headers
cd ..
done
cd ..
cd libcxx
cd libcxxabi
for arch in $ARCHS; do
[ -z "$CLEAN" ] || rm -rf build-$arch-$type
mkdir -p build-$arch-$type
cd build-$arch-$type
if [ "$type" = "shared" ]; then
LIBCXX_VISIBILITY_FLAGS="-D_LIBCXXABI_BUILDING_LIBRARY"
LIBCXXABI_VISIBILITY_FLAGS="-D_LIBCPP_BUILDING_LIBRARY= -U_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"
else
LIBCXX_VISIBILITY_FLAGS="-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"
LIBCXXABI_VISIBILITY_FLAGS=""
fi
cmake \
${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \
......@@ -183,32 +199,30 @@ build_all() {
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER_WORKS=TRUE \
-DCMAKE_CXX_COMPILER_WORKS=TRUE \
-DLLVM_PATH="$LLVM_PATH" \
-DLLVM_COMPILER_CHECKED=TRUE \
-DCMAKE_AR="$PREFIX/bin/llvm-ar" \
-DCMAKE_RANLIB="$PREFIX/bin/llvm-ranlib" \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_INSTALL_HEADERS=ON \
-DLIBCXX_ENABLE_EXCEPTIONS=ON \
-DLIBCXX_ENABLE_THREADS=ON \
-DLIBCXX_HAS_WIN32_THREAD_API=ON \
-DLIBCXX_ENABLE_MONOTONIC_CLOCK=ON \
-DLIBCXX_ENABLE_SHARED=$SHARED \
-DLIBCXX_ENABLE_STATIC=$STATIC \
-DLIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG=TRUE \
-DLIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB=TRUE \
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-DLIBCXX_ENABLE_FILESYSTEM=OFF \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi/include \
-DLIBCXX_CXX_ABI_LIBRARY_PATH=../../libcxxabi/build-$arch-$type/lib \
-DLIBCXX_LIBDIR_SUFFIX="" \
-DLIBCXX_INCLUDE_TESTS=FALSE \
-DCMAKE_CXX_FLAGS="$LIBCXX_VISIBILITY_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="-lunwind" \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=FALSE \
-DLIBCXXABI_USE_COMPILER_RT=ON \
-DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
-DLIBCXXABI_ENABLE_THREADS=ON \
-DLIBCXXABI_TARGET_TRIPLE=$arch-w64-mingw32 \
-DLIBCXXABI_ENABLE_SHARED=OFF \
-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/build-$arch-$type/include/c++/v1 \
-DLIBCXXABI_LIBDIR_SUFFIX="" \
-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS=OFF \
-DCXX_SUPPORTS_CXX_STD=TRUE \
-DCMAKE_CXX_FLAGS="$LIBCXXABI_VISIBILITY_FLAGS" \
..
$BUILDCMD ${CORES+-j$CORES}
cd ..
done
cd ..
cd libcxx
for arch in $ARCHS; do
cd build-$arch-$type
$BUILDCMD ${CORES+-j$CORES}
$BUILDCMD install
if [ "$type" = "shared" ]; then
llvm-ar qcsL \
......
......@@ -16,7 +16,7 @@
set -e
: ${LLVM_VERSION:=llvmorg-10.0.0}
: ${LLVM_VERSION:=llvmorg-11.0.0}
ASSERTS=OFF
BUILDDIR=build
unset HOST
......@@ -109,10 +109,14 @@ if [ -n "$HOST" ]; then
native=$(find_native_tools)
if [ -n "$native" ]; then
CMAKEFLAGS="$CMAKEFLAGS -DLLVM_TABLEGEN=$native/llvm-tblgen"
CMAKEFLAGS="$CMAKEFLAGS -DCLANG_TABLEGEN=$native/clang-tblgen"
CMAKEFLAGS="$CMAKEFLAGS -DLLDB_TABLEGEN=$native/lldb-tblgen"
CMAKEFLAGS="$CMAKEFLAGS -DLLVM_CONFIG_PATH=$native/llvm-config"
suffix=""
if [ -f $native/llvm-tblgen.exe ]; then
suffix=".exe"
fi
CMAKEFLAGS="$CMAKEFLAGS -DLLVM_TABLEGEN=$native/llvm-tblgen$suffix"
CMAKEFLAGS="$CMAKEFLAGS -DCLANG_TABLEGEN=$native/clang-tblgen$suffix"
CMAKEFLAGS="$CMAKEFLAGS -DLLDB_TABLEGEN=$native/lldb-tblgen$suffix"
CMAKEFLAGS="$CMAKEFLAGS -DLLVM_CONFIG_PATH=$native/llvm-config$suffix"
fi
CROSS_ROOT=$(cd $(dirname $(which $HOST-gcc))/../$HOST && pwd)
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH=$CROSS_ROOT"
......
......@@ -30,8 +30,12 @@ export PATH="$PREFIX/bin:$PATH"
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
if [ ! -d mingw-w64 ] || [ -n "$SYNC" ]; then
CHECKOUT_ONLY=1 ./build-mingw-w64.sh
fi
cd mingw-w64/mingw-w64-libraries
for lib in winpthreads winstorecompat; do
for lib in winstorecompat; do
cd $lib
for arch in $ARCHS; do
[ -z "$CLEAN" ] || rm -rf build-$arch
......
#!/bin/sh
#
# Copyright (c) 2018 Martin Storsjo
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
set -e
unset HOST
while [ $# -gt 0 ]; do
case "$1" in
--skip-include-triplet-prefix)
SKIP_INCLUDE_TRIPLET_PREFIX=1
;;
--host=*)
HOST="${1#*=}"
;;
*)
PREFIX="$1"
;;
esac
shift
done
if [ -z "$CHECKOUT_ONLY" ]; then
if [ -z "$PREFIX" ]; then
echo $0 [--skip-include-triplet-prefix] [--host=<triple>] dest
exit 1
fi
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
fi
if [ ! -d mingw-w64 ] || [ -n "$SYNC" ]; then
CHECKOUT_ONLY=1 ./build-mingw-w64.sh
fi
cd mingw-w64
MAKE=make
if [ "$(which gmake)" != "" ]; then
MAKE=gmake
fi
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
: ${TARGET_OSES:=${TOOLCHAIN_TARGET_OSES-mingw32 mingw32uwp}}
if [ -n "$HOST" ]; then
CONFIGFLAGS="$CONFIGFLAGS --host=$HOST"
CROSS_NAME=-$HOST
EXEEXT=.exe
else
case $(uname) in
MINGW*)
EXEEXT=.exe
;;
*)
;;
esac
fi
if [ -n "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
INCLUDEDIR="$PREFIX/include"
else
INCLUDEDIR="$PREFIX/generic-w64-mingw32/include"
fi
ANY_ARCH=$(echo $ARCHS | awk '{print $1}')
cd mingw-w64-tools/widl
[ -z "$CLEAN" ] || rm -rf build${CROSS_NAME}
mkdir -p build${CROSS_NAME}
cd build${CROSS_NAME}
../configure --prefix="$PREFIX" --target=$ANY_ARCH-w64-mingw32 --with-widl-includedir="$INCLUDEDIR" $CONFIGFLAGS
$MAKE -j$CORES
$MAKE install-strip
cd ..
cd "$PREFIX/bin"
# The build above produced $ANY_ARCH-w64-mingw32-widl, add symlinks to it
# with other prefixes.
for arch in $ARCHS; do
for target_os in $TARGET_OSES; do
if [ "$arch" != "$ANY_ARCH" ] || [ "$target_os" != "mingw32" ]; then
ln -sf $ANY_ARCH-w64-mingw32-widl$EXEEXT $arch-w64-$target_os-widl$EXEEXT
fi
done
done
if [ -n "$EXEEXT" ]; then
# In a build of the tools for windows, we also want to provide an
# unprefixed one. If crosscompiling, we know what the native arch is;
# $HOST. If building natively, check the built clang to see what the
# default arch is.
if [ -z "$HOST" ] && [ -f clang$EXEEXT ]; then
HOST=$(./clang -dumpmachine | sed 's/-.*//')-w64-mingw32
fi
if [ -n "$HOST" ]; then
HOST_ARCH="${HOST%%-*}"
# Only install an unprefixed symlink if $HOST is one of the architectures
# we are installing wrappers for.
case $ARCHS in
*$HOST_ARCH*)
ln -sf $HOST-widl$EXEEXT widl$EXEEXT
;;
esac
fi
fi
......@@ -18,8 +18,7 @@ set -e
: ${DEFAULT_WIN32_WINNT:=0x601}
: ${DEFAULT_MSVCRT:=ucrt}
: ${MINGW_W64_VERSION:=823bc20b3c9aea724acbd60400a923c35757b08c}
unset HOST
: ${MINGW_W64_VERSION:=ecb4ff5498dfedd6abcbadb889b84fab19ee57b2}
while [ $# -gt 0 ]; do
case "$1" in
......@@ -32,45 +31,24 @@ while [ $# -gt 0 ]; do
--with-default-msvcrt=*)
DEFAULT_MSVCRT="${1#*=}"
;;
--host=*)
HOST="${1#*=}"
;;
*)
PREFIX="$1"
;;
esac
shift
done
if [ -z "$PREFIX" ]; then
echo $0 [--skip-include-triplet-prefix] [--with-default-win32-winnt=0x601] [--with-default-msvcrt=ucrt] [--host=<triple>] dest
exit 1
fi
MAKE=make
if [ "$(which gmake)" != "" ]; then
MAKE=gmake
fi
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
if [ -z "$CHECKOUT_ONLY" ]; then
if [ -z "$PREFIX" ]; then
echo $0 [--skip-include-triplet-prefix] [--with-default-win32-winnt=0x601] [--with-default-msvcrt=ucrt] dest
exit 1
fi
ORIGPATH="$PATH"
if [ -z "$HOST" ]; then
# The newly built toolchain isn't crosscompiled; add it to the path.
export PATH="$PREFIX/bin:$PATH"
else
# Crosscompiling the toolchain itself; the cross compiler is
# expected to already be in $PATH.
true
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
fi
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
if [ ! -d mingw-w64 ]; then
git clone git://git.code.sf.net/p/mingw-w64/mingw-w64
git clone https://git.code.sf.net/p/mingw-w64/mingw-w64
CHECKOUT=1
fi
......@@ -79,111 +57,68 @@ cd mingw-w64
if [ -n "$SYNC" ] || [ -n "$CHECKOUT" ]; then
[ -z "$SYNC" ] || git fetch
git checkout $MINGW_W64_VERSION
autoreconf -vif
fi
# If crosscompiling the toolchain itself, we already have a mingw-w64
# runtime and don't need to rebuild it.
if [ -z "$HOST" ]; then
if [ -z "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
HEADER_ROOT="$PREFIX/generic-w64-mingw32"
else
HEADER_ROOT="$PREFIX"
fi
[ -z "$CHECKOUT_ONLY" ] || exit 0
cd mingw-w64-headers
[ -z "$CLEAN" ] || rm -rf build
mkdir -p build
cd build
../configure --prefix="$HEADER_ROOT" \
--enable-idl --with-default-win32-winnt=$DEFAULT_WIN32_WINNT --with-default-msvcrt=$DEFAULT_MSVCRT INSTALL="install -C"
$MAKE install
cd ../..
if [ -z "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
for arch in $ARCHS; do
mkdir -p "$PREFIX/$arch-w64-mingw32"
if [ ! -e "$PREFIX/$arch-w64-mingw32/include" ]; then
ln -sfn ../generic-w64-mingw32/include "$PREFIX/$arch-w64-mingw32/include"
fi
done
fi
MAKE=make
if [ "$(which gmake)" != "" ]; then
MAKE=gmake
fi
cd mingw-w64-crt
export PATH="$PREFIX/bin:$PATH"
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
if [ -z "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
HEADER_ROOT="$PREFIX/generic-w64-mingw32"
else
HEADER_ROOT="$PREFIX"
fi
cd mingw-w64-headers
[ -z "$CLEAN" ] || rm -rf build
mkdir -p build
cd build
../configure --prefix="$HEADER_ROOT" \
--enable-idl --with-default-win32-winnt=$DEFAULT_WIN32_WINNT --with-default-msvcrt=$DEFAULT_MSVCRT INSTALL="install -C"
$MAKE install
cd ../..
if [ -z "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
for arch in $ARCHS; do
[ -z "$CLEAN" ] || rm -rf build-$arch
mkdir -p build-$arch
cd build-$arch
case $arch in
armv7)
FLAGS="--disable-lib32 --disable-lib64 --enable-libarm32"
;;
aarch64)
FLAGS="--disable-lib32 --disable-lib64 --enable-libarm64"
;;
i686)
FLAGS="--enable-lib32 --disable-lib64"
;;
x86_64)
FLAGS="--disable-lib32 --enable-lib64"
;;
esac
FLAGS="$FLAGS --with-default-msvcrt=$DEFAULT_MSVCRT"
../configure --host=$arch-w64-mingw32 --prefix="$PREFIX/$arch-w64-mingw32" $FLAGS
$MAKE -j$CORES
$MAKE install
cd ..
mkdir -p "$PREFIX/$arch-w64-mingw32"
if [ ! -e "$PREFIX/$arch-w64-mingw32/include" ]; then
ln -sfn ../generic-w64-mingw32/include "$PREFIX/$arch-w64-mingw32/include"
fi
done
cd ..
fi
if [ -n "$HOST" ]; then
CONFIGFLAGS="$CONFIGFLAGS --host=$HOST"
CROSS_NAME=$HOST-
EXEEXT=.exe
else
case $(uname) in
MINGW*)
EXEEXT=.exe
cd mingw-w64-crt
for arch in $ARCHS; do
[ -z "$CLEAN" ] || rm -rf build-$arch
mkdir -p build-$arch
cd build-$arch
case $arch in
armv7)
FLAGS="--disable-lib32 --disable-lib64 --enable-libarm32"
;;
*)
aarch64)
FLAGS="--disable-lib32 --disable-lib64 --enable-libarm64"
;;
i686)
FLAGS="--enable-lib32 --disable-lib64"
;;
x86_64)
FLAGS="--disable-lib32 --enable-lib64"
;;
esac
fi
if [ -n "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
CONFIGFLAGS="$CONFIGFLAGS --with-widl-includedir=$PREFIX/include"
# If using the same includedir for all archs, it's enough to
# build one single binary.
ALL_ARCHS="$ARCHS"
ARCHS=x86_64
fi
# If building on windows, we've installed prefixless wrappers - these break
# building widl, as the toolchain isn't functional yet. Restore the original
# path.
export PATH="$ORIGPATH"
cd mingw-w64-tools/widl
for arch in $ARCHS; do
[ -z "$CLEAN" ] || rm -rf build-$CROSS_NAME$arch
mkdir -p build-$CROSS_NAME$arch
cd build-$CROSS_NAME$arch
../configure --prefix="$PREFIX" --target=$arch-w64-mingw32 $CONFIGFLAGS
FLAGS="$FLAGS --with-default-msvcrt=$DEFAULT_MSVCRT"
../configure --host=$arch-w64-mingw32 --prefix="$PREFIX/$arch-w64-mingw32" $FLAGS
$MAKE -j$CORES
$MAKE install-strip
$MAKE install
cd ..
done
cd "$PREFIX/bin"
if [ -n "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
for arch in $ALL_ARCHS; do
if [ "$arch" != "$ARCHS" ]; then
ln -sf $ARCHS-w64-mingw32-widl$EXEEXT $arch-w64-mingw32-widl$EXEEXT
fi
done
fi
if [ -n "$EXEEXT" ]; then
if [ -z "$HOST" ] && [ -f clang$EXEEXT ]; then
HOST=$(./clang -dumpmachine | sed 's/-.*//')-w64-mingw32
fi
if [ -n "$HOST" ]; then
ln -sf $HOST-widl$EXEEXT widl$EXEEXT
fi
fi
cd ..
......@@ -82,7 +82,7 @@ fi
cd "$PREFIX/bin"
for arch in $ARCHS; do
for target_os in $TARGET_OSES; do
for exec in clang clang++ gcc g++ cc c99 c11 c++; do
for exec in clang clang++ gcc g++ cc c99 c11 c++ as; do
ln -sf clang-target-wrapper$CTW_SUFFIX $arch-w64-$target_os-$exec$CTW_LINK_SUFFIX
done
for exec in addr2line ar ranlib nm objcopy strings strip; do
......
......@@ -56,11 +56,7 @@ for i in bugpoint c-index-test clang-* diagtool dsymutil git-clang-format hmapto
basename=$i
if [ -n "$EXEEXT" ]; then
# Some in the list are expanded globs, some are plain names we list.
case $i in
*$EXEEXT)
basename=$(echo $i | sed s/$EXEEXT//)
;;
esac
basename=${i%$EXEEXT}
i=$basename
if [ -e $basename$EXEEXT ]; then
i=$basename$EXEEXT
......@@ -119,7 +115,7 @@ fi
cd ..
rm -rf share libexec
cd include
rm -rf clang clang-c lld llvm llvm-c