hare: enable cross-compilation
This commit is contained in:
parent
f8b46d2bbd
commit
8100cc1f54
2 changed files with 61 additions and 0 deletions
43
pkgs/by-name/ha/hare/002-dont-build-haredoc.patch
Normal file
43
pkgs/by-name/ha/hare/002-dont-build-haredoc.patch
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 2482be1f..9d58bc81 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -5,7 +5,7 @@ all:
|
||||||
|
include config.mk
|
||||||
|
include makefiles/$(PLATFORM).$(ARCH).mk
|
||||||
|
|
||||||
|
-all: $(BINOUT)/hare $(BINOUT)/haredoc docs
|
||||||
|
+all: $(BINOUT)/hare docs
|
||||||
|
|
||||||
|
HARE_DEFINES = \
|
||||||
|
-D PLATFORM:str='"$(PLATFORM)"' \
|
||||||
|
@@ -79,11 +79,10 @@ docs: \
|
||||||
|
docs/haredoc.1 \
|
||||||
|
docs/hare-run.1 \
|
||||||
|
docs/hare-test.1 \
|
||||||
|
- docs/haredoc.5 \
|
||||||
|
docs/hare-module.5
|
||||||
|
|
||||||
|
-MAN1 = hare hare-build hare-cache hare-deps haredoc hare-run hare-test
|
||||||
|
-MAN5 = haredoc hare-module
|
||||||
|
+MAN1 = hare hare-build hare-cache hare-deps hare-run hare-test
|
||||||
|
+MAN5 = hare-module
|
||||||
|
|
||||||
|
bootstrap:
|
||||||
|
@BINOUT=$(BINOUT) ./scripts/genbootstrap
|
||||||
|
@@ -104,7 +103,6 @@ install-cmd:
|
||||||
|
'$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' \
|
||||||
|
'$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man5'
|
||||||
|
install -m755 '$(BINOUT)/hare' '$(DESTDIR)$(BINDIR)/hare'
|
||||||
|
- install -m755 '$(BINOUT)/haredoc' '$(DESTDIR)$(BINDIR)/haredoc'
|
||||||
|
for i in $(MAN1); do install -m644 docs/$$i.1 '$(DESTDIR)$(MANDIR)'/man1/$$i.1; done
|
||||||
|
for i in $(MAN5); do install -m644 docs/$$i.5 '$(DESTDIR)$(MANDIR)'/man5/$$i.5; done
|
||||||
|
|
||||||
|
@@ -115,7 +113,6 @@ install-mods:
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -- '$(DESTDIR)$(BINDIR)/hare'
|
||||||
|
- rm -- '$(DESTDIR)$(BINDIR)/haredoc'
|
||||||
|
for i in $(MAN1); do rm -- '$(DESTDIR)$(MANDIR)'/man1/$$i.1; done
|
||||||
|
for i in $(MAN5); do rm -- '$(DESTDIR)$(MANDIR)'/man5/$$i.5; done
|
||||||
|
rm -r -- '$(DESTDIR)$(STDLIB)'
|
|
@ -9,6 +9,7 @@
|
||||||
, scdoc
|
, scdoc
|
||||||
, tzdata
|
, tzdata
|
||||||
, substituteAll
|
, substituteAll
|
||||||
|
, fetchpatch
|
||||||
, callPackage
|
, callPackage
|
||||||
, enableCrossCompilation ? (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.is64bit)
|
, enableCrossCompilation ? (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.is64bit)
|
||||||
, pkgsCross
|
, pkgsCross
|
||||||
|
@ -32,6 +33,11 @@ in
|
||||||
|
|
||||||
let
|
let
|
||||||
arch = stdenv.hostPlatform.uname.processor;
|
arch = stdenv.hostPlatform.uname.processor;
|
||||||
|
qbePlatform = {
|
||||||
|
x86_64 = "amd64_sysv";
|
||||||
|
aarch64 = "arm64";
|
||||||
|
riscv64 = "rv64";
|
||||||
|
}.${arch};
|
||||||
platform = lib.toLower stdenv.hostPlatform.uname.system;
|
platform = lib.toLower stdenv.hostPlatform.uname.system;
|
||||||
embeddedOnBinaryTools =
|
embeddedOnBinaryTools =
|
||||||
let
|
let
|
||||||
|
@ -74,6 +80,14 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
src = ./001-tzdata.patch;
|
src = ./001-tzdata.patch;
|
||||||
inherit tzdata;
|
inherit tzdata;
|
||||||
})
|
})
|
||||||
|
# Use correct comment syntax for debug+riscv64.
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://git.sr.ht/~sircmpwn/hare/commit/80e45e4d931a6e90d999846b86471cac00d2a6d5.patch";
|
||||||
|
hash = "sha256-S7nXpiO0tYnKpmpj+fLkolGeHb1TrmgKlMF0+j0qLPQ=";
|
||||||
|
})
|
||||||
|
# Don't build haredoc since it uses the build `hare` bin, which breaks
|
||||||
|
# cross-compilation.
|
||||||
|
./002-dont-build-haredoc.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
@ -95,6 +109,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
"PREFIX=${builtins.placeholder "out"}"
|
"PREFIX=${builtins.placeholder "out"}"
|
||||||
"ARCH=${arch}"
|
"ARCH=${arch}"
|
||||||
"VERSION=${finalAttrs.version}-nixpkgs"
|
"VERSION=${finalAttrs.version}-nixpkgs"
|
||||||
|
"QBEFLAGS=-t${qbePlatform}"
|
||||||
|
"CC=${stdenv.cc.targetPrefix}cc"
|
||||||
|
"AS=${stdenv.cc.targetPrefix}as"
|
||||||
|
"LD=${stdenv.cc.targetPrefix}ld"
|
||||||
# Strip the variable of an empty $(SRCDIR)/hare/third-party, since nix does
|
# Strip the variable of an empty $(SRCDIR)/hare/third-party, since nix does
|
||||||
# not follow the FHS.
|
# not follow the FHS.
|
||||||
"HAREPATH=$(SRCDIR)/hare/stdlib"
|
"HAREPATH=$(SRCDIR)/hare/stdlib"
|
||||||
|
|
Loading…
Reference in a new issue