From patchwork Mon Aug 7 14:05:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gemmaro X-Patchwork-Id: 52607 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1E28427BBEA; Mon, 7 Aug 2023 15:17:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,T_PDS_PRO_TLD autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CF0C227BBE2 for ; Mon, 7 Aug 2023 15:17:15 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT12K-0001O9-Pf; Mon, 07 Aug 2023 10:16:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT11g-0000Ug-KF for guix-patches@gnu.org; Mon, 07 Aug 2023 10:16:09 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qT11f-0005jf-0W for guix-patches@gnu.org; Mon, 07 Aug 2023 10:16:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qT11e-0004kv-TF for guix-patches@gnu.org; Mon, 07 Aug 2023 10:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64983] [PATCH v2 3/4] gnu: highlight: Add gui output. Resent-From: gemmaro Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 07 Aug 2023 14:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64983 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64983@debbugs.gnu.org Cc: gemmaro Received: via spool by 64983-submit@debbugs.gnu.org id=B64983.169141771518175 (code B ref 64983); Mon, 07 Aug 2023 14:16:02 +0000 Received: (at 64983) by debbugs.gnu.org; 7 Aug 2023 14:15:15 +0000 Received: from localhost ([127.0.0.1]:34043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qT10s-0004iz-CI for submit@debbugs.gnu.org; Mon, 07 Aug 2023 10:15:15 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:48581) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qT10m-0004i2-SV for 64983@debbugs.gnu.org; Mon, 07 Aug 2023 10:15:12 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1bc02bd4eafso39393155ad.1 for <64983@debbugs.gnu.org>; Mon, 07 Aug 2023 07:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691417703; x=1692022503; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X/w5zGGD6SHkOP7v5SHS3xtl4KTjeE4lZxWSUPY+4gA=; b=jp9UUqZZvOS0LHo44PkYoeD0hauPUSTTum6KX1P78/uXM7f0XV0DrR8TJhTWFs0upR 0WNySH7ICK0XIxQlRxP5WiyLUtI/rffCrNVED5PlBisd9wbCNBKxkpFK8f9klvZT3aa0 PLuXy70VJ75OqM7WXyKy4RfQ9IB4WHIpIjM09LjU7yNSfb8UnBYxlIMIZNfUUhkxZdpS TdKPygkAJbMVzxlpLL82Vgq4rNrxvCzgcXGMGL0WfwG+nelsZ+8hiHRqaXqdVtohjjxA 3PoSImN5oWTaXevXQLdM6PuCQXxd3vA/AXNGzhJg1xVFgHqDrllG+c+2ZCPlOUNVP+yl 2UrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691417703; x=1692022503; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X/w5zGGD6SHkOP7v5SHS3xtl4KTjeE4lZxWSUPY+4gA=; b=a50QoFeQOoA0ejt2LM3THUssUuofYZVVtYpZ4jHih0k80V2i2ul78bQg3AuvLwmHwa of1AyJ6PxFZjnjPlxpgv6E2bDPWJTVI9+pWMszjIfEOSb7dzhsQGmbO7+a6vBLH0xRe1 K5JMH5xNCM1ICms5gg+OgCF1A1RT38saMGpCD6g8NGAgDEj6I25VYt7q439IdkrF8V1p PVq4JiDxq2ItZX7j64QyUExwLxVnWkcxzG3t6UCu+g81x5AjGq3D+vZ7IW1AZ8qticW9 bWXiNFrJy6pB8KxIy1wXIBIzBc8JvdirWznuGbT9yHRi38ZVXIyCBJUpH/PWtZHZ75Tx NgSQ== X-Gm-Message-State: AOJu0YwoeEhSCqhBTp2QGSHNMY4/1U7pIba1Pqjc2bNrJCeHBt9EvzIO a+Z1gw4vcyIoh+Dhg170+rhkwWWsR7c= X-Google-Smtp-Source: AGHT+IGdGqmo5E8rqL1JQq4EXMSsnUw6KYyMAJFuyeOTKeOFPRQz6vFUOdjww15wZzz/sGa5kMNmcg== X-Received: by 2002:a17:902:db06:b0:1b2:1a79:147d with SMTP id m6-20020a170902db0600b001b21a79147dmr10846789plx.2.1691417703209; Mon, 07 Aug 2023 07:15:03 -0700 (PDT) Received: from mac.gemmaro.name (ONI-202-70-254-104.oninet.ne.jp. [202.70.254.104]) by smtp.gmail.com with ESMTPSA id ja4-20020a170902efc400b001b8013ed362sm6985191plb.96.2023.08.07.07.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 07:15:02 -0700 (PDT) From: gemmaro Date: Mon, 7 Aug 2023 23:05:41 +0900 Message-ID: <86cfa707151d8ed32b9acaff3894c182747b8e3f.1691417142.git.gemmaro.dev@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/pretty-print.scm (highlight): Add gui output. [source]: Add patch for GUI data directory. [outputs]: Add gui. [arguments]{fix-search-for-lua}: Fix Lua package name for GUI. {build-gui}: Add phase to build GUI. {install}: Set PREFIX variable. {install-gui}: Add phase to install GUI. [inputs]: Add qtbase-5. * gnu/packages/patches/highlight-gui-data-dir.patch: Add patch for GUI data directory. --- .../patches/highlight-gui-data-dir.patch | 51 ++++++++++++++ gnu/packages/pretty-print.scm | 66 ++++++++++++++----- 2 files changed, 102 insertions(+), 15 deletions(-) create mode 100644 gnu/packages/patches/highlight-gui-data-dir.patch diff --git a/gnu/packages/patches/highlight-gui-data-dir.patch b/gnu/packages/patches/highlight-gui-data-dir.patch new file mode 100644 index 0000000000..33f40d309c --- /dev/null +++ b/gnu/packages/patches/highlight-gui-data-dir.patch @@ -0,0 +1,51 @@ +This patch distinguishes between the data directory path for GUI and the one +for non-GUI by allowing to set the former path. + +highlight package has two outputs: out and gui. Both outputs have files which +will be in the same directory /share/highlight/ without this patch (see also +install and install-gui tasks in makefile). In the gui's data directory, +there are GUI specific files in /share/highlight/gui-files/{l10n,ext}/. + +diff --git a/src/gui-qt/main.cpp b/src/gui-qt/main.cpp +index 4700dc1..3567745 100644 +--- a/src/gui-qt/main.cpp ++++ b/src/gui-qt/main.cpp +@@ -47,8 +47,8 @@ int main(int argc, char *argv[]) + { + QApplication app(argc, argv); + QTranslator translator; +-#ifdef DATA_DIR +- translator.load(QString("%1/gui_files/l10n/highlight_%2").arg(DATA_DIR).arg(QLocale::system().name())); ++#ifdef GUI_DATA_DIR ++ translator.load(QString("%1/gui_files/l10n/highlight_%2").arg(GUI_DATA_DIR).arg(QLocale::system().name())); + #else + translator.load(QString("%1/gui_files/l10n/highlight_%2").arg(QDir::currentPath()).arg(QLocale::system().name())); + #endif +diff --git a/src/gui-qt/mainwindow.cpp b/src/gui-qt/mainwindow.cpp +index 3a21ad2..f060431 100644 +--- a/src/gui-qt/mainwindow.cpp ++++ b/src/gui-qt/mainwindow.cpp +@@ -2131,8 +2131,8 @@ QString MainWindow::getDistFileFilterPath(){ + #ifdef Q_OS_OSX + return QCoreApplication::applicationDirPath()+"/../Resources/gui_files/ext/fileopenfilter.conf"; + #else +- #ifdef DATA_DIR +- return QString(DATA_DIR) + "/gui_files/ext/fileopenfilter.conf"; ++ #ifdef GUI_DATA_DIR ++ return QString(GUI_DATA_DIR) + "/gui_files/ext/fileopenfilter.conf"; + #else + return QDir::currentPath()+"/gui_files/ext/fileopenfilter.conf"; + #endif +diff --git a/src/makefile b/src/makefile +index b1d7988..2963105 100644 +--- a/src/makefile ++++ b/src/makefile +@@ -118,7 +118,7 @@ gui-qt: highlight-gui + + highlight-gui: libhighlight.a ${GUI_OBJECTS} + cd gui-qt && \ +- ${QMAKE} 'DEFINES+=DATA_DIR=\\\"${HL_DATA_DIR}\\\" CONFIG_DIR=\\\"${HL_CONFIG_DIR}\\\" DOC_DIR=\\\"${HL_DOC_DIR}\\\" ' && \ ++ ${QMAKE} 'DEFINES+=DATA_DIR=\\\"${HL_DATA_DIR}\\\" CONFIG_DIR=\\\"${HL_CONFIG_DIR}\\\" DOC_DIR=\\\"${HL_DOC_DIR}\\\" GUI_DATA_DIR=\\\"${GUI_DATA_DIR}\\\" ' && \ + $(MAKE) + + $(OBJECTFILES) : makefile diff --git a/gnu/packages/pretty-print.scm b/gnu/packages/pretty-print.scm index 1b2cf4becf..f8763b7b74 100644 --- a/gnu/packages/pretty-print.scm +++ b/gnu/packages/pretty-print.scm @@ -52,7 +52,8 @@ (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 swig)) + #:use-module (gnu packages swig) + #:use-module (gnu packages qt)) (define-public a2ps (package @@ -352,13 +353,15 @@ (define-public highlight (package (name "highlight") (version "4.7") + (outputs (list "out" "gui")) (source (origin (method url-fetch) (uri (string-append "http://www.andre-simon.de/zip/highlight-" version ".tar.bz2")) (sha256 (base32 - "1cl21qpgy92w1x53vrn1bgq84mkh6fgayc9k38mz4xmz2yw01nv1")))) + "1cl21qpgy92w1x53vrn1bgq84mkh6fgayc9k38mz4xmz2yw01nv1")) + (patches (search-patches "highlight-gui-data-dir.patch")))) (build-system gnu-build-system) (arguments (list #:tests? #f ;no tests @@ -371,17 +374,44 @@ (define-public highlight (delete 'configure) ;no configure script (add-after 'unpack 'fix-search-for-lua (lambda _ - (substitute* "src/makefile" - (("(LUA_PKG_NAME=).*" _ assignment) - (string-append assignment "lua-" - #$(version-major+minor (package-version - lua)) - "\n"))) - (substitute* "extras/swig/makefile" - (("lua") - (string-append "lua-" - #$(version-major+minor (package-version - lua))))))) + (let ((ver #$(version-major+minor (package-version + lua)))) + (substitute* "src/makefile" + (("(LUA_PKG_NAME=).*" _ assignment) + (string-append assignment "lua-" ver "\n"))) + (substitute* "src/gui-qt/highlight.pro" + (("(PKGCONFIG \\+= lua)" _ assignment) + (string-append assignment "-" ver))) + (substitute* "extras/swig/makefile" + (("lua") + (string-append "lua-" ver)))))) + (add-after 'build 'build-gui + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (data (string-append out + "/share/highlight/")) + (conf (string-append out "/etc/highlight/")) + (doc (string-append out + "/share/doc/highlight/")) + (gui (assoc-ref outputs "gui")) + (gui-data (string-append gui + "/share/highlight/"))) + ;; modified version of gui task in makefile + (invoke "make" + "-C" + "./src" + "-f" + "./makefile" + (string-append "HL_DATA_DIR=" data) + (string-append "HL_CONFIG_DIR=" conf) + (string-append "HL_DOC_DIR=" doc) + (string-append "GUI_DATA_DIR=" gui-data) + "gui-qt")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (invoke "make" "install" + (string-append "PREFIX=" out))))) (add-after 'install 'install-perl-bindings (lambda* (#:key outputs #:allow-other-keys) (let* ((perldir (string-append (assoc-ref outputs @@ -394,8 +424,14 @@ (define-public highlight (invoke "make" "perl") (invoke "perl" "-I" "." "testmod.pl") (install-file "highlight.pm" perldir) - (install-file "highlight.so" autodir)))))))) - (inputs (list lua boost perl)) + (install-file "highlight.so" autodir))))) + (add-after 'install 'install-gui + (lambda* (#:key outputs #:allow-other-keys) + (let ((gui (assoc-ref outputs "gui"))) + (mkdir-p (string-append gui "/bin")) + (invoke "make" "install-gui" + (string-append "PREFIX=" gui)))))))) + (inputs (list lua boost perl qtbase-5)) (native-inputs (list pkg-config swig)) (home-page "http://www.andre-simon.de/doku/highlight/en/highlight.php") (synopsis "Convert code to documents with syntax highlighting")