diff --git a/projects/gnu.org/gcc/package.yml b/projects/gnu.org/gcc/package.yml index 448186d4..b8ce8650 100644 --- a/projects/gnu.org/gcc/package.yml +++ b/projects/gnu.org/gcc/package.yml @@ -59,11 +59,21 @@ build: # On Linux, we need to move the libraries to the lib directory. - run: | - if test {{hw.platform}} = "linux"; then - mv lib64/* lib/ - rmdir lib64 - fi + mv lib64/* lib/ + rmdir lib64 + if: linux working-directory: ${{prefix}} + + # 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 gcc cc + ln -sf gcc-ar ar + ln -sf gcc-nm nm + ln -sf gcc-ranlib ranlib + working-directory: ${{prefix}}/bin + env: # Branch from the Darwin maintainer of GCC, with a few generic fixes and # Apple Silicon support, located at https://github.com/iains/gcc-12-branch @@ -115,6 +125,8 @@ test: - test "$(./test3)" = "Hello, world!" provides: + - bin/ar + - bin/cc - bin/c++ - bin/gc++ - bin/cpp @@ -128,3 +140,5 @@ provides: - bin/gcov-tool - bin/gfortran - bin/lto-dump + - bin/nm + - bin/ranlib diff --git a/projects/llvm.org/package.yml b/projects/llvm.org/package.yml index 271c7fd7..b1c1defc 100644 --- a/projects/llvm.org/package.yml +++ b/projects/llvm.org/package.yml @@ -10,6 +10,17 @@ provides: - bin/lld - bin/clang - bin/clang++ + - bin/cc + - bin/c++ + - bin/cpp + - bin/ar + - bin/as + - bin/nm + - bin/objcopy + - bin/ranlib + - bin/readelf + - bin/strings + - bin/strip dependencies: zlib.net: 1 @@ -27,12 +38,26 @@ build: - run: | if test "{{hw.platform}}" = "linux" || \ test "{{hw.arch}}" = "x86-64" || \ - semverator satisies '>=14'; then + semverator satisfies '>=14' {{version}}; then ARGS="$ARGS -DLLVM_ENABLE_RUNTIMES='compiler-rt'" fi + # if: linux || x86-64 || >=14 ## Brewkit can't do this. Yet. - cmake ../llvm -G Ninja $ARGS - ninja - ninja install + + # 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 + receipt: - LLVMConfig.cmake env: @@ -90,9 +115,10 @@ test: - run: | if test "{{hw.platform}}" = "linux" || \ test "{{hw.arch}}" = "x86-64" || \ - semverator satisies '>=14'; then + semverator satisfies '>=14' {{version}}; then ARGS="$ARGS -fsanitize=address,undefined" fi + # if: linux || x86-64 || >=14 ## Brewkit can't do this. Yet. - mv $FIXTURE $FIXTURE.c - clang $ARGS $FIXTURE.c - ./a.out diff --git a/projects/tea.xyz/gx/cc/cc.rb b/projects/tea.xyz/gx/cc/cc.rb deleted file mode 100755 index 02d9fec8..00000000 --- a/projects/tea.xyz/gx/cc/cc.rb +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/ruby - -# - we inject our rpath to ensure our libs our found -# - for bottles we replace that in fix-machos.rb with a relocatable prefix -# - in general usage we don’t, so if the user needs to distribute their artifacts, -# they will need to fix them first, but that's typical anyway. -# - for tea-envs the user probably won’t use tea.xyz/gx/cc even though they *should* -# and thus we set LDFLAGS in the hope that they will be picked up and the rpath set - -$pkgx_prefix = ENV['PKGX_DIR'] || ENV['HOME'].chomp -exe = File.basename($0) - -# remove duplicates since this in fact embeds the rpath multiple times -# and omit -nodefaultrpaths since it is not a valid flag for clang -args = ARGV.map do |arg| - arg unless arg == "-Wl,-rpath,#$pkgx_prefix" or arg == "-nodefaultrpaths" -end.compact - -def is_tea? path - path = File.realpath path while File.symlink? path - return File.basename(path) == "tea" -end - -# find next example of ourselves -# this will either pick the Apple provided clang or the tea one -exe_path = ENV['PATH'].split(":").filter { |path| - if path == File.dirname(__FILE__) - false - elsif path == File.join($pkgx_prefix, ".local/bin") - false - elsif is_tea?(path) - false - else - true - end -}.map { |path| - "#{path}/#{exe}" -}.reject { |path| - # if the user created a symlink of `cc` to `tea` don’t use it - File.symlink? path and File.basename(File.readlink(path)) == "tea" -}.find { |path| - File.exist?(path) -} - -abort "couldn’t find #{exe} in `PATH`" unless exe_path - -for arg in args do - # figuring out what “mode” we are operating in is hard - # we don’t want to add this linker command always because it causes a warning to be - # output if we are not outputing executables/dylibs and this warning can break - # configure scripts, however the below is not fully encompassing - # we aren't sure what the rules are TBH, possibly it is as simple as if the output (`-o`) - # is a .o then we don’t add the rpath - if arg.start_with? '-l' or arg.end_with? '.dylib' - exec exe_path, *args, "-Wl,-rpath,#$pkgx_prefix" - end -end - -exec exe_path, *args diff --git a/projects/tea.xyz/gx/cc/ld b/projects/tea.xyz/gx/cc/ld deleted file mode 100755 index 55905946..00000000 --- a/projects/tea.xyz/gx/cc/ld +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -set -e - -if test -z "$PKGX_DIR" -then - echo 'PKGX_DIR mysteriously unset' >&2 - exit 1 -fi - -DIR=$(dirname "$0") -IFS=: read -r -a PATHS <<< "$PATH" - -__which() { - for dir in "${PATHS[@]}"; do - if test "$dir" == "$DIR"; then - : # no fork bombs thanks - elif [ -L "$dir/$1" ]; then - # no fork bombs thanks - foo="$(realpath "$dir/$1")" - foo="$(basename "$foo")" - if [ "$foo" != "tea" ]; then - exe="$dir/$1" - return 0 - fi - elif [ -x "$dir/$1" ]; then - exe="$dir/$1" - return 0 - fi - done - - return 1 -} - -# If we can find our specific name, e.g. `lld`, -# passthrough to that -# Otherwise, fallback to `ld` -# NB: this might not have the right invocations, sometimes; -# (invoking `ld` as `lld64.ld`) watch for those potential cases -if __which "$(basename "$0")" || __which ld; then - : -else - echo 'ld not found in PATH' >&2 - exit 127 -fi - -# At a minimum, `ld` will complain if you mix the `-r` and `-rpath` flags, -# so if any argument to this script is `-r`, we just pass through without -# additions. -for word in "$@"; do - if test "$word" = "-r"; then - exec "$exe" "$@" - fi -done - -exec "$exe" "$@" -rpath "$PKGX_DIR" diff --git a/projects/tea.xyz/gx/cc/package.yml b/projects/tea.xyz/gx/cc/package.yml deleted file mode 100644 index 1c64db64..00000000 --- a/projects/tea.xyz/gx/cc/package.yml +++ /dev/null @@ -1,61 +0,0 @@ -distributable: ~ - -# FIXME we want the c version eg. c99 -# or should that be some kind of option? so you specify you want a cc that support c99 -versions: - - 0.1.7 - -dependencies: - linux: - llvm.org: '*' - -runtime: - env: - linux/x86-64: - LDFLAGS: $LDFLAGS -pie - CFLAGS: $CFLAGS -fPIC - CXXFLAGS: $CXXFLAGS -fPIC - -build: - working-directory: - ${{prefix}}/bin - script: | - if test {{ hw.platform }} = darwin; then - cp "$SRCROOT"/props/ld . - cp "$SRCROOT"/props/cc.rb cc - else - ln -s "$LLVM"/clang cc - ln -s "$LLVM"/lld ld - ln -s "$LLVM"/clang-cpp cpp - for x in ar as strip objcopy nm objdump ranlib readelf strings; do - ln -sf "$LLVM"/llvm-$x $x - done - fi - - for x in clang gcc clang++ c++ g++; do - ln -s cc $x - done - for x in lld-link lld ld64.lld; do - ln -s ld $x - done - - # dunno why we gotta do this, but we do - chmod 777 * - env: - LLVM: ../../../../../llvm.org/v*/bin - -test: | - cc --version - ld --help - -provides: - - bin/c++ - - bin/cc - - bin/clang - - bin/clang++ - - bin/g++ - - bin/gcc - - bin/ld - - bin/ld64.lld - - bin/lld - - bin/lld-link