From 700fc1d3f7ab451f1aca84cd06b02e3cca39eea8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 19 Nov 2017 11:35:59 +0100 Subject: [PATCH 2/3] gnu: Add mescc-tools-boot. * gnu/packages/mes.scm (mescc-tools-boot): New variable. --- gnu/packages/mes.scm | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm index 1e3631a1e..ef4d4a486 100644 --- a/gnu/packages/mes.scm +++ b/gnu/packages/mes.scm @@ -106,6 +106,102 @@ with a Knight VM that runs Forth and Lisp.") (home-page "https://savannah.nongnu.org/projects/stage0/") (license gpl3+)))) +(define-public mescc-tools-boot + (let ((version "0.2") + (revision "0") + (commit "fbb9004499c533fd1df7270480a4ff9375ca1f55")) + (package + (name "mescc-tools-boot") + (version (string-append version "-" revision "." (string-take commit 7))) + (synopsis "Tools for the full source bootstrapping process") + (source (origin + (method url-fetch) + (uri (string-append "https://gitlab.com/janneke/mescc-tools" + "/repository/archive.tar.gz?ref=" + commit)) + (file-name (string-append name "-" version ".tar.xz")) + (sha256 + (base32 + "1m0syjc2f3pk5fl7msf0v8n7j29wh1bsma269sminp9wh7905m09")))) + (native-inputs + `(("static-bash" ,@(assoc-ref %bootstrap-inputs "bash")) + ("bash" ,(search-bootstrap-binary "bash" (%current-system))) + ("tar" ,(search-bootstrap-binary "tar" (%current-system))) + ("xz" ,(search-bootstrap-binary "xz" (%current-system))) + ("stage0" ,stage0-boot) + ("mescc-tools-seed" + ,(origin + (method url-fetch) + (uri (string-append "https://gitlab.com/janneke/mescc-tools-seed" + "/repository/archive.tar.gz?ref=" + "9ec08e82fe2cac94e776470afe1e6a6a59c79159")) + (file-name (string-append name "-seed" "-" version ".tar.xz")) + (sha256 + (base32 + "0liysc4gzsrmankfksd44wbr451sy3pf5c79y2bw74dcnjpx1df2")))) + ("mes-source" ,(package-source mes-boot)) + ("mes-seed" + ,(origin + (method url-fetch) + (uri (string-append "https://gitlab.com/janneke/mes-seed" + "/repository/archive.tar.gz?ref=" + "d53d5998666873a79fbd9b4f6742d11affa34b44")) + (file-name (string-append "mes-seed-0.11" ".tar.xz")) + (sha256 + (base32 + "00zk4vfxqjyy3x4s5bdx59zicfqvxyvsbb9mfs4zkwyka64flk34")))))) + (supported-systems '("i686-linux" "x86_64-linux")) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let* ((bash (assoc-ref %build-inputs "static-bash")) + (tar (assoc-ref %build-inputs "tar")) + (xz (assoc-ref %build-inputs "xz")) + (source (assoc-ref %build-inputs "source")) + (mescc-tools-seed (assoc-ref %build-inputs "mescc-tools-seed")) + (mes-seed (assoc-ref %build-inputs "mes-seed")) + (mes-source (assoc-ref %build-inputs "mes-source")) + (out (assoc-ref %outputs "out")) + (out/bin (string-append out "/bin"))) + (setenv "PATH" (string-append bash "/bin:" + "../mescc-tools-seed:" + tar "/bin:" + xz "/bin")) + (format (current-error-port) "PATH=~s\n" (getenv "PATH")) + (mkdir-p "source") + (system* "tar" "--strip=1" "-C" "source" "-xvf" source) + (mkdir-p "mescc-tools-seed") + (system* "tar" "--strip=1" "-C" "mescc-tools-seed" "-xvf" mescc-tools-seed) + (mkdir-p "mes-source") + (system* "tar" "--strip=1" "-C" "mes-source" "-xvf" mes-source) + (mkdir-p "mes-seed") + (system* "tar" "--strip=1" "-C" "mes-seed" "-xvf" mes-seed) + (chdir "source") + (zero? (system (string-append +"set -ex;" +"mkdir -p " out/bin ";" +"M1 --LittleEndian --Architecture=1 -f ../mes-source/stage0/x86.M1 -f ../mescc-tools-seed/hex2.M1 > hex2.hex2;" +"M1 --LittleEndian --Architecture=1 -f ../mes-source/stage0/x86.M1 -f ../mes-seed/crt1.M1 > crt1.hex2;" +"M1 --LittleEndian --Architecture=1 -f ../mes-source/stage0/x86.M1 -f ../mes-seed/libc-mes+tcc.M1 > libc-mes+tcc.hex2;" + +"hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f ../mes-source/stage0/elf32-header.hex2 -f crt1.hex2 -f libc-mes+tcc.hex2 -f hex2.hex2 -f ../mes-source/stage0/elf32-footer-single-main.hex2 > " out/bin "/hex2;" +"chmod +x " out/bin "/hex2;" + +;; FIXME: MORTAL SIN HERE +;; M1 cannot be bootstrapped yet +"cp ../mescc-tools-seed/M1 " out/bin "/M1"))))))) + + (description + "Mescc-tools is a collection of tools for use in a full source +bootstrapping process. Currently consists of the M1 macro assembler and the +hex2 linker.") + (home-page "https://github.com/oriansj/mescc-tools") + (license gpl3+)))) + + (define-public nyacc (package (name "nyacc") -- Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com