Archived
1
0
Fork 0

gnu: make-mozilla-with-l10n: Use the copy-build-system.

Fixes <https://issues.guix.gnu.org/61742>.

* gnu/packages/gnuzilla.scm (make-mozilla-with-l10n): Rewrite to use the
copy-build-system.

Reported-by: Feng Shu <tumashu@163.com>
This commit is contained in:
Maxim Cournoyer 2023-03-02 15:39:55 -05:00
parent b2200e3488
commit 89e5f3f384
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -50,8 +50,9 @@
#:use-module (guix modules) #:use-module (guix modules)
#:use-module (guix monads) #:use-module (guix monads)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cargo) #:use-module (guix build-system cargo)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (gnu packages admin) #:use-module (gnu packages admin)
#:use-module (gnu packages audio) #:use-module (gnu packages audio)
@ -1681,51 +1682,55 @@ associated with their name."))
(package (package
(inherit base) (inherit base)
(name (symbol->string project)) (name (symbol->string project))
(build-system trivial-build-system) ;; Use the copy-build-system, as it provides the necessary UTF-8 locales
;; support.
(build-system copy-build-system)
(arguments (arguments
(list (list
#:modules '((guix build union) #:imported-modules `(,@%copy-build-system-modules
(guix build union))
#:modules '((guix build copy-build-system)
(guix build union)
(guix build utils)) (guix build utils))
#:builder #:phases
#~(begin #~(modify-phases %standard-phases
(use-modules (guix build union) (replace 'install
(guix build utils)) (lambda _
(union-build #$output (list #$base #$l10n-package)
#:create-all-directories? #t)
(union-build #$output (list #$base #$l10n-package) (define* (expose name #:optional (proc copy-file)
#:create-all-directories? #t) #:key (source #$base))
(let ((dest (string-append #$output "/" name)))
(mkdir-p (dirname dest))
(proc (string-append source "/" name) dest)))
(define* (expose name #:optional (proc copy-file) (let ((wrapper (string-append "lib/" #$name "/" #$name))
#:key (source #$base)) (real-binary (string-append "lib/" #$name "/." #$name
(let ((dest (string-append #$output "/" name))) "-real"))
(mkdir-p (dirname dest)) (desktop-file (string-append "share/applications/"
(proc (string-append source "/" name) dest))) #$name ".desktop")))
;; Copy wrapper file.
(delete-file (string-append #$output "/" wrapper))
(expose wrapper)
(let ((wrapper (string-append "lib/" #$name "/" #$name)) ;; Recreate bin symlink.
(real-binary (string-append "lib/" #$name "/." #$name (delete-file (string-append #$output "/bin/" #$name))
"-real")) (symlink (string-append #$output "/" wrapper)
(desktop-file (string-append "share/applications/" (string-append #$output "/bin/" #$name))
#$name ".desktop")))
;; Copy wrapper file.
(delete-file (string-append #$output "/" wrapper))
(expose wrapper)
;; Recreate bin symlink. ;; Copy actual binary.
(delete-file (string-append #$output "/bin/" #$name)) (delete-file (string-append #$output "/" real-binary))
(symlink (string-append #$output "/" wrapper) (expose real-binary)
(string-append #$output "/bin/" #$name))
;; Copy actual binary. ;; Copy desktop file.
(delete-file (string-append #$output "/" real-binary)) (delete-file (string-append #$output "/" desktop-file))
(expose real-binary) (expose desktop-file)
;; Copy desktop file. ;; Adjust the references in the desktop file and wrapper.
(delete-file (string-append #$output "/" desktop-file)) (substitute* (list (string-append #$output "/" desktop-file)
(expose desktop-file) (string-append #$output "/" wrapper))
((#$base) #$output)))))))))))
;; Adjust the references in the desktop file and wrapper.
(substitute* (list (string-append #$output "/" desktop-file)
(string-append #$output "/" wrapper))
((#$base) #$output)))))))))
(define-public icecat (define-public icecat
(make-mozilla-with-l10n 'icecat icecat-minimal icecat-l10n)) (make-mozilla-with-l10n 'icecat icecat-minimal icecat-l10n))