diff mbox series

[bug#64983,3/3] gnu: Add highlight-gui.

Message ID ad23d33d93d0a7fde0e3974a2b20379f9fb464cc.1690846546.git.gemmaro.dev@gmail.com
State New
Headers show
Series gnu: highlight: Update to 4.7 and add GUI package. | expand

Commit Message

gemmaro July 31, 2023, 11:45 p.m. UTC
* gnu/packages/pretty-print.scm (highlight-gui): New variable.
---
 gnu/packages/pretty-print.scm | 45 +++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

Comments

gemmaro Aug. 4, 2023, 12:42 a.m. UTC | #1
I noticed that my third patch doesn't configure the GUI path settings
well, so I'll send updated patches.  I also want to rethink whether it
should be a separate package or output.
diff mbox series

Patch

diff --git a/gnu/packages/pretty-print.scm b/gnu/packages/pretty-print.scm
index 1b2cf4becf..1ec4df50a9 100644
--- a/gnu/packages/pretty-print.scm
+++ b/gnu/packages/pretty-print.scm
@@ -52,6 +52,7 @@  (define-module (gnu packages pretty-print)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages swig))
 
 (define-public a2ps
@@ -404,3 +405,47 @@  (define-public highlight
 TeX, SVG, BBCode and terminal escape sequences with colored syntax
 highlighting.  Language definitions and color themes are customizable.")
     (license gpl3+)))
+
+(define-public highlight-gui
+  (package
+    (inherit highlight)
+    (name "highlight-gui")
+    (build-system gnu-build-system)
+    (arguments
+     (substitute-keyword-arguments (package-arguments highlight)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (add-after 'unpack 'fix-paths
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let* ((highlight:out (assoc-ref inputs "highlight"))
+                       (data (string-append highlight:out "/share/highlight/"))
+                       (conf (string-append highlight:out "/etc/highlight/"))
+                       (doc (string-append highlight:out
+                                           "/share/doc/highlight/")))
+                  (substitute* "makefile"
+                    (("HL_DATA_DIR=.* HL_CONFIG_DIR=.* HL_DOC_DIR=.* gui-qt")
+                     (string-append "HL_DATA_DIR=\""
+                                    data
+                                    "\" HL_CONFIG_DIR=\""
+                                    conf
+                                    "\" HL_DOC_DIR=\""
+                                    doc
+                                    "\" gui-qt"))))))
+            (add-after 'fix-search-for-lua 'fix-search-for-lua/GUI
+              (lambda _
+                (substitute* "src/gui-qt/highlight.pro"
+                  (("PKGCONFIG \\+= lua")
+                   (string-append "PKGCONFIG += lua-"
+                                  #$(version-major+minor (package-version lua)))))))
+            (replace 'build
+              (lambda _
+                (invoke "make" "gui")))
+            (delete 'install-perl-bindings)
+            (replace 'install
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((out (assoc-ref outputs "out")))
+                  (mkdir-p (string-append out "/bin"))
+                  (invoke "make" "install-gui"))))))))
+    (native-inputs (list pkg-config))
+    (inputs (list highlight lua boost qtbase-5))
+    (synopsis "Graphical user interface for highlight")))