1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 15:11:35 +00:00

kicad: update & cleanup

minor simplification, fix base version

split i18n and get from gitlab

correct wrapper pythonpath, cleanup build output

update & fake git describe

correct base.nix to fit contributing.md
This commit is contained in:
Evils 2019-12-15 12:26:23 +01:00
parent 6119ca27bb
commit e4786f3a1c
4 changed files with 76 additions and 54 deletions

View file

@ -11,7 +11,6 @@
, ngspiceSupport ? true, libngspice
, scriptingSupport ? true, swig, python, pythonPackages, wxPython
, debug ? false, valgrind
, with3d ? true
, withI18n ? true
}:
@ -56,10 +55,11 @@ stdenv.mkDerivation rec {
];
# tagged releases don't have "unknown"
postPatch = optional (!stable)
''
# kicad nightlies use git describe --dirty
# nix removes .git, so its approximated here
postPatch = ''
substituteInPlace CMakeModules/KiCadVersion.cmake \
--replace "unknown" ${baseVersion}
--replace "unknown" ${builtins.substring 0 10 src.rev}
'';
makeFlags = optional (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
@ -117,9 +117,9 @@ stdenv.mkDerivation rec {
'';
meta = {
description = "just the built source without the libraries";
description = "Just the built source without the libraries";
longDescription = ''
just the build products, optionally with the i18n linked in
Just the build products, optionally with the i18n linked in
the libraries are passed via an env var in the wrapper, default.nix
'';
homepage = "https://www.kicad-pcb.org/";

View file

@ -19,6 +19,7 @@ with lib;
let
stable = pname != "kicad-unstable";
baseName = if (stable) then "kicad" else "kicad-unstable";
versions = {
"kicad" = {
@ -39,30 +40,30 @@ let
};
"kicad-unstable" = {
kicadVersion = {
version = "2019-12-15";
version = "2019-12-31";
src = {
rev = "1abb198fb42c68ab8dd8ce6ff97d984df6688e10";
sha256 = "1b7k05bl2w4by5bhk6sfb2iynddlg3gah8qma7l9am6q1j3lmx4p";
rev = "eaaa4eb63acb289047dfbb6cc275579dea58f12b";
sha256 = "1v2hf2slphjdh14y56pmzlpi6mqidrd8198if1fi0cch72v37zch";
};
};
libVersion = {
version = "unstable";
libSources = {
i18n.rev = "f1084526305005fa53e78000f7db2d67e8a0d423";
i18n.sha256 = "1yhc0m4psx0rz5msb1zqn5fz6l1ynwykrsk1443g4073lmjibv74";
symbols.rev = "68176b08fdfd34673f4518ef6c331ad2ecf7a9a6";
symbols.sha256 = "0kcn8pwdac5snd6vzmdw82k5x9q12nijpdss3nvi5my6g3ilwgjj";
i18n.rev = "e7439fd76f27cfc26e269c4e6c4d56245345c28b";
i18n.sha256 = "1nqm1kx5b4f7s0f9q8bg4rdhqnp0128yp6bgnrkia1kwmfnf5gmy";
symbols.rev = "1bc5ff11c76bcbfda227e534b0acf737edddde8f";
symbols.sha256 = "05kv93790wi4dpbn2488p587b83yz1zw9h62lkv41h7vn2r1mmb7";
templates.rev = "0c0490897f803ab8b7c3dad438b7eb1f80e0417c";
templates.sha256 = "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g";
footprints.rev = "8cef00a34078c3dabe943a76f9cdf7d05ffc38fc";
footprints.sha256 = "0aplxxbcyb4vpj3kpcnj6lbnpk9zjql46js9i4iaqs388z93sb97";
packages3d.rev = "58d73640ebb764637eb7bba6290815b84a24b8ad";
packages3d.sha256 = "0cff2ms1bsw530kqb1fr1m2pjixyxzwa81mxgac3qpbcf8fnpvaz";
footprints.rev = "454126c125edd3fa8633f301421a7d9c4de61b77";
footprints.sha256 = "00nli4kx2i68bk852rivbirzcgpsdlpdk34g1q892952jsbh7fy6";
packages3d.rev = "c2b92a411adc93ddeeed74b36b542e1057f81a2a";
packages3d.sha256 = "05znc6y2lc31iafspg308cxdda94zg6c7mwslmys76npih1pb8qc";
};
};
};
};
versionConfig = versions.${if (stable) then "kicad" else "kicad-unstable"};
versionConfig = versions.${baseName};
wxGTK = if (stable)
# wxGTK3x may default to withGtk2 = false, see #73145
@ -77,19 +78,23 @@ let
kicad-libraries = callPackages ./libraries.nix versionConfig.libVersion;
kicad-base = callPackage ./base.nix {
pname = if (stable) then "kicad" else "kicad-unstable";
inherit versions stable;
inherit wxGTK python wxPython;
inherit debug with3d withI18n withOCCT oceSupport ngspiceSupport scriptingSupport;
pname = baseName;
inherit versions stable baseName;
inherit wxGTK python wxPython;
inherit debug withI18n withOCCT oceSupport ngspiceSupport scriptingSupport;
};
in
stdenv.mkDerivation rec {
inherit pname;
version = versions.${if (stable) then "kicad" else "kicad-unstable"}.kicadVersion.version;
version = versions.${baseName}.kicadVersion.version;
src = kicad-base;
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
dontFixup = true;
pythonPath = optionals (scriptingSupport)
[ wxPython pythonPackages.six ];
@ -115,8 +120,8 @@ stdenv.mkDerivation rec {
"--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" ]
++ optionals (ngspiceSupport) [ "--prefix LD_LIBRARY_PATH : ${libngspice}/lib" ]
# infinisil's workaround for #39493
++ [ "--set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]
@ -127,7 +132,7 @@ stdenv.mkDerivation rec {
# not sure if anything has to be done with the other stuff in kicad-base/bin
# dxf2idf, idf2vrml, idfcyl, idfrect, kicad2step, kicad-ogltest
installPhase =
optionalString (scriptingSupport) '' buildPythonPath "$out $pythonPath"
optionalString (scriptingSupport) '' buildPythonPath "${kicad-base} $pythonPath"
'' +
'' makeWrapper ${kicad-base}/bin/kicad $out/bin/kicad $makeWrapperArgs ''
+ optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH"

View file

@ -1,6 +1,6 @@
{ lib, stdenv, fetchFromGitHub, cmake, gettext
, version
, libSources
{ lib, stdenv, cmake, gettext
, fetchFromGitHub, fetchFromGitLab
, version, libSources
}:
# callPackage libraries {
@ -13,33 +13,52 @@
with lib;
let
mkLib = name: attrs:
stdenv.mkDerivation ({
name = "kicad-${name}-${version}";
src = fetchFromGitHub ({
owner = "KiCad";
repo = "kicad-${name}";
rev = version;
inherit name;
} // (libSources.${name} or {}));
nativeBuildInputs = [ cmake ];
} // attrs);
stdenv.mkDerivation (
{
pname = "kicad-${name}";
version = "${version}";
src = fetchFromGitHub (
{
owner = "KiCad";
repo = "kicad-${name}";
rev = version;
inherit name;
} // (libSources.${name} or { })
);
nativeBuildInputs = [ cmake ];
meta.license = licenses.cc-by-sa-40;
} // attrs
);
in
{
symbols = mkLib "symbols" {
meta.license = licenses.cc-by-sa-40;
};
templates = mkLib "templates" {
meta.license = licenses.cc-by-sa-40;
};
footprints = mkLib "footprints" {
meta.license = licenses.cc-by-sa-40;
};
i18n = mkLib "i18n" {
buildInputs = [ gettext ];
meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3
};
symbols = mkLib "symbols" { };
templates = mkLib "templates" { };
footprints = mkLib "footprints" { };
packages3d = mkLib "packages3d" {
hydraPlatforms = []; # this is a ~1 GiB download, occupies ~5 GiB in store
meta.license = licenses.cc-by-sa-40;
};
# i18n is a special case, not actually a library
# more a part of kicad proper, but also optional and separate
# since their move to gitlab they're keeping it in a separate path
# kicad has no way to find i18n except through a path relative to its install path
# therefore this is being linked into ${kicad-base}/share/
# and defined here to make use of the rev & sha256's brought here for the libs
i18n = let name = "i18n"; in
stdenv.mkDerivation {
pname = "kicad-${name}";
version = "${version}";
src = fetchFromGitLab (
{
group = "kicad";
owner = "code";
repo = "kicad-${name}";
rev = version;
inherit name;
} // (libSources.${name} or { })
);
buildInputs = [ gettext ];
nativeBuildInputs = [ cmake ];
meta.license = licenses.gpl2; # https://github.com/KiCad/kicad-i18n/issues/3
};
}

View file

@ -24199,9 +24199,7 @@ in
fped = callPackage ../applications/science/electronics/fped { };
kicad = callPackage ../applications/science/electronics/kicad { };
kicad-small = kicad.override { pname = "kicad-small"; with3d = false; };
kicad-unstable = kicad.override { pname = "kicad-unstable"; debug = true; };
librepcb = libsForQt5.callPackage ../applications/science/electronics/librepcb { };