me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

busybox: link the second-stage shell against the installed Vinix musl

diviocity committed 6 days ago · 2710d21a3af42b3548ffcaa479967cb7d934af55 View patch
Unverified signature 1 files changed +28 -5
busybox/PKGBUILD.vile +28 -5

@@ -1,16 +1,30 @@

1+; Kbuild runs the target compiler from the BusyBox source directory. The

2+; relative link keeps the sysroot's path out of make's split command words.

3+target-cc := "CC=gcc --sysroot=../vinix-sysroot -specs=../vinix-sysroot/usr/lib/musl-gcc-sysroot.specs"

4+

15defpkgbuild(busybox,

26 #:pkgname, "busybox",

37 #:pkgver, "1.38.0",

4- #:pkgrel, 1,

8+ #:pkgrel, 2,

59 #:pkgdesc, "Static musl shell and bootstrap utilities for Vinix",

610 #:arch, [#:x86-64],

711 #:url, "https://busybox.net/",

812 #:license, "GPL-2.0-only",

13+ #:makedepends, ["musl=1.2.6-1"],

914 #:source, ["https://busybox.net/downloads/busybox-1.38.0.tar.bz2", "bootstrap.config"],

1015 #:sha256sums, ["34f9ea6ff8636f2c9241153b9114eefa9e65674a45318ae1ef95bb5f31c53bb2",

1116 "9d8c4fb8ebad6ddbf058e151d807a90ce7687643626e0e4b5357e587718dec00"],

1217

1318 #:prepare, fn() {

19+ root := get-environment-variable("VPAC_MAKEPKG_ROOT")

20+ if not(string?(root)) {

21+ display("Set VPAC_MAKEPKG_ROOT to the absolute path of the installed Vinix build root.")

22+ newline()

23+ run("false")

24+ }

25+ run("test", "-f", string-append(root, "/usr/lib/musl-gcc-sysroot.specs"))

26+ run("ln", "-s", root, "vinix-sysroot")

27+

1428 ; Start with everything disabled. BusyBox allnoconfig overrides explicit

1529 ; KCONFIG_ALLCONFIG selections, so enable the selected options afterwards.

1630 run("make", "-C", "busybox-1.38.0", "allnoconfig")

@@ -21,8 +35,8 @@ defpkgbuild(busybox,

2135 run("sed", "-i", "-f", "enable.sed", "busybox-1.38.0/vinix.defconfig")

2236 run("make", "-C", "busybox-1.38.0", "KBUILD_DEFCONFIG=vinix.defconfig", "defconfig")

2337

24- ; The musl-gcc wrapper uses its own libc headers. Only the kernel UAPI

25- ; directories are needed from linux-libc-dev on the x86-64 builder.

38+ ; musl supplies libc headers. Import only the Linux kernel UAPI from

39+ ; the x86-64 builder until those headers have their own Vinix package.

2640 run("mkdir", "uapi")

2741 run("ln", "-s", "/usr/include/linux", "uapi/linux")

2842 run("ln", "-s", "/usr/include/asm-generic", "uapi/asm-generic")

@@ -33,14 +47,23 @@ defpkgbuild(busybox,

3347 }

3448 },

3549 #:build, fn() {

36- run("make", "-C", "busybox-1.38.0", "CC=musl-gcc", "EXTRA_CFLAGS=-I../uapi")

50+ run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH",

51+ "make", "-C", "busybox-1.38.0", target-cc, "EXTRA_CFLAGS=-I../uapi", "busybox")

3752 },

3853 #:check, fn() {

54+ ; Check what the final executable actually linked, and the dependencies

55+ ; emitted when compiling ash. Keep the proof in the build transcript.

56+ for-each(fn(file) {

57+ run("grep", "-Fx", string-append("LOAD ../vinix-sysroot/usr/lib/", file),

58+ "busybox-1.38.0/busybox_unstripped.map")

59+ }, list("Scrt1.o", "crti.o", "libc.a", "crtn.o"))

60+ run("grep", "-F", "../vinix-sysroot/usr/include/stdio.h", "busybox-1.38.0/shell/.ash.o.cmd")

3961 run("busybox-1.38.0/busybox", "ash", "-n", "/dev/null")

4062 run("busybox-1.38.0/busybox", "true")

4163 },

4264 #:package, fn() {

43- run("make", "-C", "busybox-1.38.0", "CC=musl-gcc", "EXTRA_CFLAGS=-I../uapi",

65+ run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH",

66+ "make", "-C", "busybox-1.38.0", target-cc, "EXTRA_CFLAGS=-I../uapi",

4467 string-append("CONFIG_PREFIX=", pkgdir()), "install")

4568 run("install", "-Dm644", "busybox-1.38.0/LICENSE",

4669 string-append(pkgdir(), "/usr/share/licenses/busybox/LICENSE"))