(define-module (gb) #:use-module (electronics) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages bison) #:use-module (gnu packages boost) #:use-module (gnu packages compression) #:use-module (gnu packages embedded) #:use-module (gnu packages flex) #:use-module (gnu packages python) #:use-module (gnu packages texinfo) #:use-module (guix git-download) #:use-module (guix svn-download) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module ((guix licenses) #:prefix license:)) (define-public sdcc-patched-for-gbdk (let ((revision 12539)) (package (name "sdcc-patched-for-gbdk") ; It's not that base version, probably 2.96, but IDK how to check that in ; subversion (version (string-append "0.0.1" "-" (number->string revision))) (source (origin (method svn-fetch) (uri (svn-reference (url "https://svn.code.sf.net/p/sdcc/code/trunk/sdcc") (revision revision))) (file-name (string-append name "-" version)) (modules '((guix build utils))) (snippet '(begin ;; Remove non-free source files (delete-file-recursively "device/non-free") ;; Remove bundled μCsim source (delete-file-recursively "sim") #t)) (patches (search-patches "sdcc-non-free.patch" "sdcc-makebin-nogogo-v2-bool.patch" "sdcc-sdas_macro_80_char_overflow.patch" "sdcc-sdcc_z80_boN_baN.patch" "sdcc-sdcc_z80_enable_incbin.patch" "sdcc-sdldz80-sms-virtual-address.patch")) (sha256 (base32 "148zpyxwac8qlbg1pakjmar8h802g6lwjp4qhw6cy77ixlhwgyrg")))) (build-system gnu-build-system) (native-inputs (list bison boost flex zlib python-2 texinfo)) (arguments `(#:configure-flags (list "--disable-nonfree" "--disable-pic14-port" "--disable-pic16-port" "--disable-ucsim") #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-makefile (lambda _ (substitute* (find-files "." "(\\.mk$|\\.in$)") (("/bin/sh") (which "sh"))) #t))))) (home-page "http://sdcc.sourceforge.net") (synopsis "Small devices C compiler") (description "Patched SDCC for GameBoy development") (license license:gpl2+)))) ;; MAYBE USE THIS INSTEAD? ;; https://github.com/flozz/gbdk-n/ ;; It needs a really old sdcc, the patched one works. ;; Maybe we can give it a revival ;; (define-public gbdk-2020 ;; This does not build, it fails to generate files... ;; Also the sdcc it uses (see above) is very old. The docs specifically ;; mention this one but it's pretty old. They might be using other one ;; instead. (package (name "gbdk-2020") (version "4.0.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/gbdk-2020/gbdk-2020") (commit version))) (sha256 (base32 "009361b9b7215s1095q58gdwqc3wwymcr6vknjq218fs0l3nlnjf")))) (native-inputs (list sdcc-patched-for-gbdk)) (arguments (list #:phases #~(modify-phases %standard-phases (delete 'configure) (add-before 'build 'setenv (lambda _ (setenv "SDCCDIR" #$sdcc-patched-for-gbdk)))))) (build-system gnu-build-system) (home-page "https://github.com/gbdk-2020/gbdk-2020") (synopsis "blahblah") (description "blablah") (license license:gpl2))) (define-public gba-tools (package (name "gba-tools") (version "1.2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/devkitPro/gba-tools") (commit (string-append "v" version)))) (sha256 (base32 "1rlhyc9dsdxcmaih3x9qjb3ihr2xxz1rw42ijbz2ylymn9p133gh")))) (build-system gnu-build-system) (inputs (list automake autoconf)) (synopsis "Collection of tools for Game Boy Advance development") (description "Collection of tools for Game Boy Advance development: - gbafix: Pads and patches GBA ROMs. - gbalzss: Compresses and uncompresses ROMs. - gbfs: Creates a GBFS archive. - insgbfs: Inserts a GBFS file (or any other file) into a GBFS_SPACE (identified by symbol name) in a ROM. - lsgbfs: Lists objects in a GBFS file. - ungbfs: Dumps the objects in a GBFS file to separate files.") (home-page "https://github.com/devkitPro/gba-tools") (license license:gpl3+))) #;(define-public gba-minrt (package (name "gba-minrt") (version "0.0.0") ; Obtain from commit-id )) (define-public libseven (package (name "libseven") (version "0.3.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/LunarLambda/libseven") (commit (string-append "v" version)))) (sha256 (base32 "1jbkghqjjyjjq4rs8ifzlq7zhrcifnis1b8fwiajv8ga2x0s9qr9")))) (arguments (list #:phases `(modify-phases %standard-phases (delete 'configure) (add-before 'build 'setenv (lambda* _ (setenv "DESTDIR" "output"))) (add-after 'install 'correct-output-dir (lambda* (#:key inputs outputs #:allow-other-keys) (copy-recursively "output/libseven" (assoc-ref outputs "out"))))) #:tests? #f)) (build-system gnu-build-system) (inputs (list (make-arm-none-eabi-nano-toolchain-7-2018-q2-update))) (synopsis "A fully from-scratch library for GBA development, meant to replace existing libraries like libgba or libtonc.") (description "Goals: - Intuitive, consistent, and well organized API - Optimized code with minimal RAM and ROM size - Correctness without compromises - High-quality, understandable documentation") (home-page "https://github.com/LunarLambda/libseven") (license license:mpl2.0))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TODO: Make the toolchain like `propeller-toolchain`! ;; Find interesting tools and add all them here. good resource: http://www.devrs.com/gba/software.php ;; - Interesting libs: ;; - https://github.com/jesusatc/libgba (don't mix with the next) ;; - https://github.com/devkitPro/libgba ;; - https://github.com/devkitPro/libtonc ;; - Difference between libgba and libtonc: https://github.com/exelotl/libtonc-template ;; These may be too complex ;; ;; ;; (define-public libtonc ;; ;https://github.com/devkitPro/pacman-packages/blob/master/libtonc/PKGBUILD ;; (package ;; (name "libtonc") ;; (version "1.4.3") ;; (source (origin ;; (method url-fetch) ;; (uri "") ;; (sha256 ;; (base32 ;; "1rlhyc9dsdxcmaih3x9qjb3ihr2xxz1rw42ijbz2ylymn9p133gh")))) ;; (build-system gnu-build-system) ;; (inputs (list gba-toolchain-mini)) ;; (synopsis "A nintendo GameBoy Advance library.") ;; (description "") ;; (home-page "http://www.coranac.com/projects/#tonc") ;; (license license:expat) ;; )) ;; ;; (define-public gba-toolchain-full ;; (package ;; (name "gba-toolchain-full") ;; (synopsys "GameBoy Advance toolchain with many intersting tools") ;; )) ;; ;; (define-package devkitpro ;; ; https://github.com/devkitPro/buildscripts ;; ) ;; ;; (define-public libgba ;; ; https://github.com/devkitPro/pacman-packages/blob/master/libgba/PKGBUILD ;; (package ;; (name "libgba") ;; (version "0.5.2") ;; )) ;; ;; (define-public crt-files ;; ; https://github.com/devkitPro/pacman-packages/blob/master/devkitarm/devkitarm-crtls/PKGBUILD ;; ; https://github.com/devkitpro/devkitarm-crtls ;; (package ;; (name "crt-files") ;; ))