diff --git a/projects/clang.llvm.org/package.yml b/projects/clang.llvm.org/package.yml new file mode 100644 index 0000000000..e7b99b7ce9 --- /dev/null +++ b/projects/clang.llvm.org/package.yml @@ -0,0 +1,113 @@ +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 + strip: /^llvmorg-/ + +provides: + - bin/clang + - bin/clang++ + +dependencies: + llvm.org/core: '*' + compiler-rt.llvm.org: '*' + darwin: + apple.com/xcode/clt: '*' + +build: + dependencies: + tea.xyz/gx/cc: c99 + cmake.org: 3 + ninja-build.org: 1 + python.org: 3 + gnu.org/grep: '*' + gnu.org/patch: '*' + working-directory: build + script: + - run: | + pushd .. + # Set up clang-tools-extra + mkdir -p clang/tools/extra + mv clang-tools-extra/* clang/tools/extra + # Remove everything but clang and cmake directories + mkdir .tmp + mv build clang cmake tea.* xyz.tea.* .tmp + rm -rf * + mv .tmp/* . + ls + popd + - cmake ../clang $ARGS + - run: | + # Generate a list of distribution targets to avoid using static libraries. + # Borrowed from Arch. We need GNU grep for the PCRE regex. + # rm -rf targets.txt + ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r target; do + case $target in + clang-libraries|distribution) + continue + ;; + clang-tidy-headers) + continue + ;; + clang|clangd|clang-*) + ;; + clang*|findAllSymbols) + continue + ;; + esac + echo $target + done > targets.txt + - cmake ../clang -DLLVM_DISTRIBUTION_COMPONENTS="$(paste -sd\; targets.txt)" $ARGS + - ninja install-distribution + env: + ARGS: + - -G Ninja + - -DCMAKE_INSTALL_PREFIX="{{ prefix }}" + - -DCMAKE_BUILD_TYPE=Release + - -DCLANG_DEFAULT_PIE_ON_LINUX=ON + - -DCLANG_LINK_CLANG_DYLIB=ON + - -DLLVM_INCLUDE_DOCS=OFF + - -DLLVM_INCLUDE_TESTS=OFF + - -DLLVM_LINK_LLVM_DYLIB=ON + - -DCLANG_BUILT_STANDALONE=TRUE + - -DPython3_EXECUTABLE="{{ deps.python.org.prefix }}/bin/python3" + darwin: + ARGS: + #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 + linux: + ARGS: + # 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 + linux/x86-64: + ARGS: + # 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 + +test: + fixture: | + #include + int main() { + printf("Hello World!\n"); + return 0; + } + script: + - mv $FIXTURE $FIXTURE.c + - clang $ARGS $FIXTURE.c + - ./a.out + env: + ARGS: + - -Wl,-rpath,$TEA_PREFIX diff --git a/projects/compiler-rt.llvm.org/package.yml b/projects/compiler-rt.llvm.org/package.yml new file mode 100644 index 0000000000..d2d152c15d --- /dev/null +++ b/projects/compiler-rt.llvm.org/package.yml @@ -0,0 +1,43 @@ +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 + strip: /^llvmorg-/ + +dependencies: + darwin: + apple.com/xcode/clt: '*' + +build: + dependencies: + tea.xyz/gx/cc: c99 + cmake.org: 3 + ninja-build.org: 1 + python.org: 3 + llvm.org/core: '*' + working-directory: build + script: + - cmake ../compiler-rt $ARGS + - ninja + - ninja install + receipt: + - LLVMConfig.cmake + env: + ARGS: + - -G Ninja + - -DCMAKE_INSTALL_PREFIX="{{ prefix }}" + - -DCMAKE_BUILD_TYPE=Release + - -DLLVM_CONFIG_PATH="{{ deps.llvm.org/core.prefix }}/bin/llvm-config" + +test: + fixture: | + @msg = internal constant [12 x i8] c"steeping...\00" + declare i32 @puts(i8*) + define i32 @main() { + call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @msg, i32 0, i32 0)) + ret i32 0 + } + script: + - test $(lli $FIXTURE) = 'steeping...' diff --git a/projects/llvm.org/core/package.yml b/projects/llvm.org/core/package.yml new file mode 100644 index 0000000000..1875bdd4a8 --- /dev/null +++ b/projects/llvm.org/core/package.yml @@ -0,0 +1,152 @@ +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 + strip: /^llvmorg-/ + +provides: + - bin/bugpoint + - bin/dsymutil + - bin/llc + - bin/lli + - bin/llvm-addr2line + - bin/llvm-ar + - bin/llvm-as + - bin/llvm-bcanalyzer + - bin/llvm-bitcode-strip + - bin/llvm-c-test + - bin/llvm-cat + - bin/llvm-cfi-verify + - bin/llvm-config + - bin/llvm-cov + - bin/llvm-cvtres + - bin/llvm-cxxdump + - bin/llvm-cxxfilt + - bin/llvm-cxxmap + - bin/llvm-debuginfo-analyzer + - bin/llvm-debuginfod + - bin/llvm-debuginfod-find + - bin/llvm-diff + - bin/llvm-dis + - bin/llvm-dlltool + - bin/llvm-dwarfdump + - bin/llvm-dwarfutil + - bin/llvm-dwp + - bin/llvm-extract + - bin/llvm-gsymutil + - bin/llvm-ifs + - bin/llvm-install-name-tool + - bin/llvm-jitlink + - bin/llvm-lib + - bin/llvm-libtool-darwin + - bin/llvm-link + - bin/llvm-lipo + - bin/llvm-lto + - bin/llvm-lto2 + - bin/llvm-mc + - bin/llvm-mca + - bin/llvm-ml + - bin/llvm-modextract + - bin/llvm-mt + - bin/llvm-nm + - bin/llvm-objcopy + - bin/llvm-objdump + - bin/llvm-opt-report + - bin/llvm-otool + - bin/llvm-pdbutil + - bin/llvm-profdata + - bin/llvm-profgen + - bin/llvm-ranlib + - bin/llvm-rc + - bin/llvm-readelf + - bin/llvm-readobj + - bin/llvm-reduce + - bin/llvm-remark-size-diff + - bin/llvm-remarkutil + - bin/llvm-rtdyld + - bin/llvm-sim + - bin/llvm-size + - bin/llvm-split + - bin/llvm-stress + - bin/llvm-strings + - bin/llvm-strip + - bin/llvm-symbolizer + - bin/llvm-tapi-diff + - bin/llvm-tblgen + - bin/llvm-tli-checker + - bin/llvm-undname + - bin/llvm-windres + - bin/llvm-xray + - bin/opt + - bin/sancov + - bin/sanstats + - bin/verify-uselistorder + +dependencies: + zlib.net: 1 + darwin: + apple.com/xcode/clt: '*' + +build: + dependencies: + tea.xyz/gx/cc: c99 + cmake.org: 3 + ninja-build.org: 1 + python.org: 3 + crates.io/semverator: '*' + gnu.org/grep: '*' + working-directory: build + script: + - cmake ../llvm $ARGS + - run: | + # Generate a list of distribution targets to avoid shipping static libraries. + # Borrowed from Arch. We need GNU grep for the PCRE regex. + # rm -rf targets.txt + ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r target; do + case $target in + llvm-libraries|distribution) + continue + ;; + LLVM|LLVMgold) + ;; + LLVMDemangle|LLVMSupport|LLVMTableGen) + ;; + LLVM*) + continue + ;; + llvm-exegesis) + continue + ;; + esac + echo $target + done > targets.txt + - cmake ../llvm -DLLVM_DISTRIBUTION_COMPONENTS="$(paste -sd\; targets.txt)" $ARGS + - ninja install-distribution + receipt: + - LLVMConfig.cmake + env: + ARGS: + - -G Ninja + - -DCMAKE_INSTALL_PREFIX="{{ prefix }}" + - -DCMAKE_BUILD_TYPE=Release + - -DLLVM_ENABLE_BINDINGS=OFF + - -DLLVM_INCLUDE_BENCHMARKS=OFF + - -DLLVM_INCLUDE_DOCS=OFF + - -DLLVM_INCLUDE_EXAMPLES=OFF + - -DLLVM_INCLUDE_TESTS=OFF + - -DLLVM_INSTALL_UTILS=ON + - -DLLVM_LINK_LLVM_DYLIB=ON + - -DLLVM_UTILS_INSTALL_DIR=libexec + +test: + fixture: | + @msg = internal constant [12 x i8] c"steeping...\00" + declare i32 @puts(i8*) + define i32 @main() { + call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @msg, i32 0, i32 0)) + ret i32 0 + } + script: + - test $(lli $FIXTURE) = 'steeping...' diff --git a/projects/llvm.org/package.yml b/projects/llvm.org/package.yml index e5efaf79b0..8ff92184e5 100644 --- a/projects/llvm.org/package.yml +++ b/projects/llvm.org/package.yml @@ -1,103 +1,14 @@ +# metapackage for LLVM and its subprojects + 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 strip: /^llvmorg-/ -provides: - - bin/lld - - bin/clang - - bin/clang++ - dependencies: - zlib.net: 1 - darwin: - apple.com/xcode/clt: '*' - -build: - dependencies: - tea.xyz/gx/cc: c99 - cmake.org: 3 - ninja-build.org: 1 - python.org: 3 - crates.io/semverator: '*' - working-directory: build - script: - # Building compiler-rt on darwin+aarch64 fails for versions less than - # 14 with the below configuration. FIXME if possible, of course. - - run: | - if test "{{hw.platform}}" = "linux" || \ - test "{{hw.arch}}" = "x86-64" || \ - semverator satisies '>=14'; then - ARGS="$ARGS -DLLVM_ENABLE_RUNTIMES='compiler-rt'" - fi - - cmake ../llvm -G Ninja $ARGS - - ninja - - ninja install - receipt: - - LLVMConfig.cmake - env: - ARGS: - - -DCMAKE_INSTALL_PREFIX="{{ prefix }}" - - -DCMAKE_BUILD_TYPE=Release - - -DLLVM_ENABLE_PROJECTS='lld;clang' - - -DLLVM_INCLUDE_DOCS=OFF - - -DLLVM_INCLUDE_TESTS=OFF - linux: - ARGS: - # 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 - darwin: - ARGS: - #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 - linux/x86-64: - ARGS: - # 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" - linux/aarch64: - ARGS: - # otherwise compiler-rt fails to build - # https://reviews.llvm.org/D147598 - - -DCMAKE_C_COMPILER_TARGET="aarch64-unknown-linux-gnu" + llvm.org/core: '*' + compiler-rt.llvm.org: '*' -test: - fixture: | - #include - int main() { - printf("Hello World!\n"); - return 0; - } - dependencies: - crates.io/semverator: '*' - script: - # Building compiler-rt on darwin+aarch64 fails for versions less than - # 14 with the below configuration. FIXME if possible, of course. - - run: | - if test "{{hw.platform}}" = "linux" || \ - test "{{hw.arch}}" = "x86-64" || \ - semverator satisies '>=14'; then - ARGS="$ARGS -fsanitize=address,undefined" - fi - - mv $FIXTURE $FIXTURE.c - - clang $ARGS $FIXTURE.c - - ./a.out - env: - ARGS: - - -Wl,-rpath,$TEA_PREFIX +build: mkdir -p {{prefix}} && touch {{prefix}}/.tea-empty diff --git a/projects/tea.xyz/gx/cc/package.yml b/projects/tea.xyz/gx/cc/package.yml index b4028f1bf3..ebeb73048f 100644 --- a/projects/tea.xyz/gx/cc/package.yml +++ b/projects/tea.xyz/gx/cc/package.yml @@ -7,7 +7,7 @@ versions: dependencies: linux: - llvm.org: '*' + clang.llvm.org: '*' darwin: apple.com/xcode/clt: '*'