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

llvm-mingw: Update from upstream

parent a2f0db15
......@@ -19,6 +19,9 @@ if [ -z "$PREFIX" ]; then
echo $0 [--build-sanitizers] dest
exit 1
fi
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
......@@ -42,7 +45,7 @@ cd compiler-rt
if [ -n "$SYNC" ] || [ -n "$CHECKOUT" ]; then
[ -z "$SYNC" ] || git fetch
git checkout 0492c25c247e31fe23570fe0cf6e9801301ab069
git checkout 8b2ba6185b1df7b9ebaae91cc831c9be16eeefa0
fi
for arch in $ARCHS; do
......@@ -67,9 +70,19 @@ for arch in $ARCHS; do
libarchname=i386
;;
esac
case $(uname) in
MINGW*)
CMAKE_GENERATOR="MSYS Makefiles"
;;
*)
;;
esac
mkdir -p build-$arch$BUILD_SUFFIX
cd build-$arch$BUILD_SUFFIX
cmake \
${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=$arch-w64-mingw32-clang++ \
......
......@@ -23,6 +23,10 @@ if [ -z "$PREFIX" ]; then
echo $0 [--disable-shared] [--disable-static] dest
exit 1
fi
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
......@@ -45,7 +49,7 @@ fi
if [ -n "$SYNC" ] || [ -n "$CHECKOUT_LIBUNWIND" ]; then
cd libunwind
[ -z "$SYNC" ] || git fetch
git checkout 1f89d78bb488bc71cfdee8281fc0834e9fbe5dce
git checkout 03a10740898eeb2b0c7a7c6bea3e293a221309a1
cd ..
fi
if [ -n "$SYNC" ] || [ -n "$CHECKOUT_LIBCXXABI" ]; then
......@@ -64,6 +68,14 @@ fi
LIBCXX=$(pwd)/libcxx
MERGE_ARCHIVES=$(pwd)/merge-archives.sh
case $(uname) in
MINGW*)
CMAKE_GENERATOR="MSYS Makefiles"
;;
*)
;;
esac
build_all() {
type="$1"
if [ "$type" = "shared" ]; then
......@@ -82,6 +94,7 @@ build_all() {
# to the compiler flags; manually add it here to avoid noisy warnings
# that normally are suppressed.
cmake \
${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX/$arch-w64-mingw32 \
-DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \
......@@ -107,6 +120,7 @@ build_all() {
make -j$CORES
make install
if [ "$type" = "shared" ]; then
mkdir -p $PREFIX/$arch-w64-mingw32/bin
cp lib/libunwind.dll $PREFIX/$arch-w64-mingw32/bin
else
# Merge libpsapi.a into the static library libunwind.a, to
......@@ -132,6 +146,7 @@ build_all() {
LIBCXXABI_VISIBILITY_FLAGS="-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"
fi
cmake \
${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX/$arch-w64-mingw32 \
-DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \
......@@ -169,6 +184,7 @@ build_all() {
LIBCXX_VISIBILITY_FLAGS="-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"
fi
cmake \
${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX/$arch-w64-mingw32 \
-DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \
......@@ -192,7 +208,6 @@ build_all() {
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-DLIBCXX_ENABLE_FILESYSTEM=OFF \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE \
-DLIBCXX_ABI_UNSTABLE=TRUE \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi/include \
-DLIBCXX_CXX_ABI_LIBRARY_PATH=../../libcxxabi/build-$arch-$type/lib \
......
......@@ -7,6 +7,8 @@ if [ $# -lt 1 ]; then
exit 1
fi
PREFIX="$1"
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
......
......@@ -22,6 +22,9 @@ if [ -z "$PREFIX" ]; then
exit 1
fi
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
......@@ -64,8 +67,16 @@ if [ -n "$SYNC" ] || [ -n "$CHECKOUT" ]; then
fi
if [ -n "$(which ninja)" ]; then
CMAKE_GENERATOR="-G Ninja"
CMAKE_GENERATOR="Ninja"
NINJA=1
else
case $(uname) in
MINGW*)
CMAKE_GENERATOR="MSYS Makefiles"
;;
*)
;;
esac
fi
if [ -n "$HOST" ]; then
......@@ -120,7 +131,7 @@ cd llvm
mkdir -p $BUILDDIR
cd $BUILDDIR
cmake \
$CMAKE_GENERATOR \
${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=$ASSERTS \
......
......@@ -7,6 +7,8 @@ if [ $# -lt 1 ]; then
exit 1
fi
PREFIX="$1"
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
export PATH=$PREFIX/bin:$PATH
: ${CORES:=$(nproc 2>/dev/null)}
......
......@@ -14,6 +14,10 @@ if [ -z "$PREFIX" ]; then
echo $0 [--skip-include-triplet-prefix] dest
exit 1
fi
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
if [ -z "$HOST" ]; then
# The newly built toolchain isn't crosscompiled; add it to the path.
export PATH=$PREFIX/bin:$PATH
......@@ -95,6 +99,14 @@ 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
CONFIGFLAGS="$CONFIGFLAGS --with-widl-includedir=$PREFIX/include"
......
......@@ -7,6 +7,8 @@ if [ $# -lt 1 ]; then
exit 1
fi
PREFIX="$1"
mkdir -p "$PREFIX"
PREFIX="$(cd "$PREFIX" && pwd)"
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
......@@ -65,15 +67,16 @@ for arch in $ARCHS; do
done
done
if [ -n "$EXEEXT" ]; then
if [ ! -L clang$EXEEXT ]; then
if [ ! -L clang$EXEEXT ] && [ -f clang$EXEEXT ] && [ ! -f clang-$CLANG_MAJOR$EXEEXT ]; then
mv clang$EXEEXT clang-$CLANG_MAJOR$EXEEXT
fi
if [ -n "$HOST" ]; then
for exec in clang clang++ gcc g++ cc c99 c11 c++ ar ranlib nm strings widl windres; do
ln -sf $HOST-$exec$EXEEXT $exec$EXEEXT
done
for exec in ld objdump dlltool objcopy strip; do
ln -sf $HOST-$exec $exec
done
if [ -z "$HOST" ]; then
HOST=$(./clang-$CLANG_MAJOR -dumpmachine | sed 's/-.*//')-w64-mingw32
fi
for exec in clang clang++ gcc g++ cc c99 c11 c++ ar ranlib nm strings widl windres; do
ln -sf $HOST-$exec$EXEEXT $exec$EXEEXT
done
for exec in ld objdump dlltool objcopy strip; do
ln -sf $HOST-$exec $exec
done
fi
......@@ -18,7 +18,14 @@ rm -f $SCRIPT
echo "CREATE $OUT" >> $SCRIPT
while [ $# -gt 0 ]; do
echo "ADDLIB $1" >> $SCRIPT
case $(uname) in
MINGW*)
echo "ADDLIB $(cygpath -w $1)" >> $SCRIPT
;;
*)
echo "ADDLIB $1" >> $SCRIPT
;;
esac
shift
done
echo "SAVE" >> $SCRIPT
......
......@@ -9,6 +9,14 @@ fi
PREFIX="$1"
cd "$PREFIX"
case $(uname) in
MINGW*)
EXEEXT=.exe
;;
*)
;;
esac
cd bin
for i in bugpoint c-index-test clang-* diagtool dsymutil git-clang-format hmaptool ld64.lld llc lli llvm-* obj2yaml opt sancov sanstats scan-build scan-view verify-uselistorder wasm-ld yaml2obj libclang.dll LTO.dll *.bat; do
basename=$i
......
......@@ -175,6 +175,7 @@ static void print_help(void) {
" -D, --define <arg[=val]> Define to pass to preprocessor.\n"
" -U, --undefine <arg[=val]> Undefine to pass to preprocessor.\n"
" -c, --codepage <arg> Default codepage to use when reading an rc file (0x0-0xffff).\n"
" --use-temp-file Use a temporary file for the preprocessing output.\n"
" -v, --verbose Enable verbose output.\n"
" -V, --version Display version.\n"
" -h, --help Display this message and exit.\n"
......@@ -325,6 +326,8 @@ int _tmain(int argc, TCHAR* argv[]) {
print_version();
} else IF_MATCH_EITHER("-h", "--help") {
print_help();
} else if (!_tcscmp(argv[i], _T("--use-temp-file"))) {
// No-op, we use a temp file by default.
} else if (_tcsstart(argv[i], _T("-"))) {
error(basename, _T("unrecognized option: `"TS"'"), argv[i]);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment