alpha
Login
or
Join now
tombl.dev
/
distro
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
all: add debug config (#18)
author
Thomas Stokes
committer
GitHub
date
1 year ago
(Jan 21, 2025, 9:34 PM +0800)
commit
df7def12
df7def1296c4fe955f6af0798c5c3b6399807854
parent
a9b07e95
a9b07e9501fa43e265d22025d3c9cf0e605ed25c
+18
-7
6 changed files
Expand all
Collapse all
Unified
Split
all-packages.nix
packages
basic-init
package.nix
busybox
package.nix
compiler-rt
package.nix
linux
package.nix
musl
package.nix
+3
all-packages.nix
Reviewed
···
8
8
pkgs =
9
9
{
10
10
inherit lib currentSystem;
11
11
+
config = {
12
12
+
debug = false;
13
13
+
};
11
14
}
12
15
// lib.packagesFromDirectoryRecursive {
13
16
callPackage = lib.callPackageWith (pkgs // hostpkgs);
+3
-1
packages/basic-init/package.nix
Reviewed
···
1
1
{
2
2
run,
3
3
+
config,
4
4
+
lib,
3
5
4
6
clang,
5
7
lld,
···
17
19
];
18
20
}
19
21
''
20
20
-
clang -c -o init.o init.c --target=wasm32 -nostdinc -isystem ${musl}/include
22
22
+
clang -c -o init.o init.c --target=wasm32 -nostdinc -isystem ${musl}/include ${lib.optionalString config.debug "-g"}
21
23
wasm-ld -o init init.o ${compiler-rt}/libclang_rt.builtins-wasm32.a ${musl}/lib/crt1.o -L${musl}/lib -lc --fatal-warnings --initial-memory=655360
22
24
23
25
mkdir -p $out/bin
+4
-2
packages/busybox/package.nix
Reviewed
···
1
1
{
2
2
fetch,
3
3
run,
4
4
+
lib,
5
5
+
config,
4
6
5
7
clang-host ? clang,
6
8
clang,
···
34
36
ARCH=wasm32 \
35
37
HOSTCC=${clang-host}/bin/clang \
36
38
CC=${clang}/bin/clang \
37
37
-
CFLAGS_busybox="${musl}/lib/crt1.o -g -Wl,--import-memory" "$@"
39
39
+
CFLAGS_busybox="${musl}/lib/crt1.o -Wl,--import-memory" "$@"
38
40
}
39
41
40
42
config() {
···
52
54
config STATIC_LIBGCC n
53
55
config CROSS_COMPILER_PREFIX llvm-
54
56
config SYSROOT ${musl}
55
55
-
config EXTRA_CFLAGS '-nostdlib -isystem ${musl}/include -I${linux.headers}/include'
57
57
+
config EXTRA_CFLAGS '-nostdlib -isystem ${musl}/include -I${linux.headers}/include ${lib.optionalString config.debug "-g"}'
56
58
config EXTRA_LDFLAGS ${compiler-rt}/libclang_rt.builtins-wasm32.a
57
59
config EXTRA_LDLIBS c
58
60
+2
-1
packages/compiler-rt/package.nix
Reviewed
···
1
1
{
2
2
fetch,
3
3
run,
4
4
+
config,
4
5
5
6
clang,
6
7
cmake,
···
31
32
}
32
33
''
33
34
cmake -S compiler-rt -B build -G Ninja \
34
34
-
-DCMAKE_BUILD_TYPE=Release \
35
35
+
-DCMAKE_BUILD_TYPE=${if config.debug then "Debug" else "Release"} \
35
36
-DCMAKE_CXX_COMPILER_TARGET=wasm32-unknown \
36
37
-DCMAKE_CXX_COMPILER_WORKS=ON \
37
38
-DCMAKE_CXX_FLAGS="-I${musl}/include" \
+3
-3
packages/linux/package.nix
Reviewed
···
1
1
{
2
2
fetch,
3
3
run,
4
4
+
config,
5
5
+
lib,
4
6
5
7
bc,
6
8
bison,
···
15
17
perl,
16
18
rsync,
17
19
wabt,
18
18
-
19
19
-
enableDebug ? false,
20
20
}:
21
21
22
22
run
···
52
52
command make -j$NIX_BUILD_CORES HOSTCC=${clang-host}/bin/clang TSC=true "$@"
53
53
}
54
54
55
55
-
make defconfig ${if enableDebug then "debug.config" else ""}
55
55
+
make defconfig ${lib.optionalString config.debug "debug.config"}
56
56
57
57
# this is a horrible dirty hack but there's some non-deterministic build failure
58
58
for i in $(seq 1 3); do
+3
packages/musl/package.nix
Reviewed
···
1
1
{
2
2
fetch,
3
3
run,
4
4
+
lib,
5
5
+
config,
4
6
5
7
clang,
6
8
gnumake,
···
31
33
ARCH=wasm32
32
34
prefix=$out
33
35
syslibdir=$out
36
36
+
CFLAGS=--target=wasm32 ${lib.optionalString config.debug "-g"}
34
37
EOF
35
38
36
39
mkdir $out