diff options
Diffstat (limited to 'extra/source')
-rw-r--r-- | extra/source/llvm/clang.toolchains.i586.triple.diff | 10 | ||||
-rw-r--r-- | extra/source/llvm/lldb.32-bit.link.libatomic.diff | 14 | ||||
-rwxr-xr-x | extra/source/llvm/llvm.SlackBuild | 339 | ||||
-rw-r--r-- | extra/source/llvm/llvm.url | 29 | ||||
-rw-r--r-- | extra/source/llvm/missing-runtime-modules/HandleFlags.cmake | 113 | ||||
-rw-r--r-- | extra/source/llvm/missing-runtime-modules/WarningFlags.cmake | 77 | ||||
-rw-r--r-- | extra/source/llvm/slack-desc | 19 | ||||
-rwxr-xr-x | extra/source/llvm13-compat/llvm13-compat.SlackBuild | 118 | ||||
-rw-r--r-- | extra/source/llvm13-compat/llvm13-list-of-libraries-to-retain | 38 | ||||
-rw-r--r-- | extra/source/llvm13-compat/slack-desc | 19 |
10 files changed, 776 insertions, 0 deletions
diff --git a/extra/source/llvm/clang.toolchains.i586.triple.diff b/extra/source/llvm/clang.toolchains.i586.triple.diff new file mode 100644 index 000000000..e51f3cd52 --- /dev/null +++ b/extra/source/llvm/clang.toolchains.i586.triple.diff @@ -0,0 +1,10 @@ +--- ./tools/clang/lib/Driver/ToolChains/Gnu.cpp.orig 2022-04-25 22:44:44.000000000 -0500 ++++ ./tools/clang/lib/Driver/ToolChains/Gnu.cpp 2022-04-28 13:34:46.834049926 -0500 +@@ -2107,6 +2107,7 @@ + static const char *const X86Triples[] = { + "i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu", + "i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux", ++ "i586-slackware-linux", "i686-slackware-linux", + "i586-suse-linux", "i686-montavista-linux", "i686-gnu", + }; + diff --git a/extra/source/llvm/lldb.32-bit.link.libatomic.diff b/extra/source/llvm/lldb.32-bit.link.libatomic.diff new file mode 100644 index 000000000..234bcdc72 --- /dev/null +++ b/extra/source/llvm/lldb.32-bit.link.libatomic.diff @@ -0,0 +1,14 @@ +--- ./tools/lldb/source/Utility/CMakeLists.txt.orig 2022-06-22 11:46:24.000000000 -0500 ++++ ./tools/lldb/source/Utility/CMakeLists.txt 2022-06-27 22:33:56.715179825 -0500 +@@ -19,9 +19,9 @@ + list(APPEND LLDB_SYSTEM_LIBS ws2_32 rpcrt4) + endif () + +-if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB ) ++#if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB ) + list(APPEND LLDB_SYSTEM_LIBS atomic) +-endif() ++#endif() + + add_lldb_library(lldbUtility + ArchSpec.cpp diff --git a/extra/source/llvm/llvm.SlackBuild b/extra/source/llvm/llvm.SlackBuild new file mode 100755 index 000000000..6e353f168 --- /dev/null +++ b/extra/source/llvm/llvm.SlackBuild @@ -0,0 +1,339 @@ +#!/bin/bash + +# Slackware build script for llvm + +# Copyright 2008-2016 Heinz Wiesinger, Amsterdam, The Netherlands +# Copyright 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=llvm +VERSION=${VERSION:-$(echo llvm-*.tar.xz | rev | cut -f 4- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-1_slack15.0} + +# For the two options below, either set both to OFF or *only one* to ON: + +# Build using -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCLANG_LINK_CLANG_DYLIB=ON: +# This is the upstream recommended way to build LLVM with shared libraries and +# seems to be the way to go these days. +LLVM_BUILD_LLVM_DYLIB=${LLVM_BUILD_LLVM_DYLIB:=ON} + +# Build using -DBUILD_SHARED_LIBS=ON. +# We used this for years here to get a smaller LLVM package, but it no longer +# works. Feel free to try it, but expect breakage. +BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:=OFF} + +NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM +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 -Wno-gnu-include-next} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686 $IGNORE_GNU_EXTENSIONS" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686 $IGNORE_GNU_EXTENSIONS" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC $IGNORE_GNU_EXTENSIONS" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2 $IGNORE_GNU_EXTENSIONS" + LIBDIRSUFFIX="" +fi + +# Building clangd will be determined automatically unless BUILD_CLANG is +# preset to YES or NO: +if [ -z $BUILD_CLANGD ]; then + if [ "$ARCH" = "i586" -o "$ARCH" = "i686" ]; then + BUILD_CLANGD=NO + else + BUILD_CLANGD=YES + fi +fi +if [ "$BUILD_CLANGD" = "NO" ]; then + CLANGD="-DCLANG_ENABLE_CLANGD=OFF" +fi + +# Python2 short version: +PY2=$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())' | cut -f 2 -d n | cut -f 1 -d /) +# Python3 short version: +PY3=$(python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())' | cut -f 2 -d n | cut -f 1 -d /) + +# Sadly, glibc-2.30 exposed some sort of problem with clang and icecream. +# The symptom is a compile failure that says none of the types in +# <linux/types.h> are defined, even though they are. gcc/g++ seem unaffected. +# For now, not much choice other than to disable this. +# Don't use icecream: +#PATH=$(echo $PATH | sed "s|/usr/libexec/icecc/bin||g" | tr -s : | sed "s/^://g" | sed "s/:$//g") + +rm -rf $PKG $BUILDDIR +mkdir -p $TMP $PKG $BUILDDIR +cd $BUILDDIR + +# Add a fake configure script so the cleanup script used here at Slackware +# knows to delete this stuff later. Other folks can just ignore this... it +# doesn't have any other purpose. +touch configure +chmod 755 configure + +# Extract and rename some support files: +echo "Extracting $CWD/cmake-$VERSION.src.tar.xz..." +tar xf $CWD/cmake-$VERSION.src.tar.xz || exit 1 +mv cmake-$VERSION.src cmake +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} +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 + 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 + #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 + 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 + 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 + 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 +cd ../../../ + +cd projects || 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 + 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 + 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 + 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 + 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... + 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 ../ + +# Support GCC built for i586-slackware-linux: +zcat $CWD/clang.toolchains.i586.triple.diff.gz | patch -p1 --verbose || exit 1 + +# We require libatomic on 32-bit platforms: +if [ -f ./tools/lldb/source/Utility/CMakeLists.txt ]; then + if [ "$ARCH" = "i586" -o "$ARCH" = "i686" ]; then + zcat $CWD/lldb.32-bit.link.libatomic.diff.gz | patch -p1 --verbose || exit 1 + fi +fi + +# 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 . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +# Collect shared library options. If both of the configurable options are set +# to ON, the last one we check will be the one we use. +if [ "$BUILD_SHARED_LIBS" = "ON" ]; then + SHARED_LIBRARY_OPTIONS="-DBUILD_SHARED_LIBS=ON" +fi +if [ "$LLVM_BUILD_LLVM_DYLIB" = "ON" ]; then + SHARED_LIBRARY_OPTIONS="-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCLANG_LINK_CLANG_DYLIB=ON" +fi + +if [ -x /usr/bin/lld ]; then + LINKER_OPTIONS="-DLLVM_USE_LINKER=lld" +fi + +mkdir build +cd build + mkdir include + # Copy this LLVM libunwind header or it won't be found: + cp -a ../projects/libunwind/include/mach-o include + # Nuke LLVM libunwind as it conflicts with the one already on the system: + rm -r ../projects/libunwind + cmake -GNinja \ + -DCMAKE_C_COMPILER="clang" \ + -DCMAKE_CXX_COMPILER="clang++" \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_LIBDIR_SUFFIX=${LIBDIRSUFFIX} \ + -DLIBCXX_LIBDIR_SUFFIX=${LIBDIRSUFFIX} \ + -DLIBCXXABI_LIBDIR_SUFFIX=${LIBDIRSUFFIX} \ + -DCMAKE_BUILD_TYPE=Release \ + $SHARED_LIBRARY_OPTIONS \ + $LINKER_OPTIONS \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_FFI=ON \ + -DLLVM_ENABLE_ZLIB=ON \ + -DLLVM_ENABLE_ASSERTIONS=OFF \ + -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DCLANG_RESOURCE_DIR="../lib${LIBDIRSUFFIX}/clang/$(echo $VERSION | cut -f 1 -d .)" \ + -DLLVM_TARGETS_TO_BUILD="host;AMDGPU;BPF" \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLIBCXX_INCLUDE_BENCHMARKS=OFF \ + -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \ + -DCLANG_DEFAULT_PIE_ON_LINUX=ON \ + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \ + $CLANGD \ + .. || exit 1 + + "${NINJA:=ninja}" $NUMJOBS || exit 1 + DESTDIR=$PKG "$NINJA" install || exit 1 +cd .. + +# Add symlinks for $ARCH-slackware-linux-{clang,clang++}: +( cd $PKG/usr/bin + ln -sf clang $ARCH-slackware-linux-clang + ln -sf clang++ $ARCH-slackware-linux-clang++ +) + +# Install clang-static-analyzer: +for i in ccc c++; do + ln -s /usr/libexec/$i-analyzer \ + $PKG/usr/bin/$i-analyzer || exit 1 +done + +# Ensure lit-cpuid is installed: +if [ ! -r $PKG/usr/bin/lit-cpuid ]; then + cp -a build/bin/lit-cpuid $PKG/usr/bin/lit-cpuid + chown root:root $PKG/usr/bin/lit-cpuid + chmod 755 $PKG/usr/bin/lit-cpuid +fi + +# Remove symlink to libgomp, which is already provided by gcc: +rm -f $PKG/usr/lib$LIBDIRSUFFIX/libgomp.so + +# Install Python bindings: +for pyver in ${PY2} ${PY3}; do + mkdir -p "$PKG/usr/lib$LIBDIRSUFFIX/python$pyver/site-packages" + cp -a tools/clang/bindings/python/clang "$PKG/usr/lib$LIBDIRSUFFIX/python$pyver/site-packages/" +done + +# Remove bundled python-six: +rm -f "$PKG/usr/lib$LIBDIRSUFFIX/python${PY2}/site-packages/six.py" + +# Compile Python scripts: +python -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python${PY2}/site-packages/clang" +python -O -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python${PY2}/site-packages/clang" +python3 -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python${PY3}/site-packages/clang" +python3 -O -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python${PY3}/site-packages/clang" +python -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python${PY2}/site-packages/lldb" +python -O -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python${PY2}/site-packages/lldb" +python -m compileall "$PKG/usr/share/scan-view" +python -O -m compileall "$PKG/usr/share/scan-view" +python -m compileall "$PKG/usr/share/clang" +python -O -m compileall "$PKG/usr/share/clang" +python -m compileall "$PKG/usr/share/opt-viewer" +python -O -m compileall "$PKG/usr/share/opt-viewer" + +# Move man page directory: +mv $PKG/usr/share/man $PKG/usr/ + +# Strip binaries: +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +# Compress manual pages: +find $PKG/usr/man -type f -exec gzip -9 {} \+ +for i in $( find $PKG/usr/man -type l ) ; do + ln -s $( readlink $i ).gz $i.gz + rm $i +done + +mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/{clang,lldb,clang-tools-extra,compiler-rt,openmp,polly} +cp -a CREDITS* LICENSE* README* $PKG/usr/doc/$PKGNAM-$VERSION +cp -a tools/clang/{INSTALL,LICENSE,NOTES,README}* \ + $PKG/usr/doc/$PKGNAM-$VERSION/clang +cp -a tools/lldb/{CODE_OWNERS,INSTALL,LICENSE}* \ + $PKG/usr/doc/$PKGNAM-$VERSION/lldb +cp -a tools/clang/tools/extra/{CODE_OWNERS,LICENSE,README}* \ + $PKG/usr/doc/$PKGNAM-$VERSION/clang-tools-extra +cp -a projects/compiler-rt/{CODE_OWNERS,CREDITS,LICENSE,README}* \ + $PKG/usr/doc/$PKGNAM-$VERSION/compiler-rt +cp -a projects/openmp/{CREDITS,LICENSE}* \ + $PKG/usr/doc/$PKGNAM-$VERSION/openmp +cp -a projects/polly/{CREDITS,LICENSE,README}* \ + $PKG/usr/doc/$PKGNAM-$VERSION/polly +mv $PKG/usr/docs/llvm/* $PKG/usr/doc/$PKGNAM-$VERSION +rm -rf $PKG/usr/docs + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz diff --git a/extra/source/llvm/llvm.url b/extra/source/llvm/llvm.url new file mode 100644 index 000000000..89a3e3aba --- /dev/null +++ b/extra/source/llvm/llvm.url @@ -0,0 +1,29 @@ +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang-tools-extra-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/compiler-rt-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/flang-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/lldb-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/openmp-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/polly-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/libcxx-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/libcxxabi-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/lld-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/libunwind-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/cmake-17.0.6.src.tar.xz +https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/third-party-17.0.6.src.tar.xz + +#http://llvm.org/releases/17.0.6/llvm-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/clang-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/clang-tools-extra-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/compiler-rt-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/flang-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/lldb-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/openmp-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/polly-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/libcxx-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/libcxxabi-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/lld-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/libunwind-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/cmake-17.0.6.src.tar.xz +#http://llvm.org/releases/17.0.6/third-party-17.0.6.src.tar.xz diff --git a/extra/source/llvm/missing-runtime-modules/HandleFlags.cmake b/extra/source/llvm/missing-runtime-modules/HandleFlags.cmake new file mode 100644 index 000000000..4a62b6716 --- /dev/null +++ b/extra/source/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/extra/source/llvm/missing-runtime-modules/WarningFlags.cmake b/extra/source/llvm/missing-runtime-modules/WarningFlags.cmake new file mode 100644 index 000000000..d06409841 --- /dev/null +++ b/extra/source/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() diff --git a/extra/source/llvm/slack-desc b/extra/source/llvm/slack-desc new file mode 100644 index 000000000..32ed62bf0 --- /dev/null +++ b/extra/source/llvm/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +llvm: llvm (LLVM compiler toolkit) +llvm: +llvm: LLVM is a toolkit for the construction of highly optimized compilers, +llvm: optimizers, and runtime environments. +llvm: +llvm: This package also includes the clang frontend for the C family of +llvm: languages: C, C++, Objective-C, and Objective-C++ +llvm: +llvm: +llvm: Homepage: http://llvm.org/ +llvm: diff --git a/extra/source/llvm13-compat/llvm13-compat.SlackBuild b/extra/source/llvm13-compat/llvm13-compat.SlackBuild new file mode 100755 index 000000000..f0f432654 --- /dev/null +++ b/extra/source/llvm13-compat/llvm13-compat.SlackBuild @@ -0,0 +1,118 @@ +#!/bin/bash + +# Copyright 2024 Patrick J. Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=llvm13-compat +VERSION=${VERSION:-13.0.0} +BUILD=${BUILD:-1_slack15.0} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i586 ;; + arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) ARCH=$(uname -m) ;; + esac + export ARCH +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +NUMJOBS=${NUMJOBS:-" -j $(expr $(nproc) + 1) "} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "armv7hl" ]; then + SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16" + LIBDIRSUFFIX="" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM + +rm -rf $PKG +mkdir -p $TMP $PKG + +# Create a directory for the libraries: +mkdir -p $PKG/usr/lib${LIBDIRSUFFIX} + +echo "Copying list of directly-linked libraries..." +cat $CWD/llvm13-list-of-libraries-to-retain | while read library ; do + if [ ! "$(echo $library | cut -c 1)" = "#" ]; then + if [ ! -e /usr/lib${LIBDIRSUFFIX}/$library ]; then + echo "ERROR: llvm 13 package must be installed so that we can extract libraries from the system." + exit 1 + fi + cp -a -v /usr/lib${LIBDIRSUFFIX}/$library $PKG/usr/lib${LIBDIRSUFFIX} + if [ -L /usr/lib${LIBDIRSUFFIX}/$library ]; then + cp -a /usr/lib${LIBDIRSUFFIX}/$(readlink /usr/lib${LIBDIRSUFFIX}/$library) $PKG/usr/lib${LIBDIRSUFFIX} + fi + fi +done || exit 1 + +echo "Copying other LLVM libraries required by the already copied ones..." +cd $PKG/usr/lib${LIBDIRSUFFIX} +touch $PKG/scan +while [ -e $PKG/scan ]; do + # we'll reset this flag if we find something. We need to make one pass without + # finding anything to leave this loop. + rm $PKG/scan + for library in lib* ; do + readelf -d $library | grep "Shared library" | rev | cut -f 1 -d ' ' | rev | tr -d \[ | tr -d \] | grep ".so.13$" | while read dep ; do + if [ ! -e $dep ]; then + echo "Copying $dep for $library..." + cp -a -v /usr/lib${LIBDIRSUFFIX}/$dep $PKG/usr/lib${LIBDIRSUFFIX} + if [ -L /usr/lib${LIBDIRSUFFIX}/$dep ]; then + cp -a /usr/lib${LIBDIRSUFFIX}/$(readlink /usr/lib${LIBDIRSUFFIX}/$dep) $PKG/usr/lib${LIBDIRSUFFIX} + fi + touch $PKG/scan + fi + done + done +done + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz diff --git a/extra/source/llvm13-compat/llvm13-list-of-libraries-to-retain b/extra/source/llvm13-compat/llvm13-list-of-libraries-to-retain new file mode 100644 index 000000000..e6aafbf12 --- /dev/null +++ b/extra/source/llvm13-compat/llvm13-list-of-libraries-to-retain @@ -0,0 +1,38 @@ +# If these libraries exist on the host system, they'll be added to the package +# for backwards compatibility with the llvm-13 package. +libLLVMAMDGPUAsmParser.so.13 +libLLVMAMDGPUCodeGen.so.13 +libLLVMAMDGPUDesc.so.13 +libLLVMAMDGPUDisassembler.so.13 +libLLVMAMDGPUInfo.so.13 +libLLVMAnalysis.so.13 +libLLVMBPFAsmParser.so.13 +libLLVMBPFCodeGen.so.13 +libLLVMBPFDesc.so.13 +libLLVMBPFInfo.so.13 +libLLVMBitReader.so.13 +libLLVMBitWriter.so.13 +libLLVMCore.so.13 +libLLVMCoroutines.so.13 +libLLVMExecutionEngine.so.13 +libLLVMIRReader.so.13 +libLLVMInstCombine.so.13 +libLLVMLinker.so.13 +libLLVMMC.so.13 +libLLVMMCDisassembler.so.13 +libLLVMMCJIT.so.13 +libLLVMRuntimeDyld.so.13 +libLLVMScalarOpts.so.13 +libLLVMSupport.so.13 +libLLVMTarget.so.13 +libLLVMTransformUtils.so.13 +libLLVMX86AsmParser.so.13 +libLLVMX86CodeGen.so.13 +libLLVMX86Desc.so.13 +libLLVMX86Disassembler.so.13 +libLLVMX86Info.so.13 +libLLVMipo.so.13 +libclang-cpp.so.13 +libclang.so.13 +# Stupid outlier: +libPollyISL.so diff --git a/extra/source/llvm13-compat/slack-desc b/extra/source/llvm13-compat/slack-desc new file mode 100644 index 000000000..bcd1e153b --- /dev/null +++ b/extra/source/llvm13-compat/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +llvm13-compat: llvm13-compat (LLVM13 runtime libraries) +llvm13-compat: +llvm13-compat: This is a collection of libraries from LLVM13 to provide runtime +llvm13-compat: support for binaries compiled against them. +llvm13-compat: +llvm13-compat: +llvm13-compat: +llvm13-compat: +llvm13-compat: +llvm13-compat: +llvm13-compat: |