# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/wasi-compiler-rt/wasi-compiler-rt.conf # Copyright (C) 2022 - 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2. # --- T2-COPYRIGHT-NOTE-END --- CC_WRAPPER_BYPASS=1 # TODO: sync w/ wasi-libc [ $prefix_auto = 1 ] && prefix=opt/wasi && set_confopt runmake=0 prepare_sources() { cd .. tar $taropt `match_source_file -p llvm-cmake-$ver` ln -svf cmake* cmake } hook_add preconf 5 prepare_sources export CC=clang CXX=clang++ # LD=clang export CFLAGS="-fno-exceptions --sysroot=$root/opt/wasi" export CXXFLAGS="-fno-exceptions --sysroot=$root/opt/wasi" export DESTDIR=$root cmakeopt= var_append cmakeopt " " "-DUNIX=ON \ -DCMAKE_TOOLCHAIN_FILE=$confdir/../wasi-libc/wasi-sdk.cmake \ -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON \ -DCMAKE_STAGING_PREFIX=/opt/wasi" var_append cmakeopt " " "-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" build_compiler_rt() { eval cmake -B objs $cmakeopt compiler-rt-*/lib/builtins cmake --build objs cmake --install objs clangver=${ver%%.*} mkdir -p $root/usr/lib/clang/$clangver/lib/wasi/ cp -arv $root/$prefix/lib/wasi/libclang_rt.builtins-wasm32.a $root/usr/lib/clang/$clangver/lib/wasi/ if ! atstage native; then mkdir -p $root/TOOLCHAIN/cross/lib/clang/$clangver/lib/wasi/ cp -arv $root/$prefix/lib/wasi/libclang_rt.builtins-wasm32.a \ $root/TOOLCHAIN/cross/lib/clang/$clangver/lib/wasi/ fi } hook_add inmake 5 build_compiler_rt