From fda326c65b214e2c1c1b34b90b84366c11c48277 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 15 Sep 2024 15:43:11 +0200 Subject: [PATCH] rebuilt with wasi support [release 18.1.8-2mamba;Sat Sep 14 2024] --- WASI.cmake | 1 + compiler-rt.spec | 43 ++++++++++++++++++++++++++++++++++++++++--- wasi-toolchain.cmake | 29 +++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 WASI.cmake create mode 100644 wasi-toolchain.cmake diff --git a/WASI.cmake b/WASI.cmake new file mode 100644 index 0000000..b49713f --- /dev/null +++ b/WASI.cmake @@ -0,0 +1 @@ +set(WASI 1) diff --git a/compiler-rt.spec b/compiler-rt.spec index 08178ef..07b3afc 100644 --- a/compiler-rt.spec +++ b/compiler-rt.spec @@ -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 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 18.1.8-2mamba +- rebuilt with wasi support + * Sat Jun 22 2024 Automatic Build System 18.1.8-1mamba - automatic version update by autodist diff --git a/wasi-toolchain.cmake b/wasi-toolchain.cmake new file mode 100644 index 0000000..0920f76 --- /dev/null +++ b/wasi-toolchain.cmake @@ -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)