;;; Copyright © 2023 Denis 'GNUtoo' Carikli ;;; ;;; This file is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; This file is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this file. If not, see . (use-modules (gnu packages compression) (gnu packages pascal) (gnu packages python) (guix build-system gnu) (guix build-system trivial) (guix download) (guix gexp) (guix packages) ((guix licenses) #:prefix license:)) ;; Serious issues to address: ;; (1) Is the Data GPLv2 ? Is it redistributable? What the dh-en-2012.zip ;; binaries? ;; (2) compiling-the-game.txt[1] has a section "4. Play the recompiled ;; game" that explains that the game built is incompatible with ;; ScummVM unless scummVM is patched with the md5 of the game binary. ;; [1]https://www.ucw.cz/draci-historie/src/doc/compiling-the-game.txt ;; (3) Actually make it work ;; (4) Patch scummVM and test the game ;; TODO: ;; - Also pakcage licenses and license declarations too ;; - identify and remove the binaries that are not used by the build ;; system. ;; - Make sure only data that can be edited with free software ;; tools remains. ;; - Make a cleaned-up tarball and get that mirrored instead of the ;; binaries we don't use. ;; - Convert that into a function that makes a package for a given ;; language. (define-public draci-historie-dubbing-en (package (name "draci-historie-dubbing-en") ;; There are no versions in the release. (version "1+1") (source (origin (method url-fetch) (uri (string-append "https://www.ucw.cz/draci-historie/binary/dh-en-2012.zip")) (sha256 (base32 "08xffj4648nxp3mjxwf54z1y4nk1718jrnkib2ikj5h509cn4z40")))) (build-system trivial-build-system) (arguments (list #:modules '((guix build utils)) #:builder #~(begin (use-modules (guix build utils)) (let* ((destination (string-append (assoc-ref %outputs "out") "/share/draci-historie-dubbing-en/")) (source (assoc-ref %build-inputs "source")) (unzip (search-input-file %build-inputs "/bin/unzip"))) (invoke unzip source "-d" "source") (copy-recursively "source" destination))))) (native-inputs (list unzip)) (home-page "https://www.ucw.cz/draci-historie/index-en.html") (synopsis "TODO") (description "TODO") (license license:gpl2))) ;; Is the Data really GPLv2(+?) ??? ;; TODO: also pakcage licenses and license declarations too (define-public draci-historie-data (package (name "draci-historie-data") ;; There are no versions in the release. (version "1+1") (source (origin (method url-fetch) (uri "https://www.ucw.cz/draci-historie/source/new-gfx.zip") (sha256 (base32 "09z7kipd1vpd7si4lmpqr1xfb0vc3jfnwllv9zvxiyqrr44n56py")))) (build-system trivial-build-system) (arguments (list #:modules '((guix build utils)) #:builder #~(begin (use-modules (guix build utils)) (let* ((gfx (string-append (assoc-ref %outputs "out") "/share/gfx/")) (source (assoc-ref %build-inputs "source")) (unzip (search-input-file %build-inputs "/bin/unzip"))) (invoke unzip source) (copy-recursively "gfx" gfx))))) (native-inputs (list unzip)) (home-page "https://www.ucw.cz/draci-historie/index-en.html") (synopsis "TODO") (description "TODO") (license license:gpl2))) ;; Is the Data really GPLv2(+?) ??? ;; TODO: also pakcage some the documentation in doc/ and package ;; licenses and license declarations too (define-public draci-historie (package (name "draci-historie") ;; There are no versions in the release. (version "1+2") (source (origin (method url-fetch/zipbomb) (uri "https://www.ucw.cz/draci-historie/source/new-sources.zip") (sha256 (base32 "1a7qxigbzmh7v85r83zc9hc347qwrq4iyia044vq87cy8n1z1whb")))) (build-system gnu-build-system) (arguments (list #:tests? #f ; No target #:make-flags #~(list "-d") ;; debug #:parallel-build? #f ;; debug #:phases #~(modify-phases %standard-phases (add-after 'unpack 'fix-build (lambda _ (substitute* "Makefile" (("^DIR=/.*") (string-append "DIR=" (getcwd) "/build\n"))) ;; TODO: Add support for more LANGS an AUDIO (see doc/compiling-the-game.txt) (substitute* "Makefile" (("^LANGS=.*") "LANGS=en\n")) (substitute* "Makefile" (("^AUDIO=.*") "AUDIO=\n")) (substitute* (find-files "scripts" ".py$") (("#!/usr/bin/python") (string-append "#!" (which "python2")))))) (add-after 'fix-build 'unpack-gfx (lambda _ (let* ((gfx (string-append #$(this-package-native-input "draci-historie-data") "/share/gfx/"))) (mkdir-p "build") (copy-recursively gfx "build/orig-gfx")))) (add-after 'unpack-gfx 'unpack-english (lambda _ (let* ((dubbing-en (string-append #$(this-package-native-input "draci-historie-dubbing-en") "/share/draci-historie-dubbing-en/"))) (mkdir-p "build/orig-exe/en") (copy-recursively dubbing-en "build/orig-exe/en")))) (add-before 'build 'clean-source (lambda _ ;; Turbo Pascal configuration files (for-each delete-file (find-files "." ".*\\.tp")) (invoke "make" "clean_all"))) (add-after 'build 'build-dubbing (lambda _ (invoke "make" "dubbing_all"))) (delete 'configure)))) (native-inputs (list draci-historie-data draci-historie-dubbing-en fpc python-2.7 zip)) (home-page "https://www.ucw.cz/draci-historie/index-en.html") (synopsis "TODO") (description "TODO") (license license:gpl2))) ; I didn't fin mentions of "or later" (list draci-historie)