mag

a binary package manager in one C file: apk and pacman repos, CRUX, Void and Exherbo ports
git clone https://github.com/tortr-rs/mag
Log | Files | Refs | README | LICENSE

commit 9d66eae3da1abbb868e40c0e50d9a3b692f5d437
parent 1ec8f0a74daa958df98f82c6ee02e5f94fe2671d
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Sat, 14 Nov 2026 16:06:53 +0000

wrapper cc drops -lgcc

Diffstat:
Mmag.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mag.c b/mag.c @@ -1248,7 +1248,7 @@ static char *build(const struct recipe *r) free(pcopy); if (!real) die("no clang in PATH: it is the compiler for a musl root"); mkpath(bin, 0755); - script = fmt("#!/bin/sh\nexec %s --target=x86_64-linux-musl --sysroot=%s -fuse-ld=lld -rtlib=compiler-rt -nostdlibinc -isystem %s/usr/include -Wno-unused-command-line-argument -Wl,--dynamic-linker=%s -Wl,-rpath,%s/usr/lib \"$@\"\n", real, root, root, so, root); + script = fmt("#!/bin/sh\nn=$#\nwhile [ $n -gt 0 ]; do x=$1; shift; n=$((n - 1)); case $x in -lgcc|-lgcc_s|-lgcc_eh) ;; *) set -- \"$@\" \"$x\";; esac; done\nexec %s --target=x86_64-linux-musl --sysroot=%s -fuse-ld=lld -rtlib=compiler-rt -nostdlibinc -isystem %s/usr/include -Wno-unused-command-line-argument -Wl,--dynamic-linker=%s -Wl,-rpath,%s/usr/lib \"$@\"\n", real, root, root, so, root); { FILE *f = fopen(cc, "w"); if (!f) die("cannot write %s", cc); fputs(script, f); fclose(f); chmod(cc, 0755); } for (ni = 0; names[ni]; ni++) { char *l = fmt("%s/%s", bin, names[ni]); unlink(l); symlink("cc", l); free(l); } np = fmt("%s:%s", bin, getenv("PATH")); setenv("PATH", np, 1); free(np);