tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
hare: enable cross-compilation
Coutinho de Souza
2 years ago
8100cc1f
f8b46d2b
+61
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
ha
hare
002-dont-build-haredoc.patch
package.nix
+43
pkgs/by-name/ha/hare/002-dont-build-haredoc.patch
···
1
1
+
diff --git a/Makefile b/Makefile
2
2
+
index 2482be1f..9d58bc81 100644
3
3
+
--- a/Makefile
4
4
+
+++ b/Makefile
5
5
+
@@ -5,7 +5,7 @@ all:
6
6
+
include config.mk
7
7
+
include makefiles/$(PLATFORM).$(ARCH).mk
8
8
+
9
9
+
-all: $(BINOUT)/hare $(BINOUT)/haredoc docs
10
10
+
+all: $(BINOUT)/hare docs
11
11
+
12
12
+
HARE_DEFINES = \
13
13
+
-D PLATFORM:str='"$(PLATFORM)"' \
14
14
+
@@ -79,11 +79,10 @@ docs: \
15
15
+
docs/haredoc.1 \
16
16
+
docs/hare-run.1 \
17
17
+
docs/hare-test.1 \
18
18
+
- docs/haredoc.5 \
19
19
+
docs/hare-module.5
20
20
+
21
21
+
-MAN1 = hare hare-build hare-cache hare-deps haredoc hare-run hare-test
22
22
+
-MAN5 = haredoc hare-module
23
23
+
+MAN1 = hare hare-build hare-cache hare-deps hare-run hare-test
24
24
+
+MAN5 = hare-module
25
25
+
26
26
+
bootstrap:
27
27
+
@BINOUT=$(BINOUT) ./scripts/genbootstrap
28
28
+
@@ -104,7 +103,6 @@ install-cmd:
29
29
+
'$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' \
30
30
+
'$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man5'
31
31
+
install -m755 '$(BINOUT)/hare' '$(DESTDIR)$(BINDIR)/hare'
32
32
+
- install -m755 '$(BINOUT)/haredoc' '$(DESTDIR)$(BINDIR)/haredoc'
33
33
+
for i in $(MAN1); do install -m644 docs/$$i.1 '$(DESTDIR)$(MANDIR)'/man1/$$i.1; done
34
34
+
for i in $(MAN5); do install -m644 docs/$$i.5 '$(DESTDIR)$(MANDIR)'/man5/$$i.5; done
35
35
+
36
36
+
@@ -115,7 +113,6 @@ install-mods:
37
37
+
38
38
+
uninstall:
39
39
+
rm -- '$(DESTDIR)$(BINDIR)/hare'
40
40
+
- rm -- '$(DESTDIR)$(BINDIR)/haredoc'
41
41
+
for i in $(MAN1); do rm -- '$(DESTDIR)$(MANDIR)'/man1/$$i.1; done
42
42
+
for i in $(MAN5); do rm -- '$(DESTDIR)$(MANDIR)'/man5/$$i.5; done
43
43
+
rm -r -- '$(DESTDIR)$(STDLIB)'
+18
pkgs/by-name/ha/hare/package.nix
···
9
9
, scdoc
10
10
, tzdata
11
11
, substituteAll
12
12
+
, fetchpatch
12
13
, callPackage
13
14
, enableCrossCompilation ? (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.is64bit)
14
15
, pkgsCross
···
32
33
33
34
let
34
35
arch = stdenv.hostPlatform.uname.processor;
36
36
+
qbePlatform = {
37
37
+
x86_64 = "amd64_sysv";
38
38
+
aarch64 = "arm64";
39
39
+
riscv64 = "rv64";
40
40
+
}.${arch};
35
41
platform = lib.toLower stdenv.hostPlatform.uname.system;
36
42
embeddedOnBinaryTools =
37
43
let
···
74
80
src = ./001-tzdata.patch;
75
81
inherit tzdata;
76
82
})
83
83
+
# Use correct comment syntax for debug+riscv64.
84
84
+
(fetchpatch {
85
85
+
url = "https://git.sr.ht/~sircmpwn/hare/commit/80e45e4d931a6e90d999846b86471cac00d2a6d5.patch";
86
86
+
hash = "sha256-S7nXpiO0tYnKpmpj+fLkolGeHb1TrmgKlMF0+j0qLPQ=";
87
87
+
})
88
88
+
# Don't build haredoc since it uses the build `hare` bin, which breaks
89
89
+
# cross-compilation.
90
90
+
./002-dont-build-haredoc.patch
77
91
];
78
92
79
93
nativeBuildInputs = [
···
95
109
"PREFIX=${builtins.placeholder "out"}"
96
110
"ARCH=${arch}"
97
111
"VERSION=${finalAttrs.version}-nixpkgs"
112
112
+
"QBEFLAGS=-t${qbePlatform}"
113
113
+
"CC=${stdenv.cc.targetPrefix}cc"
114
114
+
"AS=${stdenv.cc.targetPrefix}as"
115
115
+
"LD=${stdenv.cc.targetPrefix}ld"
98
116
# Strip the variable of an empty $(SRCDIR)/hare/third-party, since nix does
99
117
# not follow the FHS.
100
118
"HAREPATH=$(SRCDIR)/hare/stdlib"