summaryrefslogtreecommitdiff
path: root/source/d/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'source/d/llvm')
-rw-r--r--source/d/llvm/clang.toolchains.i586.triple.diff11
-rwxr-xr-xsource/d/llvm/llvm.SlackBuild143
-rw-r--r--source/d/llvm/llvm.url6
3 files changed, 94 insertions, 66 deletions
diff --git a/source/d/llvm/clang.toolchains.i586.triple.diff b/source/d/llvm/clang.toolchains.i586.triple.diff
new file mode 100644
index 00000000..3795f5e0
--- /dev/null
+++ b/source/d/llvm/clang.toolchains.i586.triple.diff
@@ -0,0 +1,11 @@
+--- ./tools/clang/lib/Driver/ToolChains.cpp.orig 2015-09-13 13:30:39.748069603 -0500
++++ ./tools/clang/lib/Driver/ToolChains.cpp 2015-09-13 13:32:16.584075557 -0500
+@@ -1296,7 +1296,7 @@
+ "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
+ "i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux",
+ "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
+- "i486-slackware-linux", "i686-montavista-linux", "i686-linux-android",
++ "i486-slackware-linux", "i586-slackware-linux", "i686-montavista-linux", "i686-linux-android",
+ "i586-linux-gnu"};
+
+ static const char *const MIPSLibDirs[] = {"/lib"};
diff --git a/source/d/llvm/llvm.SlackBuild b/source/d/llvm/llvm.SlackBuild
index 1f5150c7..4d15ffaa 100755
--- a/source/d/llvm/llvm.SlackBuild
+++ b/source/d/llvm/llvm.SlackBuild
@@ -2,8 +2,8 @@
# Slackware build script for llvm
-# Copyright 2008-2013 Heinz Wiesinger, Amsterdam, The Netherlands
-# Copyright 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008-2015 Heinz Wiesinger, Amsterdam, The Netherlands
+# Copyright 2012, 2013, 2014, 2015, 2016 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,14 +24,14 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PKGNAM=llvm
-VERSION=3.3
+VERSION=${VERSION:-$(echo llvm-*.tar.xz | rev | cut -f 4- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j7 "}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) ARCH=i486 ;;
+ i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
@@ -41,8 +41,8 @@ CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@@ -58,50 +58,68 @@ fi
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
-rm -rf $PKGNAM-${VERSION}.src
+rm -rf $PKGNAM-${VERSION}.src $PKGNAM-${VERSION}
tar xvf $CWD/$PKGNAM-$VERSION.src.tar.xz || exit 1
-cd $PKGNAM-${VERSION}.src/tools
+cd $PKGNAM-${VERSION}/tools || cd $PKGNAM-${VERSION}.src/tools || exit 1
tar xvf $CWD/cfe-$VERSION.src.tar.xz || exit 1
- mv cfe-${VERSION}.src clang || exit 1
+ mv cfe-${VERSION} clang 2>/dev/null || mv cfe-${VERSION}.src clang || exit 1
cd ../
+cd tools/clang/tools || exit 1
+ tar xvf $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
+ tar xvf $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
+cd ../
+
+# Support GCC built for i586-slackware-linux:
+zcat $CWD/clang.toolchains.i586.triple.diff.gz | patch -p1 --verbose || exit 1
+
+# Use i586 $ARCH on 32-bit x86:
+sed -r "/ifeq.*CompilerTargetArch/s#i386#i586#g" \
+ -i projects/compiler-rt/make/platform/clang_linux.mk
+
chown -R root:root .
-chmod -R u+w,go+r-w,a-s .
+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 {} \;
-# --mandir doesn't work currently
# need to disable assertions to make llvm thread-safe
# clang resource dir is a relative path based on the location of the clang binary
-CFLAGS="$SLKCFLAGS" \
-CXXFLAGS="$SLKCFLAGS" \
-./configure \
- --prefix=/usr \
- --libdir=/usr/lib$LIBDIRSUFFIX \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --mandir=/usr/man \
- --enable-optimized \
- --disable-assertions \
- --enable-pic \
- --enable-experimental-targets=R600 \
- --with-clang-resource-dir="../lib${LIBDIRSUFFIX}/clang/${VERSION}" \
- --build=$ARCH-slackware-linux \
- --host=$ARCH-slackware-linux || exit 1
-
-# Fix hardcoded libdir
-sed -i "s|\$(PROJ_prefix)/lib|\$(PROJ_prefix)/lib$LIBDIRSUFFIX|" \
- Makefile.config
-sed -i "s|\$(PROJ_prefix)/lib|\$(PROJ_prefix)/lib$LIBDIRSUFFIX|" \
- tools/clang/lib/Headers/Makefile
-sed -i "s|\"lib\"|\"lib${LIBDIRSUFFIX}\"|" \
- tools/clang/lib/Frontend/CompilerInvocation.cpp
-sed -i "s|\"lib\"|\"lib${LIBDIRSUFFIX}\"|" \
- tools/clang/lib/Driver/Tools.cpp
-sed -i "s|ActiveLibDir = ActivePrefix + \"/lib\"|ActiveLibDir = ActivePrefix + \"/lib${LIBDIRSUFFIX}\"|g" \
- tools/llvm-config/llvm-config.cpp
-
-make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG || exit 1
+mkdir build
+cd build
+ cmake \
+ -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} \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_BUILD_LLVM_DYLIB=ON \
+ -DLLVM_DYLIB_EXPORT_ALL=ON \
+ -DLLVM_LINK_LLVM_DYLIB=ON \
+ -DLLVM_ENABLE_RTTI=ON \
+ -DLLVM_ENABLE_FFI=ON \
+ -DLLVM_ENABLE_ASSERTIONS=OFF \
+ -DLLVM_BINUTILS_INCDIR=/usr/include \
+ -DCLANG_RESOURCE_DIR="../lib${LIBDIRSUFFIX}/clang/${VERSION}" \
+ ..
+
+ # breaks with one of the patches above. Maybe revisit later
+ # -DBUILD_SHARED_LIBS=ON \
+
+ make $NUMJOBS VERBOSE=1 || make || exit 1
+ make install DESTDIR=$PKG || exit 1
+cd ..
# Add symlinks for $ARCH-slackware-linux-{clang,clang++}:
( cd $PKG/usr/bin
@@ -110,37 +128,34 @@ make install DESTDIR=$PKG || exit 1
)
# install clang-static-analyzer
-mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer
-cp -pr tools/clang/tools/scan-{build,view} \
- $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/ || exit 1
-for i in scan-{build,view}; do
- ln -s /usr/lib$LIBDIRSUFFIX/clang-analyzer/$i/$i \
- $PKG/usr/bin/$i || exit 1
-done
for i in ccc c++; do
- ln -s /usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/$i-analyzer \
+ ln -s /usr/libexec/$i-analyzer \
$PKG/usr/bin/$i-analyzer || exit 1
done
-# Fix paths in scan-build
-sed -i "s|\$RealBin/bin|/usr/bin|" \
- $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
-sed -i "s|\$RealBin/sorttable.js|/usr/lib${LIBDIRSUFFIX}/clang-analyzer/scan-build/sorttable.js|" \
- $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
-sed -i "s|\$RealBin/scanview.css|/usr/lib${LIBDIRSUFFIX}/clang-analyzer/scan-build/scanview.css|" \
- $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
+## Fix paths in scan-build
+#sed -i "s|\$RealBin/bin|/usr/bin|" \
+# $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
+#sed -i "s|\$RealBin/sorttable.js|/usr/lib${LIBDIRSUFFIX}/clang-analyzer/scan-build/sorttable.js|" \
+# $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
+#sed -i "s|\$RealBin/scanview.css|/usr/lib${LIBDIRSUFFIX}/clang-analyzer/scan-build/scanview.css|" \
+# $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
+#
+## fix strange permissions
+#chmod 755 $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build
+#chmod 755 $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-view
+#chmod 755 $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-view/Resources
+
+# Install Python bindings
+mkdir -p "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages"
+cp -a tools/clang/bindings/python/clang "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/"
-# Remove example libraries
-rm -f $PKG/usr/lib$LIBDIRSUFFIX/LLVMHello*
+# Compile Python scripts
+python -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/clang"
+python -O -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/clang"
# Move man page directory:
mv $PKG/usr/share/man $PKG/usr/
-# Try to remove /usr/share, which should be empty now. If it's not, fine.
-rmdir $PKG/usr/share
-
-# Move scan-build man-page into place
-mv $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build.1 \
- $PKG/usr/man/man1/
# Strip binaries:
( cd $PKG
diff --git a/source/d/llvm/llvm.url b/source/d/llvm/llvm.url
index 96e8fd58..f276cfe1 100644
--- a/source/d/llvm/llvm.url
+++ b/source/d/llvm/llvm.url
@@ -1,2 +1,4 @@
-http://llvm.org/releases/3.3/llvm-3.3.tar.gz
-http://llvm.org/releases/3.3/cfe-3.3.tar.gz
+http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz
+http://llvm.org/releases/3.8.0/cfe-3.8.0.src.tar.xz
+http://llvm.org/releases/3.8.0/clang-tools-extra-3.8.0.src.tar.xz
+http://llvm.org/releases/3.8.0/compiler-rt-3.8.0.src.tar.xz