From fc31bb8939a765f942a06933c1812bdce3b962d4 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Tue, 3 Jan 2023 08:45:57 -0500 Subject: [PATCH] changes needed to successfully build gcc (#83) * clang doesn't have `-nodefaultrpaths` * try `MachO::FatFile` if `MachO:MachOFile` fails * add explicit comments * use `MachO.open()` * fix fetch.ts for no src pkgs Co-authored-by: Max Howell --- projects/tea.xyz/gx/cc/cc.rb | 3 ++- projects/tea.xyz/gx/cc/package.yml | 2 +- scripts/brewkit/fix-machos.rb | 2 +- scripts/fetch.ts | 9 +++++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/tea.xyz/gx/cc/cc.rb b/projects/tea.xyz/gx/cc/cc.rb index 69fa1525..0a330222 100755 --- a/projects/tea.xyz/gx/cc/cc.rb +++ b/projects/tea.xyz/gx/cc/cc.rb @@ -11,8 +11,9 @@ $tea_prefix = ENV['TEA_PREFIX'] || `tea --prefix`.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,#$tea_prefix" + arg unless arg == "-Wl,-rpath,#$tea_prefix" or arg == "-nodefaultrpaths" end.compact # find next example of ourselves diff --git a/projects/tea.xyz/gx/cc/package.yml b/projects/tea.xyz/gx/cc/package.yml index b4cb3233..08b5392d 100644 --- a/projects/tea.xyz/gx/cc/package.yml +++ b/projects/tea.xyz/gx/cc/package.yml @@ -3,7 +3,7 @@ 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.1 + - 0.1.2 dependencies: linux: diff --git a/scripts/brewkit/fix-machos.rb b/scripts/brewkit/fix-machos.rb index 969a1969..4bb00a47 100755 --- a/scripts/brewkit/fix-machos.rb +++ b/scripts/brewkit/fix-machos.rb @@ -41,7 +41,7 @@ end class Fixer def initialize(file) - @file = MachO::MachOFile.new(file) + @file = MachO.open(file) @changed = false end diff --git a/scripts/fetch.ts b/scripts/fetch.ts index 45bbc1a7..de7ce6a9 100755 --- a/scripts/fetch.ts +++ b/scripts/fetch.ts @@ -53,7 +53,12 @@ export async function fetch_src(pkg: Package): Promise<[Path, Path] | undefined> if (import.meta.main) { for await (let pkg of ARGV.pkgs()) { pkg = await pantry.resolve(pkg) - const rv = await fetch_src(pkg) ?? panic() - await print(rv.join("\n") + "\n") + const rv = await fetch_src(pkg) + if (rv) { + // a package doesn’t require a source tarball + //FIXME is this dumb tho? In theory a package could just be a build script that generates itself + // in practice this is rare and pkgs could just specify some dummy tarball + await print(rv.join("\n") + "\n") + } } }