guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: icecat: Install '.desktop' entry.


From: Ludovic Courtès
Subject: 02/02: gnu: icecat: Install '.desktop' entry.
Date: Thu, 2 Jun 2016 17:11:32 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 6cde5c34a1b7acb953e87055b845629015903888
Author: Ludovic Courtès <address@hidden>
Date:   Thu Jun 2 18:59:58 2016 +0200

    gnu: icecat: Install '.desktop' entry.
    
    Fixes <http://bugs.gnu.org/23094>.
    Reported by Danny Milosavljevic <address@hidden>.
    
    * gnu/packages/gnuzilla.scm (icecat)[arguments]: Add
    'install-desktop-entry' phase.
---
 gnu/packages/gnuzilla.scm |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 7e52534..4ffa3ac 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -448,6 +448,8 @@ standards.")
                            )
 
        #:modules ((ice-9 ftw)
+                  (ice-9 rdelim)
+                  (ice-9 match)
                   ,@%gnu-build-system-modules)
        #:phases
        (modify-phases %standard-phases
@@ -509,7 +511,48 @@ standards.")
               (format #t "configure flags: ~s~%" flags)
               (zero? (apply system* bash
                             (string-append srcdir "/configure")
-                            flags))))))))
+                            flags)))))
+         (add-before 'configure 'install-desktop-entry
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Install the '.desktop' file.
+             (define (swallow-%%-directives input output)
+               ;; Interpret '%%ifdef' directives found in the '.desktop' file.
+               (let loop ((state 'top))
+                 (match (read-line input 'concat)
+                   ((? eof-object?)
+                    #t)
+                   ((? string? line)
+                    (cond ((string-prefix? "%%ifdef" line)
+                           (loop 'ifdef))
+                          ((string-prefix? "%%else" line)
+                           (loop 'else))
+                          ((string-prefix? "%%endif" line)
+                           (loop 'top))
+                          (else
+                           (case state
+                             ((top else)
+                              (display line output)
+                              (loop state))
+                             (else
+                              (loop state)))))))))
+
+             (let* ((out (assoc-ref outputs "out"))
+                    (applications (string-append out "/share/applications")))
+               (call-with-input-file "debian/icecat.desktop.in"
+                 (lambda (input)
+                   (call-with-output-file "debian/icecat.desktop"
+                     (lambda (output)
+                       (swallow-%%-directives input output)))))
+
+               (substitute* "debian/icecat.desktop"
+                 (("@MOZ_DISPLAY_NAME@")
+                  "GNU IceCat")
+                 (("address@hidden@")
+                  (string-append "Exec=" out "/bin/icecat"))
+                 (("@MOZ_APP_NAME@")
+                  "icecat"))
+               (install-file "debian/icecat.desktop" applications)
+               #t))))))
     (home-page "http://www.gnu.org/software/gnuzilla/";)
     (synopsis "Entirely free browser derived from Mozilla Firefox")
     (description



reply via email to

[Prev in Thread] Current Thread [Next in Thread]