2023-10-02 13:06:21 +00:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
;;;
|
|
|
|
;;; Copyright © 2023 Stefan <stefan-guix@vodafonemail.de>
|
|
|
|
;;;
|
|
|
|
;;; This file is not part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix 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.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2023-08-06 20:32:31 +00:00
|
|
|
(define-module (zephyr)
|
|
|
|
#:use-module (embedded)
|
|
|
|
#:use-module (gnu packages bootloaders)
|
|
|
|
#:use-module (gnu packages python)
|
|
|
|
#:use-module (gnu packages python-xyz)
|
|
|
|
#:use-module (guix build-system copy)
|
|
|
|
#:use-module (guix build-system trivial)
|
|
|
|
#:use-module (guix gexp)
|
|
|
|
#:use-module (guix git-download)
|
2024-11-23 14:13:30 +00:00
|
|
|
#:use-module ((guix licenses)
|
|
|
|
#:prefix license:)
|
2023-08-06 20:32:31 +00:00
|
|
|
#:use-module (guix packages))
|
2023-09-03 10:53:12 +00:00
|
|
|
|
2023-08-06 20:32:31 +00:00
|
|
|
;; This is the common directory name for zephyr-modules to look for search-paths
|
2023-09-03 10:53:12 +00:00
|
|
|
;; to collect in the ZEPHYR_MODULES environment variable. The build-system of
|
|
|
|
;; Zephyr searches for a file zephyr/module.yml in all paths listed in the
|
|
|
|
;; environment variable ZEPHYR_MODULES. If that file is missing a name
|
2024-05-19 20:22:01 +00:00
|
|
|
;; property, then the parent directory name is used as the module name. Having
|
2023-09-03 10:53:12 +00:00
|
|
|
;; two modules with the same name is treated as an error. As Guix needs a
|
|
|
|
;; common directory name for search-path-specification, we need this
|
2023-10-02 13:06:21 +00:00
|
|
|
;; intermediate directory as a pattern to find unique module names.
|
|
|
|
;; Unfortunately search-path-specification is not powerful enough, so
|
2023-09-03 10:53:12 +00:00
|
|
|
;; complete-zephyr-application needs the correct-ZEPHYR_MODULES build-phase.
|
2023-08-06 20:32:31 +00:00
|
|
|
(define-public %zephyr-module "zephyr-module")
|
|
|
|
|
|
|
|
(define-public zephyr
|
2024-05-19 20:22:01 +00:00
|
|
|
(let ((version "3.5.0"))
|
2023-08-06 20:32:31 +00:00
|
|
|
(package
|
|
|
|
(name "zephyr")
|
|
|
|
(version version)
|
|
|
|
(source
|
2024-11-23 14:13:30 +00:00
|
|
|
(origin
|
|
|
|
(method git-fetch)
|
|
|
|
(uri (git-reference
|
|
|
|
(url "https://github.com/zephyrproject-rtos/zephyr")
|
|
|
|
(commit (string-append "zephyr-v" version))))
|
|
|
|
(file-name (git-file-name name version))
|
|
|
|
(sha256
|
|
|
|
(base32 "0mca9ca8b2xjwjg0vl5858fd9l6h0m1jqbd3zr651zryf2897a80"))))
|
2023-08-06 20:32:31 +00:00
|
|
|
(build-system copy-build-system)
|
|
|
|
(arguments
|
2024-11-23 14:13:30 +00:00
|
|
|
(list
|
|
|
|
#:install-plan
|
|
|
|
#~(list (list "." "zephyr-base"))
|
|
|
|
#:phases
|
|
|
|
#~(modify-phases %standard-phases
|
|
|
|
(add-after 'unpack 'set-USER_CACHE_DIR-and-BUILD_VERSION
|
|
|
|
(lambda _
|
|
|
|
;; Avoid fetching the BUILD_VERSION from the git repository.
|
|
|
|
(substitute* "CMakeLists.txt"
|
|
|
|
(("if *\\(DEFINED BUILD_VERSION\\)")
|
|
|
|
(string-append
|
|
|
|
"if (NOT DEFINED BUILD_VERSION)\n"
|
|
|
|
" set(BUILD_VERSION " #$version ")\n"
|
|
|
|
"elseif (DEFINED BUILD_VERSION)")))
|
|
|
|
;; Avoid USER_CACHE_DIR to point to XDG_CACHE_HOME, HOME or to
|
|
|
|
;; ZEPHYR_BASE inside the store. Instead use the build dir.
|
|
|
|
(with-output-to-file
|
|
|
|
"cmake/modules/user_cache.cmake"
|
|
|
|
(lambda ()
|
|
|
|
(display
|
|
|
|
"set(USER_CACHE_DIR ${CMAKE_BINARY_DIR}/cache)\n"))))))))
|
2023-08-06 20:32:31 +00:00
|
|
|
(native-search-paths
|
|
|
|
(list (search-path-specification
|
|
|
|
(variable "ZEPHYR_BASE")
|
|
|
|
(files '("zephyr-base"))
|
|
|
|
(separator #f))
|
|
|
|
(search-path-specification
|
|
|
|
(variable "ZEPHYR_MODULES")
|
2023-09-03 10:53:12 +00:00
|
|
|
(files (list %zephyr-module)))))
|
2023-08-06 20:32:31 +00:00
|
|
|
(home-page "https://zephyrproject.org")
|
|
|
|
(synopsis "Zephyr Project RTOS")
|
2024-11-23 14:13:30 +00:00
|
|
|
(description
|
|
|
|
"The Zephyr Project is a scalable real-time operating system (RTOS)
|
|
|
|
supporting multiple hardware architectures, optimized for resource constrained
|
|
|
|
devices, and built with security in mind.")
|
2023-08-06 20:32:31 +00:00
|
|
|
(license license:apsl2))))
|
|
|
|
|
2024-05-19 20:22:01 +00:00
|
|
|
(define-public zephyr-3.5+zmk-fixes
|
2023-08-06 20:32:31 +00:00
|
|
|
(let ((revision "1")
|
2024-05-19 20:22:01 +00:00
|
|
|
(commit "8f87b3be1e7631332cd8b245fb94d24d0354d0cb"))
|
2023-08-06 20:32:31 +00:00
|
|
|
(package/inherit zephyr
|
|
|
|
(name "zephyr+zmk-fixes")
|
2024-05-19 20:22:01 +00:00
|
|
|
(version (git-version "3.5.0" revision commit))
|
2023-08-06 20:32:31 +00:00
|
|
|
(source
|
2024-11-23 14:13:30 +00:00
|
|
|
(origin
|
|
|
|
(method git-fetch)
|
|
|
|
(uri (git-reference
|
|
|
|
(url "https://github.com/zmkfirmware/zephyr")
|
|
|
|
(commit commit)))
|
|
|
|
(file-name (git-file-name name version))
|
|
|
|
(sha256
|
|
|
|
(base32 "0bgy6psg2wb4fflkz1ww5dkh5qq2yrfr3cqpi2qkwgj250m8cdfb"))))
|
2023-08-06 20:32:31 +00:00
|
|
|
(home-page "https://github.com/zmkfirmware/zephyr"))))
|
|
|
|
|
|
|
|
(define-public zephyr-build-tools
|
|
|
|
(package
|
|
|
|
(name "zephyr-build-tools")
|
|
|
|
(version "1.0.0")
|
|
|
|
(source #f)
|
|
|
|
(build-system trivial-build-system)
|
|
|
|
(arguments (list #:builder #~(mkdir #$output)))
|
|
|
|
(propagated-inputs (list dtc
|
|
|
|
python
|
|
|
|
python-pyelftools
|
|
|
|
python-pykwalify
|
|
|
|
python-pyyaml
|
|
|
|
python-packaging))
|
|
|
|
(home-page "https://zephyrproject.org")
|
|
|
|
(synopsis "Zephyr build tools")
|
|
|
|
(description "Required build tools to build the Zephyr RTOS.")
|
|
|
|
(license license:apsl2)))
|
|
|
|
|