Archived
3
0

clang recipe modifications and new scripts

This commit is contained in:
Philippe PITTOLI 2019-10-18 03:25:53 +02:00
parent f14f42b3b4
commit 8530ea4eaf
5 changed files with 96 additions and 3 deletions

52
clang/clang Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
requires_linking="true"
is_cpp=false
if [ "$(basename $0)" = "clang++" ]; then
is_cpp=true
fi
for i; do
case "$i" in
-c)
requires_linking="false"
;;
-std=*)
std="$(printf "%s" "$i" | sed 's:-std=::')"
if echo "$std" | grep -E -q '(c\+\+|gnu\+\+)'; then
is_cpp=true
else
is_cpp=false
fi
;;
esac
done
cpp_flags=
if $is_cpp; then
cpp_flags="
-cxx-isystem /usr/weirdos/lib/c++/v1
"
fi
linker_flags=
if $requires_linking; then
linker_flags="
-L /usr/weirdos/lib
-L /usr/weirdos/lib/gcc/x86_64-weird-linux-musl/9.1.0/
-B /usr/weirdos/lib/gcc/x86_64-weird-linux-musl/9.1.0/
-Wl,--dynamic-linker /lib/ld-musl-x86_64.so.1
"
if $is_cpp; then
cpp_flags="$cpp_flags -lc++ -lc++abi"
fi
fi
clang-8 \
-isystem /usr/weirdos/include/ \
$linker_flags \
$cpp_flags \
"$@"

7
clang/labs.h Normal file
View File

@ -0,0 +1,7 @@
#include <cstdlib>
namespace std {
static inline long abs(long a) { return std::labs(a); }
static inline long long abs(long long a) { return std::labs(a); }
}

View File

@ -1,14 +1,36 @@
name: clang
version: 8.0.1
release: 1
sources: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/cfe-%{version}.src.tar.xz
sources:
- https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/cfe-%{version}.src.tar.xz
- labs.h
- clang
dirname: build
@configure
#sed -i '/^ return ToolChain::CST_Libstdcxx/s@stdcxx@cxx@' cfe-%{version}.src/tools/lib/Driver/ToolChain.cpp
mkdir %{dirname}
cd %{dirname}
cmake ../cfe-%{version}.src \
-DCMAKE_PREFIX_PATH=/usr/bad/llvm-8 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_PREFIX_PATH=%{prefix} \
-DCMAKE_INSTALL_PREFIX=%{prefix} \
-DCLANG_CONFIG_FILE_SYSTEM_DIR=%{prefix}/etc/clang \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DCMAKE_CXX_COMPILER="clang++" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -stdlib=libc++ -include /usr/weirdos/include/c++/v1/math.h -include $(pwd)/../labs.h -D__DEFINED_max_align_t" \
-DCMAKE_C_COMPILER="clang" \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS -lc++" \
-DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -lc++" \
-DCMAKE_BUILD_TYPE=Release
@install
cd %{dirname}
make DESTDIR=%{pkg} install
mkdir -p %{pkg}/prefix/bin
rm %{pkg}%{prefix}/bin/clang
cp ../clang %{pkg}%{prefix}/bin/
rm %{pkg}%{prefix}/bin/clang++
ln -s %{prefix}/bin/clang %{pkg}%{prefix}/bin/clang++

8
clang/wrapper-clang++ Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
clang-8 -L %{prefix}/lib \
-L %{prefix}/lib/gcc/x86_64-weird-linux-musl/9.1.0/ \
-B %{prefix}/lib/gcc/x86_64-weird-linux-musl/9.1.0/ \
-Wl,--dynamic-linker /lib/ld-musl-x86_64.so.1 \
-isystem %{prefix}/include/ \
"$@"

4
clang/x86_64.cfg Normal file
View File

@ -0,0 +1,4 @@
-L /usr/weirdos/lib/gcc/x86_64-weird-linux-musl/9.1.0/
-B /usr/weirdos/lib/gcc/x86_64-weird-linux-musl/9.1.0/
-Wl,--dynamic-linker /lib/ld-musl-x86_64.so.1
-I /usr/weirdos/include/