1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-14 11:00:36 +02:00

gnu: micro: Fix version flag variables and syntax highlighting.

* gnu/packages/text-editors.scm (micro)[arguments]: Fix import
and unpack path.  Add build flags to set version, hash and build
date variables through ldflags.  Add a go-generate phase before
the build phase to generate syntax files for highlighting.

Change-Id: Ifa56e8760a702f4954343ceaf6b77d97bc5c69fd
This commit is contained in:
Ashvith Shetty 2025-04-19 19:20:59 +05:30 committed by Ludovic Courtès
parent 4567f589d8
commit 960efc55b0
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -162,6 +162,8 @@ extensions over the standard utility.")
(license license:gpl3+))) (license license:gpl3+)))
(define-public micro (define-public micro
(let ((commit "04c577049ca898f097cd6a2dae69af0b4d4493e1")
(date "April 16, 2025"))
(package (package
(name "micro") (name "micro")
(version "2.0.14") (version "2.0.14")
@ -178,12 +180,31 @@ extensions over the standard utility.")
(arguments (arguments
(list (list
#:install-source? #f #:install-source? #f
#:import-path "github.com/zyedidia/micro/cmd/micro" #:import-path "github.com/zyedidia/micro/v2/cmd/micro"
#:unpack-path "github.com/zyedidia/micro" #:unpack-path "github.com/zyedidia/micro/v2"
#:build-flags
;; Set value for variables in the `--version` flag
#~(list (format #f "-ldflags=~a ~a ~a"
(string-append
"-X github.com/zyedidia/micro/v2/internal/util.Version="
#$version)
(string-append
"-X github.com/zyedidia/micro/v2/internal/util.CommitHash="
(string-take #$commit 7))
(format #f
"-X 'github.com/zyedidia/micro/v2/internal/util.CompileDate=~a'"
#$date)))
;; Step away from cmd/micro to test the whole project. ;; Step away from cmd/micro to test the whole project.
#:test-subdirs #~(list "../../..."))) #:test-subdirs
(inputs #~(list "../../...")
(list go-github-com-blang-semver #:phases
#~(modify-phases %standard-phases
;; Generate syntax files.
(add-before 'build 'go-generate
(lambda _
(invoke "go" "generate" "-v" "-x"
"github.com/zyedidia/micro/v2/runtime"))))))
(inputs (list go-github-com-blang-semver
go-github-com-dustin-go-humanize go-github-com-dustin-go-humanize
go-github-com-go-errors-errors go-github-com-go-errors-errors
go-github-com-layeh-gopher-luar go-github-com-layeh-gopher-luar
@ -208,7 +229,7 @@ extensions over the standard utility.")
intuitive, while also taking advantage of the capabilities of modern terminals.") intuitive, while also taking advantage of the capabilities of modern terminals.")
;; The project lists licenses of all used sources in LICENSE-THIRD-PARTY ;; The project lists licenses of all used sources in LICENSE-THIRD-PARTY
;; file which are already included in Guix's package definition. ;; file which are already included in Guix's package definition.
(license license:expat))) (license license:expat))))
(define-public lem (define-public lem
(let ((commit "5fd512c8bab9de9a62709ac858fbb56337260cd5") (let ((commit "5fd512c8bab9de9a62709ac858fbb56337260cd5")