# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT # The prepare function is executed in the root of the temp directory # This function is used for downloading files and putting them into the correct location prepare() { cd "$BPM_SOURCE" # Fix https://github.com/llvmenv/llvmenv/issues/115 ln -s ../../libunwind/include/mach-o MachO/mach-o } # The build function is executed in the source directory # This function is used to compile the source code build() { cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm${BPM_PKG_VERSION%%.*} \ -DCMAKE_SKIP_RPATH=ON \ -DBUILD_SHARED_LIBS=ON \ -DLLVM_CMAKE_DIR=/usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/cmake \ -DLLVM_CONFIG=/usr/lib/llvm${BPM_PKG_VERSION%%.*}/bin/llvm-config \ -DLLVM_BUILD_DOCS=OFF \ -DLLVM_ENABLE_SPHINX=OFF \ -DLLVM_INCLUDE_TESTS=OFF \ -DLLVM_LINK_LLVM_DYLIB=ON \ -DLLVM_MAIN_SRC_DIR="${BPM_WORKDIR}"/llvm cmake --build build } # The package function is executed in the source directory # This function is used to move the compiled files into the output directory package() { DESTDIR="$BPM_OUTPUT" cmake --install build # Symlink libraries for lib in COFF Common ELF MachO MinGW Wasm; do ln -s llvm${BPM_PKG_VERSION%%.*}/lib/liblld"$lib".so.${BPM_PKG_VERSION%.*} "$BPM_OUTPUT"/usr/lib/liblld"$lib".so.${BPM_PKG_VERSION%.*} done # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/lld/LICENSE.TXT }