This commit is contained in:
milisbir 2018-07-11 16:38:59 +02:00
parent dbcbb364c9
commit 118b449cff
2 changed files with 37 additions and 83 deletions

View File

@ -1,9 +1,12 @@
#include <bits/wordsize.h>
/* llvm-config.h stub */
#if __WORDSIZE == 32
#include "llvm-config-32.h"
#elif __WORDSIZE == 64
#ifndef __STUB__LLVMCONFIG_H__
#define __STUB__LLVMCONFIG_H__
#if defined(__x86_64__)
#include "llvm-config-64.h"
#else
#error "Unknown word size"
#include "llvm-config-32.h"
#endif
#endif

View File

@ -1,87 +1,38 @@
# Tanım: LLVM derleyicisi
# URL: https://llvm.org/
# URL: http://llvm.org/
# Paketçi: milisarge
# Gerekler: libffi python ocaml swig cmake libedit
# Grup: geliştirme
# Gerekler: python cmake
isim=llvm
surum=6.0.1
surum=4.0.0
devir=1
kaynak=(https://llvm.org/releases/6.0.1/llvm-6.0.1.src.tar.xz
https://llvm.org/releases/6.0.1/cfe-6.0.1.src.tar.xz
https://releases.llvm.org/6.0.1/clang-tools-extra-6.0.1.src.tar.xz
https://llvm.org/releases/6.0.1/compiler-rt-6.0.1.src.tar.xz
https://llvm.org/releases/6.0.1/lldb-6.0.1.src.tar.xz
kaynak=(http://llvm.org/releases/$surum/$isim-$surum.src.tar.xz \
llvm-config.h)
derle() {
cd llvm-${surum}.src
mv ${SRC}/cfe-${surum}.src tools/clang
mv ${SRC}/clang-tools-extra-${surum}.src tools/clang/tools/extra
mv ${SRC}/compiler-rt-${surum}.src projects/compiler-rt
mv ${SRC}/lldb-${surum}.src tools/lldb
chmod -R u=rwX,go=rX ${SRC}/llvm-${surum}.src
mkdir -p build
export CC=gcc
export CXX=g++
cd $isim-$surum.src
mkdir build
cd build
export PKG_CONFIG_PATH='/usr/lib/pkgconfig'
_ffi_include_flags=$(pkg-config --cflags-only-I libffi)
_ffi_libs_flags=$(pkg-config --libs-only-L libffi)
_cxx_headers="/usr/include/c++/5.3.0"
cmake -G 'Unix Makefiles' \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DLLVM_TARGETS_TO_BUILD=all \
-DLLVM_APPEND_VC_REV:BOOL=ON \
-DLLVM_ENABLE_RTTI:BOOL=ON \
-DLLVM_ENABLE_FFI:BOOL=ON \
-DFFI_INCLUDE_DIR:PATH="${_ffi_include_flags#-I}" \
-DFFI_LIBRARY_DIR:PATH="${_ffi_libs_flags#-L}" \
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_BINUTILS_INCDIR:PATH=/usr/include \
"../"
make
# install in clang packaging
sed -i '/clang\/cmake_install.cmake/d' tools/cmake_install.cmake
sed -i '/compiler-rt\/cmake_install.cmake/d' projects/cmake_install.cmake
# install in lldb
sed -i '/\(clang\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake
# install in clang-tools-extra
sed -i '/extra\/cmake_install.cmake/d' tools/clang/tools/cmake_install.cmake
make DESTDIR=${PKG} install
# Fix permissions of static libs
chmod -x ${PKG}/usr/lib/*.a
install -D -m644 ${SRC}/llvm-${surum}.src/LICENSE.TXT ${PKG}/usr/share/licenses/${isim}/LICENSE
cd build/tools/clang
make DESTDIR=${PKG} install
cmake -DLLVM_ENABLE_CXX1Y=1 \
-DLLVM_INCLUDE_EXAMPLES=0 \
-DLLVM_INCLUDE_TESTS=0 \
-DLLVM_ENABLE_OCAMLDOC=0 \
-DLLVM_TARGETS_TO_BUILD='X86;AMDGPU;BPF' \
-DLLVM_BUILD_LLVM_DYLIB=1 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr ..
cd ../../projects/compiler-rt
make DESTDIR=${PKG} install
chmod -x ${PKG}/usr/lib/*.a
# part of clang-analyzer
rm ${PKG}/usr/bin/scan-build
rm ${PKG}/usr/bin/scan-view
MAKEFLAGS="$MAKEFLAGS" make
make DESTDIR=$PKG install
cd ${SRC}/llvm-${surum}.src/tools/clang
install -d ${PKG}/usr/{bin,lib/clang-analyzer}
for _tool in scan-{build,view}; do
cp -a tools/${_tool} ${PKG}/usr/lib/clang-analyzer
ln -s /usr/lib/clang-analyzer/${_tool}/${_tool} ${PKG}/usr/bin
done
# Python scripts
python2 -m compileall ${PKG}/usr/lib/clang-analyzer
python2 -O -m compileall ${PKG}/usr/lib/clang-analyzer
# multilib stub
mv $PKG/usr/include/llvm/Config/llvm-config{,-64}.h
cd build/tools/lldb
make DESTDIR=${PKG} install
python2 -m compileall ${PKG}/usr/lib/python2.7/site-packages/lldb
python2 -O -m compileall ${PKG}/usr/lib/python2.7/site-packages/lldb
# part of LLVM
rm ${PKG}/usr/lib/python2.7/site-packages/six.py
install -m 0644 $SRC/llvm-config.h $PKG/usr/include/llvm/Config/
cd build/tools/clang/tools/extra
make DESTDIR=${PKG} install
mv "$PKG/usr/include/llvm/Config/llvm-config"{,-64}.h
cp "$SRC/llvm-config.h" "$PKG/usr/include/llvm/Config/llvm-config.h"
}