aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/package/musl/package.az
blob: d3192308c608e87fdcb106b9a56d7fbfe0c89993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package musl-source {
	description = "an implementation of the C standard library - source code";
	exclude = true;

	version# = "1.2.6";
	output = remoteTar {
		url = "https://musl.libc.org/releases/musl-"+version+".tar.gz";
		checksum = "WtWb_OV_XxLDAB5NerOL9loLlHVadV00MmGk65PPBU1evaolagoMHfvpZp_vxEzS";
		compress = gzip;
	};
	patches = [ "ldso-rosa.patch" ];
}

package musl-headers {
	description = "system installation of musl headers";

	source = musl-source;

	libc = false;
	env = [
		"LDFLAGS=" + earlyLDFLAGS,
	];

	exec = make {
		defaults = false;
		make = [ "DESTDIR=/work", "install-headers" ];
		check = nil;
		install = "# headers installed during make";
	};

	tools = [ coreutils ];
}

package musl {
	description = "an implementation of the C standard library";
	website = "https://musl.libc.org";
	anitya = 11688;

	source = musl-source;

	libc = false;
	env = [
		"LDFLAGS=" + earlyLDFLAGS,
	];
	early = `
[ -e '`+prefix+`/`+arch+`' ] && \
	ln -s ../../../../`+arch+prefix+`/lib/`+triple+` `+prefix+`/lib/clang/*/lib || true
`;

	exec = make {
		defaults = false;
		configure = {
			"AR": "ar";
			"RANLIB": "ranlib";
			"CC": "'clang --target="+triple+" -rtlib=compiler-rt'";
		};
		check = nil;
		postInstall = `
mkdir -p /work`+prefix+`/bin
COMPAT_LINKER_NAME="ld-musl-`+llvmArch+`.so.1"
ln -vs ../lib/libc.so /work`+prefix+`/bin/linker
ln -vs ../lib/libc.so /work`+prefix+`/bin/ldd
ln -vs libc.so "/work`+prefix+`/lib/${COMPAT_LINKER_NAME}"
rm -v "/work/lib/${COMPAT_LINKER_NAME}"
rmdir -v /work/lib
`;
	};

	cross = [ early-compiler-rt ];
	tools = [ coreutils ];
}