lol

hare: enable cross-compilation

+61
+43
pkgs/by-name/ha/hare/002-dont-build-haredoc.patch
··· 1 + diff --git a/Makefile b/Makefile 2 + index 2482be1f..9d58bc81 100644 3 + --- a/Makefile 4 + +++ b/Makefile 5 + @@ -5,7 +5,7 @@ all: 6 + include config.mk 7 + include makefiles/$(PLATFORM).$(ARCH).mk 8 + 9 + -all: $(BINOUT)/hare $(BINOUT)/haredoc docs 10 + +all: $(BINOUT)/hare docs 11 + 12 + HARE_DEFINES = \ 13 + -D PLATFORM:str='"$(PLATFORM)"' \ 14 + @@ -79,11 +79,10 @@ docs: \ 15 + docs/haredoc.1 \ 16 + docs/hare-run.1 \ 17 + docs/hare-test.1 \ 18 + - docs/haredoc.5 \ 19 + docs/hare-module.5 20 + 21 + -MAN1 = hare hare-build hare-cache hare-deps haredoc hare-run hare-test 22 + -MAN5 = haredoc hare-module 23 + +MAN1 = hare hare-build hare-cache hare-deps hare-run hare-test 24 + +MAN5 = hare-module 25 + 26 + bootstrap: 27 + @BINOUT=$(BINOUT) ./scripts/genbootstrap 28 + @@ -104,7 +103,6 @@ install-cmd: 29 + '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' \ 30 + '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man5' 31 + install -m755 '$(BINOUT)/hare' '$(DESTDIR)$(BINDIR)/hare' 32 + - install -m755 '$(BINOUT)/haredoc' '$(DESTDIR)$(BINDIR)/haredoc' 33 + for i in $(MAN1); do install -m644 docs/$$i.1 '$(DESTDIR)$(MANDIR)'/man1/$$i.1; done 34 + for i in $(MAN5); do install -m644 docs/$$i.5 '$(DESTDIR)$(MANDIR)'/man5/$$i.5; done 35 + 36 + @@ -115,7 +113,6 @@ install-mods: 37 + 38 + uninstall: 39 + rm -- '$(DESTDIR)$(BINDIR)/hare' 40 + - rm -- '$(DESTDIR)$(BINDIR)/haredoc' 41 + for i in $(MAN1); do rm -- '$(DESTDIR)$(MANDIR)'/man1/$$i.1; done 42 + for i in $(MAN5); do rm -- '$(DESTDIR)$(MANDIR)'/man5/$$i.5; done 43 + rm -r -- '$(DESTDIR)$(STDLIB)'
+18
pkgs/by-name/ha/hare/package.nix
··· 9 9 , scdoc 10 10 , tzdata 11 11 , substituteAll 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 + qbePlatform = { 37 + x86_64 = "amd64_sysv"; 38 + aarch64 = "arm64"; 39 + riscv64 = "rv64"; 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 + # Use correct comment syntax for debug+riscv64. 84 + (fetchpatch { 85 + url = "https://git.sr.ht/~sircmpwn/hare/commit/80e45e4d931a6e90d999846b86471cac00d2a6d5.patch"; 86 + hash = "sha256-S7nXpiO0tYnKpmpj+fLkolGeHb1TrmgKlMF0+j0qLPQ="; 87 + }) 88 + # Don't build haredoc since it uses the build `hare` bin, which breaks 89 + # cross-compilation. 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 + "QBEFLAGS=-t${qbePlatform}" 113 + "CC=${stdenv.cc.targetPrefix}cc" 114 + "AS=${stdenv.cc.targetPrefix}as" 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"