2022-08-02 20:34:21 +03:00
|
|
|
|
distributable:
|
|
|
|
|
url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/llvm-project-{{ version }}.src.tar.xz
|
|
|
|
|
strip-components: 1
|
|
|
|
|
|
|
|
|
|
versions:
|
|
|
|
|
github: llvm/llvm-project
|
2023-04-14 01:14:56 +03:00
|
|
|
|
strip: /^llvmorg-/
|
2022-08-02 20:34:21 +03:00
|
|
|
|
|
|
|
|
|
provides:
|
|
|
|
|
- bin/lld
|
|
|
|
|
- bin/clang
|
|
|
|
|
- bin/clang++
|
2023-10-05 17:59:41 +03:00
|
|
|
|
- bin/cc
|
|
|
|
|
- bin/c++
|
|
|
|
|
- bin/cpp
|
|
|
|
|
- bin/ar
|
|
|
|
|
- bin/as
|
|
|
|
|
- bin/nm
|
|
|
|
|
- bin/objcopy
|
|
|
|
|
- bin/ranlib
|
|
|
|
|
- bin/readelf
|
|
|
|
|
- bin/strings
|
|
|
|
|
- bin/strip
|
2022-08-02 20:34:21 +03:00
|
|
|
|
|
2022-10-17 22:36:52 +03:00
|
|
|
|
dependencies:
|
2022-10-18 17:15:44 +03:00
|
|
|
|
zlib.net: 1
|
2022-10-17 22:36:52 +03:00
|
|
|
|
|
2022-08-02 20:34:21 +03:00
|
|
|
|
build:
|
|
|
|
|
dependencies:
|
|
|
|
|
cmake.org: 3
|
|
|
|
|
ninja-build.org: 1
|
2023-10-03 18:23:56 +03:00
|
|
|
|
python.org: '>=3<3.12'
|
2023-06-28 07:07:35 +03:00
|
|
|
|
crates.io/semverator: '*'
|
2022-08-02 20:34:21 +03:00
|
|
|
|
working-directory: build
|
2023-06-28 07:07:35 +03:00
|
|
|
|
script:
|
|
|
|
|
# Building compiler-rt on darwin+aarch64 fails for versions less than
|
|
|
|
|
# 14 with the below configuration. FIXME if possible, of course.
|
|
|
|
|
- run: |
|
2024-02-21 00:10:24 +03:00
|
|
|
|
RUNTIMES="-DLLVM_ENABLE_RUNTIMES='compiler-rt;libcxx;libcxxabi;libunwind'"
|
2023-10-11 04:39:17 +03:00
|
|
|
|
if test "{{hw.platform}}" = "linux"; then
|
2024-02-21 00:10:24 +03:00
|
|
|
|
ARGS="$ARGS $RUNTIMES"
|
2023-10-11 04:39:17 +03:00
|
|
|
|
elif semverator satisfies '>=14' {{version}}; then
|
2024-02-21 00:10:24 +03:00
|
|
|
|
ARGS="$ARGS $RUNTIMES"
|
2023-10-11 04:39:17 +03:00
|
|
|
|
elif test "{{hw.arch}}" = "x86-64" && semverator satisfies '>=14' {{version}}; then
|
2024-02-21 00:10:24 +03:00
|
|
|
|
ARGS="$ARGS $RUNTIMES"
|
2023-06-28 07:07:35 +03:00
|
|
|
|
fi
|
2023-10-11 04:39:17 +03:00
|
|
|
|
# if: linux || >=14 || (x86-64 && >=13) ## Brewkit can't do this. Yet.
|
2023-06-28 07:07:35 +03:00
|
|
|
|
- cmake ../llvm -G Ninja $ARGS
|
|
|
|
|
- ninja
|
|
|
|
|
- ninja install
|
2023-10-05 17:59:41 +03:00
|
|
|
|
|
|
|
|
|
# other tools simply expect these symlinks and often fail without them
|
|
|
|
|
# NOTE forcing symlinks because we build with ourselves and sometimes that
|
|
|
|
|
# means we're building with the exact same version FIXME
|
|
|
|
|
- run: |
|
|
|
|
|
ln -sf clang cc
|
|
|
|
|
ln -sf clang++ c++
|
|
|
|
|
ln -sf clang-cpp cpp
|
|
|
|
|
for x in ar as nm objcopy ranlib readelf strings strip; do
|
|
|
|
|
ln -sf llvm-$x $x
|
|
|
|
|
done
|
|
|
|
|
working-directory: ${{prefix}}/bin
|
|
|
|
|
|
2024-02-21 23:19:54 +03:00
|
|
|
|
# move linux libs into /lib
|
|
|
|
|
- run: |
|
|
|
|
|
TARGET="$(find . -maxdepth 1 -type d -name \*-unknown-linux-gnu)"
|
|
|
|
|
mv "$TARGET"/* .
|
|
|
|
|
rmdir "$TARGET"
|
|
|
|
|
ln -s . "$TARGET"
|
|
|
|
|
working-directory: ${{prefix}}/lib
|
|
|
|
|
if: linux
|
|
|
|
|
|
2022-08-02 20:34:21 +03:00
|
|
|
|
receipt:
|
|
|
|
|
- LLVMConfig.cmake
|
|
|
|
|
env:
|
|
|
|
|
ARGS:
|
|
|
|
|
- -DCMAKE_INSTALL_PREFIX="{{ prefix }}"
|
|
|
|
|
- -DCMAKE_BUILD_TYPE=Release
|
|
|
|
|
- -DLLVM_ENABLE_PROJECTS='lld;clang'
|
2022-08-24 00:28:58 +03:00
|
|
|
|
- -DLLVM_INCLUDE_DOCS=OFF
|
|
|
|
|
- -DLLVM_INCLUDE_TESTS=OFF
|
2023-08-18 15:52:23 +03:00
|
|
|
|
- -DLLVM_ENABLE_RTTI=ON
|
2023-11-02 22:51:45 +03:00
|
|
|
|
- -DLLVM_BUILD_LLVM_DYLIB=ON
|
2022-11-11 03:53:26 +03:00
|
|
|
|
linux:
|
|
|
|
|
ARGS:
|
2023-10-02 04:27:27 +03:00
|
|
|
|
# the default is `ld` however clang when handling linking itself
|
|
|
|
|
# internally passes flags that, in fact, expect `lld`
|
|
|
|
|
#NOTE only wanted on linux because on macOS we actually *need* the Apple
|
|
|
|
|
# provided `ld` or things *also* break 😆
|
|
|
|
|
- -DCLANG_DEFAULT_LINKER=lld
|
|
|
|
|
# Needed with the CMAKE_C_COMPILER_TARGET to compile compiler-rt on linux
|
|
|
|
|
# https://reviews.llvm.org/D147598
|
|
|
|
|
- -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
|
2022-08-31 21:05:21 +03:00
|
|
|
|
darwin:
|
|
|
|
|
ARGS:
|
2023-10-02 04:27:27 +03:00
|
|
|
|
#FIXME shouldn’t *have to* require the command line tools package
|
|
|
|
|
#FIXME this is no good for systems with only Xcode installed
|
|
|
|
|
#NOTE how do Apple make their LLVM find both? we want the same trick
|
|
|
|
|
- -DDEFAULT_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
|
2022-08-27 18:58:16 +03:00
|
|
|
|
linux/x86-64:
|
|
|
|
|
ARGS:
|
2023-10-02 04:27:27 +03:00
|
|
|
|
# required to build something that works on linux/x86-64
|
|
|
|
|
- -DCLANG_DEFAULT_CXX_STDLIB=libstdc++
|
|
|
|
|
- -DCLANG_DEFAULT_RTLIB=libgcc
|
|
|
|
|
- -DCOMPILER_RT_INCLUDE_TESTS=OFF
|
|
|
|
|
- -DCOMPILER_RT_USE_LIBCXX=OFF
|
|
|
|
|
# otherwise compiler-rt fails to build
|
|
|
|
|
# https://reviews.llvm.org/D147598
|
|
|
|
|
- -DCMAKE_C_COMPILER_TARGET="x86_64-unknown-linux-gnu"
|
2023-06-26 23:34:19 +03:00
|
|
|
|
linux/aarch64:
|
|
|
|
|
ARGS:
|
2023-10-02 04:27:27 +03:00
|
|
|
|
# otherwise compiler-rt fails to build
|
|
|
|
|
# https://reviews.llvm.org/D147598
|
|
|
|
|
- -DCMAKE_C_COMPILER_TARGET="aarch64-unknown-linux-gnu"
|
2023-06-26 23:34:19 +03:00
|
|
|
|
|
2022-08-02 20:34:21 +03:00
|
|
|
|
test:
|
2022-08-24 00:28:58 +03:00
|
|
|
|
fixture: |
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
int main() {
|
|
|
|
|
printf("Hello World!\n");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2023-06-28 07:07:35 +03:00
|
|
|
|
dependencies:
|
|
|
|
|
crates.io/semverator: '*'
|
2023-06-26 23:34:19 +03:00
|
|
|
|
script:
|
2023-06-28 07:07:35 +03:00
|
|
|
|
# Building compiler-rt on darwin+aarch64 fails for versions less than
|
|
|
|
|
# 14 with the below configuration. FIXME if possible, of course.
|
|
|
|
|
- run: |
|
2023-10-11 04:39:17 +03:00
|
|
|
|
if test "{{hw.platform}}" = "linux"; then
|
|
|
|
|
ARGS="$ARGS -fsanitize=address,undefined"
|
|
|
|
|
elif semverator satisfies '>=14' {{version}}; then
|
|
|
|
|
ARGS="$ARGS -fsanitize=address,undefined"
|
|
|
|
|
elif test "{{hw.arch}}" = "x86-64" && semverator satisfies '>=14' {{version}}; then
|
|
|
|
|
ARGS="$ARGS -fsanitize=address,undefined"
|
2023-06-28 07:07:35 +03:00
|
|
|
|
fi
|
2023-10-11 04:39:17 +03:00
|
|
|
|
# if: linux || >=14 || (x86-64 && >=13) ## Brewkit can't do this. Yet.
|
2023-06-26 23:34:19 +03:00
|
|
|
|
- mv $FIXTURE $FIXTURE.c
|
|
|
|
|
- clang $ARGS $FIXTURE.c
|
|
|
|
|
- ./a.out
|
|
|
|
|
env:
|
|
|
|
|
ARGS:
|
2023-10-02 04:27:27 +03:00
|
|
|
|
- -Wl,-rpath,$PKGX_DIR
|