gnu: qtpass: Switch to qt-build-system and new package style.

* gnu/packages/password-utils.scm (qtpass): Use qt-build-system.
[arguments]: Drop 'wrap-qt and 'check-setup phases. Drop the unnecessary
'reset-resource-timestamps phase. Use new package style for remaining phases.
[inputs]: Drop qtbase-5.

Change-Id: I23a0b8dfd1fdfeca343704d3df084c522b319d30
Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
Timotej Lazar 2024-02-07 22:23:34 +01:00 committed by Christopher Baines
parent 4f9ea64b5f
commit 608b9a1c86
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -862,63 +862,36 @@ (define-public qtpass
(file-name (git-file-name name version))
(sha256
(base32 "10ixahm4ap0l1rrz4cyswblm22ns9z1baf5lv3dn23wprfdcp8m0"))))
(build-system gnu-build-system)
(build-system qt-build-system)
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build qt-utils)
(guix build utils))
#:imported-modules (,@%gnu-build-system-modules
(guix build qt-utils))
#:phases
(modify-phases %standard-phases
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
;; lupdate/lrelease need to find qmake.
(setenv "QMAKE" "qmake")
;; qmake needs to find lrelease/lupdate.
(invoke "qmake"
"QMAKE_LRELEASE=lrelease"
"QMAKE_LUPDATE=lupdate"
(string-append "PREFIX=" out)))))
(add-after 'configure 'reset-resource-timestamps
;; Reset timestamps on localization files for a reproducible build.
(lambda _
(with-directory-excursion "localization"
(for-each (lambda (file)
(let* ((base (basename file ".qm"))
(src (string-append base ".ts"))
(st (stat src)))
(set-file-time file st)))
(find-files "." ".*\\.qm")))
#t))
(add-after 'install 'install-auxilliary
;; Install man-page, icon and .desktop file.
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(applications (string-append out "/share/applications"))
(icons (string-append out "/share/icons/hicolor/scalable/apps"))
(man (string-append out "/share/man/man1")))
(install-file "qtpass.desktop" applications)
(install-file "artwork/icon.svg" icons)
(rename-file (string-append icons "/icon.svg")
(string-append icons "/qtpass-icon.svg"))
(install-file "qtpass.1" man)
#t)))
(add-after 'install 'wrap-qt
(lambda* (#:key outputs inputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(wrap-qt-program "qtpass" #:output out #:inputs inputs))
#t))
(add-before 'check 'check-setup
;; Make Qt render "offscreen", required for tests.
(lambda _
(setenv "QT_QPA_PLATFORM" "offscreen")
#t)))))
(list
#:test-target "check"
#:phases
#~(modify-phases %standard-phases
(replace 'configure
(lambda _
(invoke "qmake"
"QMAKE_LRELEASE=lrelease"
"QMAKE_LUPDATE=lupdate"
(string-append "PREFIX=" #$output))))
(add-before 'check 'pre-check
;; Fontconfig needs a writable cache.
(lambda _ (setenv "HOME" "/tmp")))
(add-after 'install 'install-auxilliary
;; Install man-page, icon and .desktop file.
(lambda _
(let ((applications (string-append #$output "/share/applications"))
(icons (string-append #$output "/share/icons/hicolor/scalable/apps"))
(man (string-append #$output "/share/man/man1")))
(install-file "qtpass.desktop" applications)
(install-file "artwork/icon.svg" icons)
(rename-file (string-append icons "/icon.svg")
(string-append icons "/qtpass-icon.svg"))
(install-file "qtpass.1" man)))))))
(native-inputs
(list qttools-5))
(inputs
(list qtbase-5 qtsvg-5))
(list qtsvg-5))
(home-page "https://qtpass.org")
(synopsis "GUI for password manager password-store")
(description