From 3913845ca986b1c3350754452e85429479fe132c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Sat, 29 Sep 2018 19:54:27 +0200 Subject: [PATCH] Added dependencies to guix.scm --- Makefile.example-os | 8 +++++-- guix.scm | 56 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/Makefile.example-os b/Makefile.example-os index 1e41376..348a37c 100644 --- a/Makefile.example-os +++ b/Makefile.example-os @@ -90,10 +90,14 @@ ${bld}/os.32k: example-os/os.asm ${bld}/check_makefile nasm -w+macro-params -w+macro-selfref -w+orphan-labels -w+gnu-elf-extensions -o $@ $< # Circumvent the fact that faketime does not work on system binaries in macos -./utils/mkisofs ./utils/mformat ./utils/mcopy: ${bld}/check_makefile # TODO: depend on the mkisofs binary +./utils/mformat ./utils/mcopy: ${bld}/check_makefile # TODO: depend on the relevant binary cp $$(which $$(basename $@)) $@ chmod u+x $@ +./utils/mkisofs: ${bld}/check_makefile # TODO: depend on the mkisofs binary + cp $$(which $$(basename $@) || which xorriso) $@ + chmod u+x $@ + cp_T_option = $$(if test "$$(uname -s)" = Darwin; then echo ''; else echo '-T'; fi) ${bld}/os.iso: ${bld}/iso_files/os.zip ${bld}/iso_files/boot/iso_boot.sys ./utils/mkisofs ${bld}/check_makefile ! test -d ${bld}/iso_files.tmp @@ -216,7 +220,7 @@ ${bld}/os.zip.adjusted: ${bld}/os.zip ${dep_bytes_zip_start} ${bld}/check_makefi gdisk_pipe_commands_slowly=while read str; do echo "$$str"; printf "\033[1;33m%s\033[m\n" "$$str" >&2; sleep 0.01; done -commit_hash_as_guid=$$(git log -1 --pretty=format:%H | sed -e 's/^\(.\{8\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.\{12\}\).*$$/\1-\2-\3-\4-\5/' | tr '[:lower:]' '[:upper:]') +commit_hash_as_guid=$$((git log -1 --pretty=format:%H || echo 0000000000000000000000000000000000000000) | sed -e 's/^\(.\{8\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.\{12\}\).*$$/\1-\2-\3-\4-\5/' | tr '[:lower:]' '[:upper:]') git_dirty=test -n "$$(git diff --shortstat)" gpt_disk_guid=${commit_hash_as_guid}$$(if $$git_dirty; then printf '0'; else printf '2'; fi) gpt_partition_guid=${commit_hash_as_guid}$$(if $$git_dirty; then printf '1'; else printf '3'; fi) diff --git a/guix.scm b/guix.scm index 241c024..cc502a2 100644 --- a/guix.scm +++ b/guix.scm @@ -20,7 +20,39 @@ ;; (guix build gnu-build-system) ;; for the phases? (guix build-system gnu) (guix gexp) - (guix)) + (guix) + (gnu packages assembly) + (gnu packages base) + (gnu packages mtools) + (gnu packages cdrom) + (gnu packages compression) + (gnu packages disk) + (gnu packages linux)) + +;; For faketime +(use-modules (guix git-download)) + +(define-public faketime + (package + (name "faketime") + (version "0.9.7") + (build-system gnu-build-system) + (arguments + `(#:phases (modify-phases %standard-phases + (delete 'configure) + (delete 'check)) + #:make-flags `("CC=gcc" + ,(string-append "PREFIX=" %output)))) + (description "LD_PRELOAD hack which allows changing and freezing the system time") + (home-page "https://github.com/wolfcw/libfaketime") + (license "CC0-1.0") + (source + (origin (uri (git-reference + (url "https://github.com/wolfcw/libfaketime.git") + (commit "5c6518c597160109fbe599fb4db9ca91e4a6769c"))) + (method git-fetch) + (sha256 (base32 "1cisgkw0c7c9psi1g4ji9y2gqans0mm223rs1xhj1bjah95kgkp9")))) + (synopsis ""))) (define-public os-test-framework (package @@ -36,11 +68,29 @@ (lambda* (#:key inputs #:allow-other-keys) (invoke "make" "clean" "COMMIT_TIMESTAMP_ISO_8601=1970-01-01T00:00:00+00:00"))) (delete 'configure) + (add-before 'build 'make-.gitignore-writable + (lambda* (#:key inputs #:allow-other-keys) + (invoke "chmod" "+w" ".gitignore"))) ;; build ;; this phase is enabled (delete 'check) ;; disabled for now, will enable it later. - (delete 'install) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (lambda (f) (string-append (assoc-ref outputs "out") f)))) ;; TODO: use path-append or something similar + (invoke "mkdir" "-p" (out "/bin")) + (invoke "cp" "os.bat" (out "/bin/os.bat"))))) (delete 'patch-shebangs) - (delete 'strip)))) + (delete 'strip)) + #:parallel-build? #t + #:make-flags '("COMMIT_TIMESTAMP_ISO_8601=1970-01-01T00:00:00+00:00"))) + (native-inputs + `(("nasm" ,nasm) + ("which" ,which) + ("mtools" ,mtools) + ("mkisofs" ,xorriso) + ("zip" ,zip) + ("faketime" ,faketime) + ("gdisk" ,gptfdisk) + ("column" ,util-linux))) (description "Test framework to run an OS in multiple emulators, as a guest graphical / text shell on linux, and so on.") (home-page "https://github.com/jsmaniac/os-test-framework") (license "CC0-1.0")