rebuilt with wasi support [release 18.1.8-2mamba;Sat Sep 14 2024]

This commit is contained in:
Silvan Calarco 2024-09-15 15:43:11 +02:00
parent ebdc9259af
commit fda326c65b
3 changed files with 70 additions and 3 deletions

1
WASI.cmake Normal file
View File

@ -0,0 +1 @@
set(WASI 1)

View File

@ -3,7 +3,7 @@
%define majver %(echo %version | cut -d. -f1-2)
Name: compiler-rt
Version: 18.1.8
Release: 1mamba
Release: 2mamba
Summary: Runtime libraries compiler for clang
Group: Development/Languages
Vendor: openmamba
@ -12,12 +12,16 @@ Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://llvm.org/
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/compiler-rt-%{version}.src.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/cmake-%{version}.src.tar.xz
Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/llvm-%{version}.src.tar.xz
Source10: WASI.cmake
Source11: wasi-toolchain.cmake
License: NCSA
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libgcc
BuildRequires: libstdc++6-devel
## AUTOBUILDREQ-END
BuildRequires: libwasi-libc-devel
Requires(pre): clang
%description
@ -26,14 +30,38 @@ Runtime libraries compiler for clang.
%debug_package
%prep
%setup -q -c -a0 -a1
%setup -q -c -a0 -a1 -a2
#-D -T
#:<< _EOF
mv compiler-rt-%{version}.src compiler-rt
mv cmake-%{version}.src cmake
mv llvm-%{version}.src llvm
mkdir -p cmake/Platform
cp %{SOURCE10} cmake/Platform
%build
#:<< __EOF
mkdir -p build-wasi
cd build-wasi
cmake ../compiler-rt/lib/builtins -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_WORKS=ON \
-DCMAKE_CXX_COMPILER_WORKS=ON \
-DCMAKE_MODULE_PATH="$PWD/../make" \
-DCMAKE_TOOLCHAIN_FILE="%{SOURCE11}" \
-DCOMPILER_RT_BAREMETAL_BUILD=On \
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
-DCOMPILER_RT_HAS_FPIC_FLAG=OFF \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=On \
-DCOMPILER_RT_OS_DIR=wasi \
-DWASI_SDK_PREFIX=/usr \
-DCMAKE_C_FLAGS="-fno-exceptions --sysroot=%{_datadir}/wasi-sysroot" \
-DCMAKE_INSTALL_PREFIX=%{_libdir}/clang/%{MAJver}/ \
ninja
cd ..
mkdir -p build
cd build
@ -51,8 +79,12 @@ ninja
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
cd build
export DESTDIR=%{buildroot}
cd build-wasi
ninja install
cd ..
cd build
ninja install
#mkdir -p %{buildroot}%{_libdir}/clang/%{MAJver}/{lib,share}
@ -72,11 +104,16 @@ ninja install
%{_libdir}/clang/%{MAJver}/include/*
%dir %{_libdir}/clang/%{MAJver}/lib/linux
%{_libdir}/clang/%{MAJver}/lib/linux/*
%dir %{_libdir}/clang/%{MAJver}/lib/wasi
%{_libdir}/clang/%{MAJver}/lib/wasi/libclang_rt.builtins-wasm32.a
%dir %{_libdir}/clang/%{MAJver}/share
%{_libdir}/clang/%{MAJver}/share/*.txt
%doc compiler-rt/LICENSE.TXT
%changelog
* Sat Sep 14 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 18.1.8-2mamba
- rebuilt with wasi support
* Sat Jun 22 2024 Automatic Build System <autodist@openmamba.org> 18.1.8-1mamba
- automatic version update by autodist

29
wasi-toolchain.cmake Normal file
View File

@ -0,0 +1,29 @@
# Cmake toolchain description file for the Makefile
# This is arbitrary, AFAIK, for now.
cmake_minimum_required(VERSION 3.4.0)
set(CMAKE_SYSTEM_NAME WASI)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR wasm32)
set(triple wasm32-wasi)
if(WIN32)
set(WASI_HOST_EXE_SUFFIX ".exe")
else()
set(WASI_HOST_EXE_SUFFIX "")
endif()
set(CMAKE_C_COMPILER ${WASI_SDK_PREFIX}/bin/clang${WASI_HOST_EXE_SUFFIX})
set(CMAKE_CXX_COMPILER ${WASI_SDK_PREFIX}/bin/clang++${WASI_HOST_EXE_SUFFIX})
set(CMAKE_AR ${WASI_SDK_PREFIX}/bin/llvm-ar${WASI_HOST_EXE_SUFFIX})
set(CMAKE_RANLIB ${WASI_SDK_PREFIX}/bin/llvm-ranlib${WASI_HOST_EXE_SUFFIX})
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER_TARGET ${triple})
# Don't look in the sysroot for executables to run during the build
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Only look in the sysroot (not in the host paths) for the rest
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)