From patchwork Mon Jan 31 05:45:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 36905 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 692C127BBEA; Mon, 31 Jan 2022 05:49:58 +0000 (GMT) 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 9F4A527BBE9 for ; Mon, 31 Jan 2022 05:49:57 +0000 (GMT) Received: from localhost ([::1]:32898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEPZc-0003sb-Mc for patchwork@mira.cbaines.net; Mon, 31 Jan 2022 00:49:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEPVr-0002XK-86 for guix-patches@gnu.org; Mon, 31 Jan 2022 00:46:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45259) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nEPVq-00015C-JI for guix-patches@gnu.org; Mon, 31 Jan 2022 00:46:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nEPVq-0004VA-68 for guix-patches@gnu.org; Mon, 31 Jan 2022 00:46:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53634] [PATCH v2 4/4] gnu: Add openboardview. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 31 Jan 2022 05:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53634 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53634@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 53634-submit@debbugs.gnu.org id=B53634.164360792317257 (code B ref 53634); Mon, 31 Jan 2022 05:46:02 +0000 Received: (at 53634) by debbugs.gnu.org; 31 Jan 2022 05:45:23 +0000 Received: from localhost ([127.0.0.1]:38162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEPV6-0004U5-L3 for submit@debbugs.gnu.org; Mon, 31 Jan 2022 00:45:23 -0500 Received: from mail-qv1-f43.google.com ([209.85.219.43]:39558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEPV2-0004Tl-77 for 53634@debbugs.gnu.org; Mon, 31 Jan 2022 00:45:15 -0500 Received: by mail-qv1-f43.google.com with SMTP id k4so11882784qvt.6 for <53634@debbugs.gnu.org>; Sun, 30 Jan 2022 21:45:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4xS1ylE0tKGvQKqSZxJbEpXyyFNA+q+fJvvqYt49MZk=; b=a6A0eEy/xgtdRQYCC4E2KUgLTqRJtxD4Y9atiAGUgFhlKvtaD/FHCEQgQNOwvJOtta Dg9f6qkIKK81JxNXGezG9kPuR4ouOCCbwzy4obEOb88Okd5bpBffFyBVg46dcmtBuWAv Ra0fJWI8gdFrIthZTAgVeuatil8y91xbXnxZshj76/X4O7dWCrFo3Y4vF4xEJ1eqVtYH /oLhDj7PaXEfks/Shz0tHoUp4nV14XsSnXQLe1AMBxCbQstODhWJTtlW+Cw/QUSnPVZF +GL3GQAA1C/HbAqIItr0KP329zkl0z287bLokpaH9vtRp478wopLdy09ot0iqe6dW7ft WCjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4xS1ylE0tKGvQKqSZxJbEpXyyFNA+q+fJvvqYt49MZk=; b=IKiOgTDZ1Zi73s1o34jQUQj8W9dRyU9ww7H6NT9rNKy83/vXjGCRvTGZCsIK67xmpF IDJIPKxitZhNMKBUwzuKCirQaECsS8wnKQwCP5E9JlP0wShXdsdW7mMdVqS/0N/waPnE o94kRg5eS3hSDjfikGO6Q2hoxMHMxdDhjS4fGzu67F6hWWb7UIcNRbC5agu+eivdOjxQ s9OU7d7x8bSK1JQ6TLsCHRSHIbzeJabs55XHEemEZNJy4q+guGCXyFrNpb7Eq8AeWDmb fEcDkcJ4O6G8fiPoSSc43aHQDgYVfd8YI/9V8FO1onzmL+g/XbH9KNSB2sekLTCJAlUi 3VWg== X-Gm-Message-State: AOAM530KJ9TpmmJdR/qaGpGF9z3NYzllMZSA3iNuUP92TwB4aBVYKE0a aHXrK2cSQN807Ncnf0K/U0QqGDlNTFM= X-Google-Smtp-Source: ABdhPJwVAJWs/wFFR3Idj5bkm47tXfu+i+ho/QfO410Nh+FDisNU1iZ41utxO9e2z7vhzL1elQ9M8A== X-Received: by 2002:ad4:5f0a:: with SMTP id fo10mr16341014qvb.36.1643607906400; Sun, 30 Jan 2022 21:45:06 -0800 (PST) Received: from localhost.localdomain (dsl-10-141-111.b2b2c.ca. [72.10.141.111]) by smtp.gmail.com with ESMTPSA id l202sm7973808qke.66.2022.01.30.21.45.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 21:45:05 -0800 (PST) From: Maxim Cournoyer Date: Mon, 31 Jan 2022 00:45:02 -0500 Message-Id: <20220131054502.6258-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220130074848.3397-4-maxim.cournoyer@gmail.com> References: <20220130074848.3397-4-maxim.cournoyer@gmail.com> 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" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/electronics.scm (openboardview): New variable. * gnu/packages/patches/openboardview-use-system-utf8.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + gnu/packages/electronics.scm | 124 +++++++++++++++++- .../openboardview-use-system-utf8.patch | 48 +++++++ 3 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/openboardview-use-system-utf8.patch diff --git a/gnu/local.mk b/gnu/local.mk index 96e6cb08f4..692cd7d6bc 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1567,6 +1567,7 @@ dist_patch_DATA = \ %D%/packages/patches/onnx-shared-libraries.patch \ %D%/packages/patches/onnx-skip-model-downloads.patch \ %D%/packages/patches/openbabel-fix-crash-on-nwchem-output.patch \ + %D%/packages/patches/openboardview-use-system-utf8.patch \ %D%/packages/patches/opencascade-oce-glibc-2.26.patch \ %D%/packages/patches/openfoam-4.1-cleanup.patch \ %D%/packages/patches/openjdk-10-idlj-reproducibility.patch \ diff --git a/gnu/packages/electronics.scm b/gnu/packages/electronics.scm index 54f246faa6..24bb4b03b1 100644 --- a/gnu/packages/electronics.scm +++ b/gnu/packages/electronics.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2019 Clément Lassieur ;;; Copyright © 2021 Efraim Flashner ;;; Copyright © 2021 Leo Famulari +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,11 +22,12 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages electronics) - #:use-module (guix utils) - #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (gnu packages) @@ -34,11 +36,14 @@ (define-module (gnu packages electronics) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages boost) + #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages documentation) #:use-module (gnu packages embedded) + #:use-module (gnu packages fontutils) #:use-module (gnu packages gawk) + #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages graphviz) #:use-module (gnu packages gtk) @@ -48,7 +53,10 @@ (define-module (gnu packages electronics) #:use-module (gnu packages m4) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) - #:use-module (gnu packages qt)) + #:use-module (gnu packages qt) + #:use-module (gnu packages sdl) + #:use-module (gnu packages sqlite) + #:use-module (gnu packages stb)) (define-public libserialport (package @@ -240,6 +248,116 @@ (define-public sigrok-cli (description "Sigrok-cli is a command-line frontend for sigrok.") (license license:gpl3+))) +(define-public openboardview + (package + (name "openboardview") + (version "8.95.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/OpenBoardView/OpenBoardView") + (commit version) + (recursive? #t))) ;for the "src/imgui" submodule + (file-name (git-file-name name version)) + (modules '((ice-9 ftw) + (srfi srfi-26) + (guix build utils))) + (snippet + '(with-directory-excursion "src" + ;; Keep the bundled ImGui for now, as in the current version + ;; (~1.79), it requires the glad loader generated at build + ;; time as an input. + (define keep (list "." ".." "imgui" "openboardview")) + (for-each (lambda (f) + (when (eq? 'directory (stat:type (lstat f))) + (delete-file-recursively f))) + (scandir "." (negate (cut member <> keep)))))) + (patches + (search-patches "openboardview-use-system-utf8.patch")) + (sha256 + (base32 + "16mrs7bimwp8a8lb2wqhfisy6j0hl9574l4h9yb66v46aglvmd3h")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ;no test suite + #:imported-modules `((guix build glib-or-gtk-build-system) + ,@%cmake-build-system-modules) + #:modules '((guix build cmake-build-system) + (guix build utils) + ((guix build glib-or-gtk-build-system) #:prefix gtk:)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'remove-timestamps + (lambda _ + ;; The __TIMESTAMP__ CPP macro does apparently not honor + ;; SOURCE_EPOCH_DATE. Patch it to use __DATE__ instead, which + ;; does (see: + ;; https://github.com/OpenBoardView/OpenBoardView/issues/229 and + ;; https://issues.guix.gnu.org/53647). + (substitute* '("src/openboardview/BoardView.cpp" + "src/openboardview/main_opengl.cpp") + (("__TIMESTAMP__") + "__DATE__")))) + (add-before 'configure 'configure-glad + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/CMakeLists.txt" + (("add_subdirectory\\(glad\\)") + (string-append + ;; Configure Glad to use static Khronos XML specifications + ;; instead of attempting to fetch them from the Internet. + "option(GLAD_REPRODUCIBLE \"Reproducible build\" ON)\n" + ;; Use the CMake files from our glad package. + "add_subdirectory(" + (search-input-directory inputs "share/glad") ;source_dir + " src/glad)\n"))))) ;binary dir + (add-before 'configure 'fix-utf8-include-directive + ;; Our utf8-h package makes the header available as "utf8.h" + ;; directly rather than "utf8/utf8.h". + (lambda _ + (substitute* '("src/openboardview/FileFormats/BRDFile.cpp" + "src/openboardview/BoardView.cpp") + (("utf8/utf8.h") "utf8.h")))) + (add-before 'configure 'dynamically-load-gtk-via-absolute-path + ;; The GTK library is not linked thus not present in the RUNPATH of + ;; the produced binary; the absolute path of the libraries must to + ;; the dynamic loader otherwise they aren't found. + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/openboardview/unix.cpp" + (("libgtk-3.so") + (search-input-file inputs "lib/libgtk-3.so"))))) + ;; Add the two extra phases from `glib-or-gtk-build-system'. + (add-after 'install 'glib-or-gtk-compile-schemas + (assoc-ref gtk:%standard-phases 'glib-or-gtk-compile-schemas)) + (add-after 'install 'glib-or-gtk-wrap + (assoc-ref gtk:%standard-phases 'glib-or-gtk-wrap))))) + (native-inputs + (list pkg-config + python + glad + stb-image + utf8-h)) + (inputs + (list fontconfig + gtk+ + sdl2 + sqlite + zlib)) + (home-page "https://openboardview.org/") + (synopsis "Viewer for BoardView files") + (description "OpenBoardView is a viewer for BoardView files, which present +the details of a printed circuit board (PCB). It comes with features +such as: +@itemize +@item Dynamic part outline rendering, including complex connectors +@item Annotations, for leaving notes about parts, nets, pins or location +@item Configurable colour themes +@item Configurable DPI to facilitate usage on 4K monitors +@item Configurable for running on slower systems +@item Reads FZ (with key), BRD, BRD2, BDV and BV* formats. +@end itemize") + (license license:expat))) + (define-public pulseview (package (name "pulseview") diff --git a/gnu/packages/patches/openboardview-use-system-utf8.patch b/gnu/packages/patches/openboardview-use-system-utf8.patch new file mode 100644 index 0000000000..25b5952bda --- /dev/null +++ b/gnu/packages/patches/openboardview-use-system-utf8.patch @@ -0,0 +1,48 @@ +From 251e23422f37c93a3f460fb660c5e5bfa8200d91 Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer +Date: Sun, 2 Dec 2018 16:40:39 -0500 +Subject: [PATCH] build system: Allow using utf8.h from the system. + +--- + src/CMakeLists.txt | 12 ++++++++---- + src/openboardview/CMakeLists.txt | 1 + + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 90442ed..26d4a69 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -8,10 +8,14 @@ if(NOT WIN32 OR MINGW) + endif() + + ## utf8.h ## +-execute_process( +- COMMAND git submodule update --init src/utf8 +- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +-) ++FIND_PATH(UTF8_INCLUDE_DIR utf8.h) ++if(NOT UTF8_INCLUDE_DIR) ++ execute_process( ++ COMMAND git submodule update --init src/utf8 ++ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ++ ) ++ set(UTF8_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/utf8) ++endif() + + ## zlib ## + find_package(ZLIB) +diff --git a/src/openboardview/CMakeLists.txt b/src/openboardview/CMakeLists.txt +index b0bdbe3..6c4564c 100644 +--- a/src/openboardview/CMakeLists.txt ++++ b/src/openboardview/CMakeLists.txt +@@ -44,6 +44,7 @@ include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${IMGUI_INCLUDE_DIRS} ++ ${UTF8_INCLUDE_DIR} + ${GLAD_INCLUDE_DIRS} + ${GTK_INCLUDE_DIRS} + ${OPENGL_INCLUDE_DIR} +-- +2.34.0 +