# This is the source.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 build function is executed in the source directory # This function is used to compile the source code build() { cd lld cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_DOCDIR=share/doc \ -DCMAKE_SKIP_RPATH=ON \ -DBUILD_SHARED_LIBS=ON \ -DLLVM_BUILD_DOCS=ON \ -DLLVM_ENABLE_SPHINX=ON \ -DLLVM_INCLUDE_TESTS=OFF \ -DLLVM_LINK_LLVM_DYLIB=ON \ -DSPHINX_WARNINGS_AS_ERRORS=OFF \ -DLLVM_MAIN_SRC_DIR="$BPM_SOURCE"/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() { cd lld DESTDIR="$BPM_OUTPUT" cmake --install build # Fix https://bugs.llvm.org/show_bug.cgi?id=42455 install -Dm644 "$BPM_SOURCE"/lld/docs/ld.lld.1 "$BPM_OUTPUT"/usr/share/man/man1/ld.lld.1 # Remove documentation sources rm -r "$BPM_OUTPUT"/usr/share/doc/lld/html/{_sources,.buildinfo} # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/lld/LICENSE.TXT }