summaryrefslogtreecommitdiffstats
path: root/source/d/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'source/d/llvm')
-rwxr-xr-xsource/d/llvm/llvm.SlackBuild56
-rw-r--r--source/d/llvm/llvm.url56
-rw-r--r--source/d/llvm/missing-runtime-modules/HandleFlags.cmake113
-rw-r--r--source/d/llvm/missing-runtime-modules/WarningFlags.cmake77
4 files changed, 255 insertions, 47 deletions
diff --git a/source/d/llvm/llvm.SlackBuild b/source/d/llvm/llvm.SlackBuild
index af3baf881..f285bf332 100755
--- a/source/d/llvm/llvm.SlackBuild
+++ b/source/d/llvm/llvm.SlackBuild
@@ -65,7 +65,7 @@ BUILDDIR=${TMP}/llvm-build-${VERSION}
# Ignore that which should be ignored to avoid long build times and
# massive warning spew:
-IGNORE_GNU_EXTENSIONS=${IGNORE_GNU_EXTENSIONS:--Wno-unknown-warning-option -Wno-gnu-line-marker -Wno-gnu-anonymous-struct}
+IGNORE_GNU_EXTENSIONS=${IGNORE_GNU_EXTENSIONS:--Wno-unknown-warning-option -Wno-gnu-line-marker -Wno-gnu-anonymous-struct -Wno-gnu-include-next}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686 $IGNORE_GNU_EXTENSIONS"
@@ -117,47 +117,58 @@ touch configure
chmod 755 configure
# Extract and rename some support files:
-tar xvf $CWD/cmake-$VERSION.src.tar.xz || exit 1
+echo "Extracting $CWD/cmake-$VERSION.src.tar.xz..."
+tar xf $CWD/cmake-$VERSION.src.tar.xz || exit 1
mv cmake-$VERSION.src cmake
-tar xvf $CWD/third-party-$VERSION.src.tar.xz || exit 1
+echo "Extracting $CWD/third-party-$VERSION.src.tar.xz..."
+tar xf $CWD/third-party-$VERSION.src.tar.xz || exit 1
mv third-party-$VERSION.src third-party
rm -rf $PKGNAM-${VERSION}.src $PKGNAM-${VERSION}
-tar xvf $CWD/$PKGNAM-$VERSION.src.tar.xz || exit 1
+echo "Extracting $CWD/$PKGNAM-$VERSION.src.tar.xz..."
+tar xf $CWD/$PKGNAM-$VERSION.src.tar.xz || exit 1
cd $PKGNAM-${VERSION}.src/tools || cd $PKGNAM-${VERSION}/tools || exit 1
- tar xvf $CWD/clang-$VERSION.src.tar.xz || exit 1
+ echo "Extracting $CWD/clang-$VERSION.src.tar.xz..."
+ tar xf $CWD/clang-$VERSION.src.tar.xz || exit 1
mv clang-${VERSION} clang 2>/dev/null || mv clang-${VERSION}.src clang || exit 1
- #tar xvf $CWD/flang-$VERSION.src.tar.xz || exit 1
+ #echo "Extracting $CWD/flang-$VERSION.src.tar.xz..."
+ #tar xf $CWD/flang-$VERSION.src.tar.xz || exit 1
#mv flang-${VERSION} flang 2>/dev/null || mv flang-${VERSION}.src flang || exit 1
- tar xvf $CWD/lldb-$VERSION.src.tar.xz || exit 1
+ echo "Extracting $CWD/lldb-$VERSION.src.tar.xz..."
+ tar xf $CWD/lldb-$VERSION.src.tar.xz || exit 1
mv lldb-${VERSION} lldb 2>/dev/null || mv lldb-${VERSION}.src lldb || exit 1
- tar xvf $CWD/lld-$VERSION.src.tar.xz || exit 1
+ echo "Extracting $CWD/lld-$VERSION.src.tar.xz..."
+ tar xf $CWD/lld-$VERSION.src.tar.xz || exit 1
mv lld-${VERSION} lld 2>/dev/null || mv lld-${VERSION}.src lld || exit 1
cd ../
cd tools/clang/tools || exit 1
- tar xvf $CWD/clang-tools-extra-$VERSION.src.tar.xz || exit 1
+ echo "Extracting $CWD/clang-tools-extra-$VERSION.src.tar.xz..."
+ tar xf $CWD/clang-tools-extra-$VERSION.src.tar.xz || exit 1
mv clang-tools-extra-${VERSION} extra 2>/dev/null \
|| mv clang-tools-extra-${VERSION}.src extra || exit 1
- ## HACK # Otherwise the build fails because files aren't found.
- #rm -rf $TMP/clang-tools-extra
- #cp -a extra $TMP/clang-tools-extra
cd ../../../
cd projects || exit 1
- tar xvf $CWD/compiler-rt-$VERSION.src.tar.xz || exit 1
+ echo "Extracting $CWD/compiler-rt-$VERSION.src.tar.xz..."
+ tar xf $CWD/compiler-rt-$VERSION.src.tar.xz || exit 1
mv compiler-rt-${VERSION} compiler-rt 2>/dev/null || mv compiler-rt-${VERSION}.src compiler-rt || exit 1
- tar xvf $CWD/openmp-$VERSION.src.tar.xz || exit 1
+ echo "Extracting $CWD/openmp-$VERSION.src.tar.xz..."
+ tar xf $CWD/openmp-$VERSION.src.tar.xz || exit 1
mv openmp-${VERSION} openmp 2>/dev/null || mv openmp-${VERSION}.src openmp || exit 1
- tar xvf $CWD/libcxx-${VERSION}.src.tar.xz || exit 1
+ echo "Extracting $CWD/libcxx-${VERSION}.src.tar.xz..."
+ tar xf $CWD/libcxx-${VERSION}.src.tar.xz || exit 1
mv libcxx-${VERSION} libcxx 2>/dev/null || mv libcxx-${VERSION}.src libcxx || exit 1
- tar xvf $CWD/libcxxabi-${VERSION}.src.tar.xz || exit 1
+ echo "Extracting $CWD/libcxxabi-${VERSION}.src.tar.xz..."
+ tar xf $CWD/libcxxabi-${VERSION}.src.tar.xz || exit 1
mv libcxxabi-${VERSION} libcxxabi 2>/dev/null || mv libcxxabi-${VERSION}.src libcxxabi || exit 1
- tar xvf $CWD/polly-$VERSION.src.tar.xz || exit 1
+ echo "Extracting $CWD/polly-$VERSION.src.tar.xz..."
+ tar xf $CWD/polly-$VERSION.src.tar.xz || exit 1
mv polly-${VERSION} polly 2>/dev/null || mv polly-${VERSION}.src polly || exit 1
# We just need a header file from this...
- tar xvf $CWD/libunwind-${VERSION}.src.tar.xz || exit 1
+ echo "Extracting $CWD/libunwind-${VERSION}.src.tar.xz..."
+ tar xf $CWD/libunwind-${VERSION}.src.tar.xz || exit 1
mv libunwind-${VERSION}.src libunwind || mv libunwind-${VERSION} libunwind || exit 1
cd ../
@@ -171,10 +182,17 @@ if [ -f ./tools/lldb/source/Utility/CMakeLists.txt ]; then
fi
fi
-# This hackish link seems to be required...
+# These files are not present for some reason, but they were found in a git
+# pull of the entire project:
+cp -a $CWD/missing-runtime-modules/*.cmake ../cmake/Modules/
+
+# These hackish links seem to be required...
cd ..
ln -sf */runtimes .
cd -
+cd projects
+ln -sf ../../cmake .
+cd -
chown -R root:root .
find . \
diff --git a/source/d/llvm/llvm.url b/source/d/llvm/llvm.url
index 2570e8c32..d91aa60a6 100644
--- a/source/d/llvm/llvm.url
+++ b/source/d/llvm/llvm.url
@@ -1,29 +1,29 @@
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/llvm-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/clang-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/clang-tools-extra-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/compiler-rt-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/flang-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/lldb-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/openmp-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/polly-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/libcxx-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/libcxxabi-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/lld-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/libunwind-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/cmake-16.0.6.src.tar.xz
-https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/third-party-16.0.6.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/llvm-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/clang-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/clang-tools-extra-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/compiler-rt-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/flang-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/lldb-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/openmp-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/polly-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/libcxx-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/libcxxabi-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/lld-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/libunwind-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/cmake-17.0.1.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/third-party-17.0.1.src.tar.xz
-#http://llvm.org/releases/16.0.6/llvm-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/clang-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/clang-tools-extra-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/compiler-rt-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/flang-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/lldb-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/openmp-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/polly-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/libcxx-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/libcxxabi-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/lld-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/libunwind-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/cmake-16.0.6.src.tar.xz
-#http://llvm.org/releases/16.0.6/third-party-16.0.6.src.tar.xz
+#http://llvm.org/releases/17.0.1/llvm-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/clang-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/clang-tools-extra-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/compiler-rt-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/flang-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/lldb-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/openmp-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/polly-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/libcxx-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/libcxxabi-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/lld-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/libunwind-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/cmake-17.0.1.src.tar.xz
+#http://llvm.org/releases/17.0.1/third-party-17.0.1.src.tar.xz
diff --git a/source/d/llvm/missing-runtime-modules/HandleFlags.cmake b/source/d/llvm/missing-runtime-modules/HandleFlags.cmake
new file mode 100644
index 000000000..4a62b6716
--- /dev/null
+++ b/source/d/llvm/missing-runtime-modules/HandleFlags.cmake
@@ -0,0 +1,113 @@
+
+include(CheckCXXCompilerFlag)
+
+unset(add_flag_if_supported)
+
+# Mangle the name of a compiler flag into a valid CMake identifier.
+# Ex: --std=c++11 -> STD_EQ_CXX11
+macro(mangle_name str output)
+ string(STRIP "${str}" strippedStr)
+ string(REGEX REPLACE "^/" "" strippedStr "${strippedStr}")
+ string(REGEX REPLACE "^-+" "" strippedStr "${strippedStr}")
+ string(REGEX REPLACE "-+$" "" strippedStr "${strippedStr}")
+ string(REPLACE "-" "_" strippedStr "${strippedStr}")
+ string(REPLACE "=" "_EQ_" strippedStr "${strippedStr}")
+ string(REPLACE "+" "X" strippedStr "${strippedStr}")
+ string(TOUPPER "${strippedStr}" ${output})
+endmacro()
+
+# Remove a list of flags from all CMake variables that affect compile flags.
+# This can be used to remove unwanted flags specified on the command line
+# or added in other parts of LLVM's cmake configuration.
+macro(remove_flags)
+ foreach(var ${ARGN})
+ string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+ string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
+ string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+ string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ string(REPLACE "${var}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ string(REPLACE "${var}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ string(REPLACE "${var}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ string(REPLACE "${var}" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
+ string(REPLACE "${var}" "" CMAKE_SHARED_MODULE_FLAGS "${CMAKE_SHARED_MODULE_FLAGS}")
+ remove_definitions(${var})
+ endforeach()
+endmacro(remove_flags)
+
+macro(check_flag_supported flag)
+ mangle_name("${flag}" flagname)
+ check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
+endmacro()
+
+macro(append_flags DEST)
+ foreach(value ${ARGN})
+ list(APPEND ${DEST} ${value})
+ list(APPEND ${DEST} ${value})
+ endforeach()
+endmacro()
+
+# If the specified 'condition' is true then append the specified list of flags to DEST
+macro(append_flags_if condition DEST)
+ if (${condition})
+ list(APPEND ${DEST} ${ARGN})
+ endif()
+endmacro()
+
+# Add each flag in the list specified by DEST if that flag is supported by the current compiler.
+macro(append_flags_if_supported DEST)
+ foreach(flag ${ARGN})
+ mangle_name("${flag}" flagname)
+ check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
+ append_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${DEST} ${flag})
+ endforeach()
+endmacro()
+
+# Add a macro definition if condition is true.
+macro(define_if condition def)
+ if (${condition})
+ add_definitions(${def})
+ endif()
+endmacro()
+
+# Add a macro definition if condition is not true.
+macro(define_if_not condition def)
+ if (NOT ${condition})
+ add_definitions(${def})
+ endif()
+endmacro()
+
+# Add a macro definition to the __config_site file if the specified condition
+# is 'true'. Note that '-D${def}' is not added. Instead it is expected that
+# the build include the '__config_site' header.
+macro(config_define_if condition def)
+ if (${condition})
+ set(${def} ON)
+ endif()
+endmacro()
+
+macro(config_define_if_not condition def)
+ if (NOT ${condition})
+ set(${def} ON)
+ endif()
+endmacro()
+
+macro(config_define value def)
+ set(${def} ${value})
+endmacro()
+
+# Turn a comma separated CMake list into a space separated string.
+macro(split_list listname)
+ string(REPLACE ";" " " ${listname} "${${listname}}")
+endmacro()
+
+# For each specified flag, add that compile flag to the provided target.
+# The flags are added with the given visibility, i.e. PUBLIC|PRIVATE|INTERFACE.
+function(target_add_compile_flags_if_supported target visibility)
+ foreach(flag ${ARGN})
+ mangle_name("${flag}" flagname)
+ check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
+ if (CXX_SUPPORTS_${flagname}_FLAG)
+ target_compile_options(${target} ${visibility} ${flag})
+ endif()
+ endforeach()
+endfunction()
diff --git a/source/d/llvm/missing-runtime-modules/WarningFlags.cmake b/source/d/llvm/missing-runtime-modules/WarningFlags.cmake
new file mode 100644
index 000000000..d06409841
--- /dev/null
+++ b/source/d/llvm/missing-runtime-modules/WarningFlags.cmake
@@ -0,0 +1,77 @@
+include(HandleFlags)
+
+# Warning flags ===============================================================
+function(cxx_add_warning_flags target enable_werror enable_pedantic)
+ target_compile_definitions(${target} PUBLIC -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+ if (MSVC)
+ # -W4 is the cl.exe/clang-cl equivalent of -Wall. (In cl.exe and clang-cl,
+ # -Wall is equivalent to -Weverything in GCC style compiler drivers.)
+ target_add_compile_flags_if_supported(${target} PRIVATE -W4)
+ else()
+ target_add_compile_flags_if_supported(${target} PRIVATE -Wall)
+ endif()
+ # TODO: Should -Wconversion be enabled?
+ target_add_compile_flags_if_supported(${target} PRIVATE
+ -Wextra
+ -Wnewline-eof
+ -Wshadow
+ -Wwrite-strings
+ -Wno-unused-parameter
+ -Wno-long-long
+ -Werror=return-type
+ -Wextra-semi
+ -Wundef
+ -Wunused-template
+ -Wformat-nonliteral
+ )
+
+ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ target_add_compile_flags_if_supported(${target} PRIVATE
+ -Wno-user-defined-literals
+ -Wno-covered-switch-default
+ -Wno-suggest-override
+ )
+ if (LIBCXX_TARGETING_CLANG_CL)
+ target_add_compile_flags_if_supported(${target} PRIVATE
+ -Wno-c++98-compat
+ -Wno-c++98-compat-pedantic
+ -Wno-c++11-compat
+ -Wno-undef
+ -Wno-reserved-id-macro
+ -Wno-gnu-include-next
+ -Wno-gcc-compat # For ignoring "'diagnose_if' is a clang extension" warnings
+ -Wno-zero-as-null-pointer-constant # FIXME: Remove this and fix all occurrences.
+ -Wno-deprecated-dynamic-exception-spec # For auto_ptr
+ -Wno-sign-conversion
+ -Wno-old-style-cast
+ -Wno-deprecated # FIXME: Remove this and fix all occurrences.
+ -Wno-shift-sign-overflow # FIXME: Why do we need this with clang-cl but not clang?
+ -Wno-double-promotion # FIXME: remove me
+ )
+ endif()
+
+ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+
+ target_add_compile_flags_if_supported(${target} PRIVATE
+ -Wstrict-aliasing=2
+ -Wstrict-overflow=4
+ -Wno-attributes
+ -Wno-literal-suffix
+ -Wno-c++14-compat
+ -Wno-noexcept-type
+ -Wno-suggest-override
+ )
+
+ endif()
+ if (${enable_werror})
+ target_add_compile_flags_if_supported(${target} PRIVATE -Werror)
+ target_add_compile_flags_if_supported(${target} PRIVATE -WX)
+ else()
+ # TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is
+ # added elsewhere.
+ target_add_compile_flags_if_supported(${target} PRIVATE -Wno-error)
+ endif()
+ if (${enable_pedantic})
+ target_add_compile_flags_if_supported(${target} PRIVATE -pedantic)
+ endif()
+endfunction()