diff mbox series

[bug#39636,6/6] gnu: kicad: Add translations and search paths.

Message ID 20200216212834.3862-6-brice@waegenei.re
State Accepted
Headers show
Series KiCad add translation and update libraries. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Brice Waegeneire Feb. 16, 2020, 9:28 p.m. UTC
* gnu/packages/engineering.scm (kicad)[arguments]: Add phase
install-translations.
[native-search-paths]: Add specification for KICAD_TEMPLATE_DIR,
KICAD_SYMBOL_DIR, KISYSMOD and KISYS3DMOD.
[native-inputs]: Add desktop-file-utils and kicad-i18l.
[inputs]: Remove desktop-file-utils and replace python by
python-wrapper.
(kicad-i18l): Add variable.
---
 gnu/packages/engineering.scm | 179 ++++++++++++++++++++++-------------
 1 file changed, 113 insertions(+), 66 deletions(-)

Comments

Danny Milosavljevic Feb. 19, 2020, 3:35 p.m. UTC | #1
Hi Brice,

thanks for the patch series.

On Sun, 16 Feb 2020 22:28:34 +0100
Brice Waegeneire <brice@waegenei.re> wrote:

> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "KICAD_TEMPLATE_DIR")
> +            (files '("share/kicad/template")))
> +           (search-path-specification
> +            (variable "KICAD_SYMBOL_DIR") ; symbol path
> +            (files '("share/kicad/library")))
> +           (search-path-specification
> +            (variable "KISYSMOD")       ; footprint path
> +            (files '("share/kicad/modules")))
> +           (search-path-specification
> +            (variable "KISYS3DMOD")     ; 3D model path
> +            (files '("share/kicad/modules/packages3d")))))

What is the effect of these?

Otherwise fine, I'll apply all of those, but I'm just wondering what the above
is for because I've seen thousands of packages and very very few have that,
and even fewer "normal end user" programs do.
Brice Waegeneire Feb. 19, 2020, 7:07 p.m. UTC | #2
On 2020-02-19 15:35, Danny Milosavljevic wrote:
>> +    (native-search-paths
>> +     (list (search-path-specification
>> +            (variable "KICAD_TEMPLATE_DIR")
>> +            (files '("share/kicad/template")))
>> +           (search-path-specification
>> +            (variable "KICAD_SYMBOL_DIR") ; symbol path
>> +            (files '("share/kicad/library")))
>> +           (search-path-specification
>> +            (variable "KISYSMOD")       ; footprint path
>> +            (files '("share/kicad/modules")))
>> +           (search-path-specification
>> +            (variable "KISYS3DMOD")     ; 3D model path
>> +            (files '("share/kicad/modules/packages3d")))))
> 
> What is the effect of these?
> 
> Otherwise fine, I'll apply all of those, but I'm just wondering what 
> the above
> is for because I've seen thousands of packages and very very few have 
> that,
> and even fewer "normal end user" programs do.

Note that in the 4th patch, the deleted package kicad-library, set 2 of 
those native-paths already. These variables allows KiCad to find the 
location of it's "libraries" packaged in the first patches of this 
series. For example "KISYSMOD" will enable KiCad to find the schematic 
symbol libraries provided by "kicad-symbols" or any other future package 
that would provide some.

This is particularly useful, when running the wizards on your firsts run 
of KiCad, to copy the global symbol library table without using the file 
browser half haphazardly to find the path to that particular library. 
With these environment variables set a user only need to use the 
recommended option.

You can find the related documentation here: 
https://docs.kicad-pcb.org/5.0.2/en/kicad/kicad.html#paths_configuration.
diff mbox series

Patch

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 477a1642c0..da882a19f6 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -793,76 +793,123 @@  language.")
 (define-public ao
   (deprecated-package "ao-cad" libfive))
 
+;; TODO Add doc https://gitlab.com/kicad/services/kicad-doc/-/tree/master
 (define-public kicad
-    (package
-      (name "kicad")
-      (version "5.1.5")
-      (source
-       (origin
-         (method url-fetch)
-         (file-name (string-append name "-" version ".tar.xz"))
-         (uri (string-append
-                "https://launchpad.net/kicad/" (version-major version)
-                ".0/" version "/+download/kicad-" version ".tar.xz"))
-         (sha256
-          (base32 "0x3417f2pa7p65s9f7l49rqbnrzy8gz6i0n07mlbxqbnm0fmlql0"))))
-      (build-system cmake-build-system)
-      (arguments
-       `(#:out-of-source? #t
-         #:tests? #f ; no tests
-         #:build-type "Release"
-         #:configure-flags
-         (list "-DKICAD_SCRIPTING_PYTHON3=ON"
-               "-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON"
-               "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE")
-         #:phases
-         (modify-phases %standard-phases
-           (add-after 'install 'wrap-program
-             ;; Ensure correct Python at runtime.
-             (lambda* (#:key inputs outputs #:allow-other-keys)
-               (let* ((out (assoc-ref outputs "out"))
-                      (python (assoc-ref inputs "python"))
-                      (file (string-append out "/bin/kicad"))
-                      (path (string-append
-                             out
-                             "/lib/python"
-                             ,(version-major+minor
-                                (package-version python))
-                             "/site-packages:"
-                             (getenv "PYTHONPATH"))))
-                 (wrap-program file
-                   `("PYTHONPATH" ":" prefix (,path))
-                   `("PATH" ":" prefix
-                     (,(string-append python "/bin:")))))
-               #t)))))
-      (native-inputs
-       `(("boost" ,boost)
-         ("gettext" ,gnu-gettext)
-         ("pkg-config" ,pkg-config)
-         ("swig" ,swig)
-         ("zlib" ,zlib)))
-      (inputs
-       `(("cairo" ,cairo)
-         ("curl" ,curl)
-         ("desktop-file-utils" ,desktop-file-utils)
-         ("glew" ,glew)
-         ("glm" ,glm)
-         ("hicolor-icon-theme" ,hicolor-icon-theme)
-         ("libngspice" ,libngspice)
-         ("libsm" ,libsm)
-         ("mesa" ,mesa)
-         ("opencascade-oce" ,opencascade-oce)
-         ("openssl" ,openssl)
-         ("python" ,python)
-         ("wxwidgets" ,wxwidgets)
-         ("wxpython" ,python-wxpython)))
-      (home-page "https://kicad-pcb.org/")
-      (synopsis "Electronics Design Automation Suite")
-      (description "Kicad is a program for the formation of printed circuit
+  (package
+    (name "kicad")
+    (version "5.1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (file-name (string-append name "-" version ".tar.xz"))
+       (uri (string-append
+             "https://launchpad.net/kicad/" (version-major version)
+             ".0/" version "/+download/kicad-" version ".tar.xz"))
+       (sha256
+        (base32 "0x3417f2pa7p65s9f7l49rqbnrzy8gz6i0n07mlbxqbnm0fmlql0"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:out-of-source? #t
+       #:tests? #f                      ; no tests
+       #:build-type "Release"
+       #:configure-flags
+       (list "-DKICAD_SCRIPTING_PYTHON3=ON"
+             "-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON"
+             "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-translations
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (copy-recursively (assoc-ref inputs "kicad-i18l")
+                               (assoc-ref outputs "out"))
+             #t))
+         (add-after 'install 'wrap-program
+           ;; Ensure correct Python at runtime.
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (python (assoc-ref inputs "python"))
+                    (file (string-append out "/bin/kicad"))
+                    (path (string-append
+                           out
+                           "/lib/python"
+                           ,(version-major+minor
+                             (package-version python))
+                           "/site-packages:"
+                           (getenv "PYTHONPATH"))))
+               (wrap-program file
+                 `("PYTHONPATH" ":" prefix (,path))
+                 `("PATH" ":" prefix
+                   (,(string-append python "/bin:")))))
+             #t)))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "KICAD_TEMPLATE_DIR")
+            (files '("share/kicad/template")))
+           (search-path-specification
+            (variable "KICAD_SYMBOL_DIR") ; symbol path
+            (files '("share/kicad/library")))
+           (search-path-specification
+            (variable "KISYSMOD")       ; footprint path
+            (files '("share/kicad/modules")))
+           (search-path-specification
+            (variable "KISYS3DMOD")     ; 3D model path
+            (files '("share/kicad/modules/packages3d")))))
+    (native-inputs
+     `(("boost" ,boost)
+       ("desktop-file-utils" ,desktop-file-utils)
+       ("gettext" ,gnu-gettext)
+       ("kicad-i18l" ,kicad-i18l)
+       ("pkg-config" ,pkg-config)
+       ("swig" ,swig)
+       ("zlib" ,zlib)))
+    (inputs
+     `(("cairo" ,cairo)
+       ("curl" ,curl)
+       ("glew" ,glew)
+       ("glm" ,glm)
+       ("hicolor-icon-theme" ,hicolor-icon-theme)
+       ("libngspice" ,libngspice)
+       ("libsm" ,libsm)
+       ("mesa" ,mesa)
+       ("opencascade-oce" ,opencascade-oce)
+       ("openssl" ,openssl)
+       ("python" ,python-wrapper)
+       ("wxwidgets" ,wxwidgets)
+       ("wxpython" ,python-wxpython)))
+    (home-page "https://kicad-pcb.org/")
+    (synopsis "Electronics Design Automation Suite")
+    (description "Kicad is a program for the formation of printed circuit
 boards and electrical circuits.  The software has a number of programs that
 perform specific functions, for example, pcbnew (Editing PCB), eeschema (editing
 electrical diagrams), gerbview (viewing Gerber files) and others.")
-      (license license:gpl3+)))
+    (license license:gpl3+)))
+
+(define kicad-i18l
+  (package
+    (name "kicad-i18l")
+    (version "5.1.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://gitlab.com/kicad/code/kicad-i18n.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1rfpifl8vky1gba2angizlb2n7mwmsiai3r6ip6qma60wdj8sbd3"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'build)
+         (delete 'check))))
+    (native-inputs
+     `(("gettext" ,gnu-gettext)))
+    (home-page "https://kicad-pcb.org/")
+    (synopsis "KiCad GUI translations")
+    (description "This package contains the po files that is used for the GUI
+translations for KiCad.")
+    (license license:gpl3+)))
 
 (define-public kicad-symbols
   (package