From 8bda19a3acd81192e09f4d8c5d6ec3ac386f1298 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Mon, 9 Sep 2024 11:23:25 +0000 Subject: [PATCH] Initial Commit --- pkg.info | 8 ++++++++ source.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 pkg.info create mode 100644 source.sh diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..3f2509d --- /dev/null +++ b/pkg.info @@ -0,0 +1,8 @@ +name: llvm +description: A collection of modular and reusable compiler and toolchain technologies +version: 17.0.6 +url: https://llvm.org +license: Apache-2.0 with llvm exceptions +architecture: any +depends: ["cmake","python3"] +type: source diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..7693520 --- /dev/null +++ b/source.sh @@ -0,0 +1,51 @@ +# 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 + +DOWNLOAD="https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/llvm-${BPM_PKG_VERSION}.src.tar.xz" +DOWNLOAD_CMAKE_MODULES="https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/cmake-${BPM_PKG_VERSION}.src.tar.xz" +DOWNLOAD_THIRD_PARTY="https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/third-party-${BPM_PKG_VERSION}.src.tar.xz" +FILENAME="${DOWNLOAD##*/}" +FILENAME_CMAKE_MODULES="${DOWNLOAD_CMAKE_MODULES##*/}" +FILENAME_THIRD_PARTY="${DOWNLOAD_THIRD_PARTY##*/}" + +# 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() { + wget "$DOWNLOAD" + wget "$DOWNLOAD_CMAKE_MODULES" + wget "$DOWNLOAD_THIRD_PARTY" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" + mkdir {cmake,third-party} + tar -xvf "$FILENAME_CMAKE_MODULES" --strip-components=1 -C cmake + tar -xvf "$FILENAME_THIRD_PARTY" --strip-components=1 -C third-party +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + + mkdir -v build + cd build + + CC=gcc CXX=g++ \ + cmake -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_ENABLE_FFI=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_TARGETS_TO_BUILD="host" \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -Wno-dev -G Ninja .. + ninja +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + cd build + DESTDIR="$BPM_OUTPUT" ninja install + cp bin/FileCheck "$BPM_OUTPUT"/usr/bin +}