kicad: use separated libraries

switch source to gitlab as that's the new upstream source

use wrapper variables for everything but i18n
  add sym and fp templates to template path

update meta to reflect kicad's own language
  set license to AGPLv3, according to the source's LICENSE.README

reduce diff between default and unstable in preparation of merging

on debian gets "no module named 'math'"
  pcbnew 3d viewer is unusable (at least on my T410)
This commit is contained in:
Evils 2019-12-06 04:53:28 +01:00
parent c61170168d
commit 958d745fec
4 changed files with 62 additions and 98 deletions

View File

@ -1,8 +1,8 @@
{ lib, stdenv, fetchFromGitHub, cmake, libGLU, libGL, zlib, wxGTK
{ lib, stdenv, fetchFromGitLab, cmake, libGLU, libGL, zlib, wxGTK
, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig
, doxygen, pcre, libpthreadstubs, libXdmcp, makeWrapper, gnome3
, gsettings-desktop-schemas, librsvg, hicolor-icon-theme, lndir, cups
, fetchpatch
, gsettings-desktop-schemas, librsvg, hicolor-icon-theme, cups
, fetchpatch, kicad-libraries, lndir
, oceSupport ? false, opencascade
, withOCCT ? true, opencascade-occt
@ -16,35 +16,24 @@ assert ngspiceSupport -> libngspice != null;
with lib;
let
mkLib = version: name: sha256: attrs: stdenv.mkDerivation ({
name = "kicad-${name}-${version}";
src = fetchFromGitHub {
owner = "KiCad";
repo = "kicad-${name}";
rev = version;
inherit sha256 name;
};
nativeBuildInputs = [ cmake ];
} // attrs);
# oce on aarch64 fails a test
withOCC = (stdenv.isAarch64 && (withOCCT || oceSupport)) || (!stdenv.isAarch64 && withOCCT);
withOCE = oceSupport && !stdenv.isAarch64 && !withOCC;
in
stdenv.mkDerivation rec {
pname = "kicad";
version = "5.1.5";
src = fetchFromGitHub {
owner = "KiCad";
repo = "kicad-source-mirror";
src = fetchFromGitLab {
group = "kicad";
owner = "code";
repo = "kicad";
rev = version;
sha256 = "15h3rwisjss3fdc9bam9n2wq94slhacc3fbg14bnzf4n5agsnv5b";
};
# quick fix for #72248
# should be removed if a better fix is merged
# should be removed if a a more permanent fix is published
patches = [
(fetchpatch {
url = "https://github.com/johnbeard/kicad/commit/dfb1318a3989e3d6f9f2ac33c924ca5030ea273b.patch";
@ -52,11 +41,6 @@ stdenv.mkDerivation rec {
})
];
postPatch = ''
substituteInPlace CMakeModules/KiCadVersion.cmake \
--replace "unknown" ${version}
'';
makeFlags = optional (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
cmakeFlags =
@ -111,35 +95,9 @@ stdenv.mkDerivation rec {
dontStrip = debug;
passthru = {
symbols = mkLib "${version}" "symbols" "048b07ffsaav1ssrchw2p870lvb4rsyb5vnniy670k7q9p16qq6h" {
meta.license = licenses.cc-by-sa-40;
};
templates = mkLib "${version}" "templates" "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g" {
meta.license = licenses.cc-by-sa-40;
};
footprints = mkLib "${version}" "footprints" "1c4whgn14qhz4yqkl46w13p6rpv1k0hsc9s9h9368fxfcz9knb2j" {
meta.license = licenses.cc-by-sa-40;
};
i18n = mkLib "${version}" "i18n" "1rfpifl8vky1gba2angizlb2n7mwmsiai3r6ip6qma60wdj8sbd3" {
buildInputs = [ gettext ];
meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3
};
packages3d = mkLib "${version}" "packages3d" "0cff2ms1bsw530kqb1fr1m2pjixyxzwa81mxgac3qpbcf8fnpvaz" {
hydraPlatforms = []; # this is a ~1 GiB download, occupies ~5 GiB in store
meta.license = licenses.cc-by-sa-40;
};
};
# TODO, figure out how to skip this step? (since we're not making the 3D models optional)
modules = with passthru; [ i18n symbols footprints templates ]
++ optionals (with3d) [ packages3d ];
postInstall = ''
mkdir -p $out/share
for module in $modules; do
lndir $module/share $out/share
done
lndir ${kicad-libraries.i18n}/share $out/share
'';
makeWrapperArgs = [
@ -147,11 +105,19 @@ stdenv.mkDerivation rec {
"--prefix XDG_DATA_DIRS : ${gnome3.defaultIconTheme}/share"
"--prefix XDG_DATA_DIRS : ${wxGTK.gtk}/share/gsettings-schemas/${wxGTK.gtk.name}"
"--prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
# wrapGAppsHook did these, as well, no idea if it matters...
# wrapGAppsHook did these two as well, no idea if it matters...
"--prefix XDG_DATA_DIRS : ${cups}/share"
"--prefix GIO_EXTRA_MODULES : ${gnome3.dconf}/lib/gio/modules"
"--set KISYSMOD ${kicad-libraries.footprints}/share/kicad/modules"
"--set KICAD_SYMBOL_DIR ${kicad-libraries.symbols}/share/kicad/library"
"--set KICAD_TEMPLATE_DIR ${kicad-libraries.templates}/share/kicad/template"
"--prefix KICAD_TEMPLATE_DIR : ${kicad-libraries.symbols}/share/kicad/template"
"--prefix KICAD_TEMPLATE_DIR : ${kicad-libraries.footprints}/share/kicad/template"
]
++ optionals (ngspiceSupport) [ "--prefix LD_LIBRARY_PATH : ${libngspice}/lib" ]
++ optionals (with3d) [ "--set KISYS3DMOD ${kicad-libraries.packages3d}/share/kicad/modules/packages3d" ]
# infinisil's workaround for #39493
++ [ "--set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]
;
@ -161,13 +127,13 @@ stdenv.mkDerivation rec {
preFixup =
optionalString (scriptingSupport) '' buildPythonPath "$out $pythonPath"
'' +
'' wrapProgram $out/bin/kicad $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share --set KICAD_SYMBOL_DIR $out/share/kicad/library --set KICAD_TEMPLATE_DIR $out/share/kicad/template --set KISYS3DMOD $out/share/kicad/modules/packages3d --set KISYSMOD $out/share/kicad/modules ''
'' wrapProgram $out/bin/kicad $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share ''
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
'' wrapProgram $out/bin/pcbnew $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share --set KISYS3DMOD $out/share/kicad/modules/packages3d ''
'' wrapProgram $out/bin/pcbnew $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share ''
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
'' wrapProgram $out/bin/eeschema $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share --set KICAD_SYMBOL_DIR $out/share/kicad/library ''
'' wrapProgram $out/bin/eeschema $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share ''
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"
'' +
'' wrapProgram $out/bin/gerbview $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share ''
@ -185,9 +151,13 @@ stdenv.mkDerivation rec {
;
meta = {
description = "Free Software EDA Suite";
homepage = "http://www.kicad-pcb.org/";
license = with licenses; [ gpl2 cc-by-sa-40 ];
description = "Open Source Electronics Design Automation Suite";
homepage = "https://www.kicad-pcb.org/";
longDescription = ''
KiCad is an open source software suite for Electronic Design Automation.
The Programs handle Schematic Capture, and PCB Layout with Gerber output.
'';
license = licenses.agpl3;
maintainers = with maintainers; [ evils kiwi berce ];
platforms = with platforms; linux;
};

View File

@ -4,6 +4,7 @@
with lib;
let
version = "5.1.5";
mkLib = version: name: sha256: attrs: stdenv.mkDerivation ({
name = "kicad-${name}-${version}";
src = fetchFromGitHub {
@ -15,36 +16,22 @@ let
nativeBuildInputs = [ cmake ];
} // attrs);
in
stdenv.mkDerivation rec {
pname = "kicad-libraries";
version = "5.1.5";
passthru = {
symbols = mkLib "${version}" "symbols" "048b07ffsaav1ssrchw2p870lvb4rsyb5vnniy670k7q9p16qq6h" {
meta.license = licenses.cc-by-sa-40;
};
templates = mkLib "${version}" "templates" "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g" {
meta.license = licenses.cc-by-sa-40;
};
footprints = mkLib "${version}" "footprints" "1c4whgn14qhz4yqkl46w13p6rpv1k0hsc9s9h9368fxfcz9knb2j" {
meta.license = licenses.cc-by-sa-40;
};
i18n = mkLib "${version}" "i18n" "1rfpifl8vky1gba2angizlb2n7mwmsiai3r6ip6qma60wdj8sbd3" {
buildInputs = [ gettext ];
meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3
};
packages3d = mkLib "${version}" "packages3d" "0cff2ms1bsw530kqb1fr1m2pjixyxzwa81mxgac3qpbcf8fnpvaz" {
hydraPlatforms = []; # this is a ~1 GiB download, occupies ~5 GiB in store
meta.license = licenses.cc-by-sa-40;
};
{
symbols = mkLib "${version}" "symbols" "048b07ffsaav1ssrchw2p870lvb4rsyb5vnniy670k7q9p16qq6h" {
meta.license = licenses.cc-by-sa-40;
};
meta = {
description = "Free Software EDA Suite, assets";
homepage = "http://www.kicad-pcb.org/";
license = with licenses; [ gpl2 cc-by-sa-40 ];
maintainers = with maintainers; [ evils kiwi ];
platforms = with platforms; linux;
templates = mkLib "${version}" "templates" "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g" {
meta.license = licenses.cc-by-sa-40;
};
footprints = mkLib "${version}" "footprints" "1c4whgn14qhz4yqkl46w13p6rpv1k0hsc9s9h9368fxfcz9knb2j" {
meta.license = licenses.cc-by-sa-40;
};
i18n = mkLib "${version}" "i18n" "1rfpifl8vky1gba2angizlb2n7mwmsiai3r6ip6qma60wdj8sbd3" {
buildInputs = [ gettext ];
meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3
};
packages3d = mkLib "${version}" "packages3d" "0cff2ms1bsw530kqb1fr1m2pjixyxzwa81mxgac3qpbcf8fnpvaz" {
hydraPlatforms = []; # this is a ~1 GiB download, occupies ~5 GiB in store
meta.license = licenses.cc-by-sa-40;
};
}

View File

@ -12,20 +12,18 @@
, with3d ? true
}:
assert ngspiceSupport -> libngspice != null;
with lib;
# oce on aarch64 fails a test
let
# oce on aarch64 fails a test
withOCC = (stdenv.isAarch64 && (withOCCT || oceSupport)) || (!stdenv.isAarch64 && withOCCT);
withOCE = oceSupport && !stdenv.isAarch64 && !withOCC;
in
stdenv.mkDerivation rec {
pname = "kicad-unstable";
version = "2019-12-05";
version = "2019-12-10";
src = fetchFromGitLab {
group = "kicad";
@ -35,6 +33,8 @@ stdenv.mkDerivation rec {
sha256 = "0qzjv06az1xl3am5v4v09nyfjcpq1wf3137wjv7a0vh8m38dvrwk";
};
# quick fix for #72248
# should be removed if a a more permanent fix is published
patches = [
(fetchpatch {
url = "https://github.com/johnbeard/kicad/commit/dfb1318a3989e3d6f9f2ac33c924ca5030ea273b.patch";
@ -42,6 +42,7 @@ stdenv.mkDerivation rec {
})
];
# tagged releases don't have "unknown"
postPatch = ''
substituteInPlace CMakeModules/KiCadVersion.cmake \
--replace "unknown" ${version}
@ -61,8 +62,10 @@ stdenv.mkDerivation rec {
++ optional (ngspiceSupport) "-DKICAD_SPICE=ON"
++ optionals (withOCE)
[ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade}" ]
++ optionals (withOCC)
[ "-DKICAD_USE_OCC=ON" "-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade" ]
++ optionals (withOCC) [
"-DKICAD_USE_OCC=ON"
"-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade"
]
++ optionals (debug) [
"-DCMAKE_BUILD_TYPE=Debug"
"-DKICAD_STDLIB_DEBUG=ON"
@ -106,7 +109,7 @@ stdenv.mkDerivation rec {
"--prefix XDG_DATA_DIRS : ${gnome3.defaultIconTheme}/share"
"--prefix XDG_DATA_DIRS : ${wxGTK.gtk}/share/gsettings-schemas/${wxGTK.gtk.name}"
"--prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
# wrapGAppsHook did these, as well, no idea if it matters...
# wrapGAppsHook did these two as well, no idea if it matters...
"--prefix XDG_DATA_DIRS : ${cups}/share"
"--prefix GIO_EXTRA_MODULES : ${gnome3.dconf}/lib/gio/modules"
@ -152,9 +155,13 @@ stdenv.mkDerivation rec {
;
meta = {
description = "Free Software EDA Suite, Nightly Development Build";
description = "Open Source EDA Suite, Development Build";
homepage = "https://www.kicad-pcb.org/";
license = licenses.gpl2;
longDescription = ''
KiCad is an open source software suite for Electronic Design Automation.
The Programs handle Schematic Capture, and PCB Layout with Gerber output.
'';
license = licenses.agpl3;
maintainers = with maintainers; [ evils kiwi berce ];
platforms = with platforms; linux;
};

View File

@ -24207,7 +24207,7 @@ in
kicad-small = kicad.override { with3d = false; };
kicad-libraries = callPackage ../applications/science/electronics/kicad/libraries.nix { };
kicad-libraries = callPackages ../applications/science/electronics/kicad/libraries.nix { };
kicad-unstable = callPackage ../applications/science/electronics/kicad/unstable.nix {
# wxGTK31 currently introduces an issue with opening the python interpreter in pcbnew