kicad: fix #49089 by adding libraries files

This splits the KiCad package in several derivations:
- original package (main KiCad package)
- internationalization package
- templates
- schematic symbols libraries
- PCB footprints libraries
- 3D models libraries

From these derivations, 2 packages are exposed in top level:
- `kicad` (main KiCad package + all libraries except 3D models)
- `kicad-with-3dpackages` (kicad + all libraries)

The 3D models can also be installed separately with `kicad.packages3d`.
This prevents a new compilation of KiCad, but the user must set the
`KISYS3DMOD` environment variable or option accordingly.
This commit is contained in:
Thibaut Marty 2019-03-11 16:54:13 +01:00
parent d5f97ae600
commit 2f5439a950
2 changed files with 48 additions and 4 deletions

View File

@ -1,16 +1,31 @@
{ wxGTK, lib, stdenv, fetchurl, cmake, libGLU_combined, zlib { wxGTK, lib, stdenv, fetchurl, fetchFromGitHub, cmake, libGLU_combined, zlib
, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig , libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig
, doxygen, pcre, libpthreadstubs, libXdmcp , doxygen, pcre, libpthreadstubs, libXdmcp
, wrapGAppsHook , wrapGAppsHook
, oceSupport ? true, opencascade , oceSupport ? true, opencascade
, ngspiceSupport ? true, libngspice , ngspiceSupport ? true, libngspice
, swig, python, pythonPackages , swig, python, pythonPackages
, lndir, withLibraries ? true, with3DPackages ? false
}: }:
assert ngspiceSupport -> libngspice != null; assert ngspiceSupport -> libngspice != null;
with lib; with lib;
stdenv.mkDerivation rec { let
mkLib = version: name: sha256: stdenv.mkDerivation {
name = "kicad-${name}-${version}";
src = fetchFromGitHub {
owner = "KiCad";
repo = "kicad-${name}";
rev = "${version}";
inherit sha256 name;
};
nativeBuildInputs = [
cmake
];
};
in stdenv.mkDerivation rec {
name = "kicad-${version}"; name = "kicad-${version}";
series = "5.0"; series = "5.0";
version = "5.0.2"; version = "5.0.2";
@ -41,12 +56,13 @@ stdenv.mkDerivation rec {
pkgconfig pkgconfig
wrapGAppsHook wrapGAppsHook
pythonPackages.wrapPython pythonPackages.wrapPython
lndir
]; ];
pythonPath = [ pythonPackages.wxPython ]; pythonPath = [ pythonPackages.wxPython ];
propagatedBuildInputs = [ pythonPackages.wxPython ]; propagatedBuildInputs = [ pythonPackages.wxPython ];
buildInputs = [ buildInputs = [
libGLU_combined zlib libX11 wxGTK pcre libXdmcp gettext glew glm libpthreadstubs libGLU_combined zlib libX11 wxGTK pcre libXdmcp glew glm libpthreadstubs
cairo curl openssl boost cairo curl openssl boost
swig python swig python
] ++ optional (oceSupport) opencascade ] ++ optional (oceSupport) opencascade
@ -55,6 +71,33 @@ stdenv.mkDerivation rec {
# this breaks other applications in kicad # this breaks other applications in kicad
dontWrapGApps = true; dontWrapGApps = true;
i18n = (mkLib version "i18n" "1hkc240gymhmyv6r858mq5d2slz0vjqc47ah8wn82vvmb83fpnjy").overrideAttrs (_: {
buildInputs = [
gettext
];
});
symbols = mkLib version "symbols" "1rjh2pjcrc3bhcgyyskj5pssm7vffrjk0ymwr70fb7sjpmk96yjk";
footprints = mkLib version "footprints" "19khqyrbrqsdzxvm1b1vxfscxhss705fqky0ilrbvnbvf27fnx8w";
templates = mkLib version "templates" "0rlzq1n09n0sf2kj5c9bvbnkvs6cpycjxmxwcswql0fbpcp0sql7";
packages3d = (mkLib version "packages3d" "135jyrljgknnv2y35skhnwcxg16yxxkfbcx07nad3vr4r76zk3am").overrideAttrs (_: {
hydraPlatforms = []; # Disable big package3d library
preferLocalBuild = true;
});
postInstall = ''
lndir -silent $i18n/share $out/share
'' + optionalString withLibraries ''
lndir -silent $symbols/share $out/share
lndir -silent $footprints/share $out/share
lndir -silent $templates/share $out/share
'' + optionalString with3DPackages ''
lndir -silent $packages3d/share $out/share
'';
preFixup = '' preFixup = ''
buildPythonPath "$out $pythonPath" buildPythonPath "$out $pythonPath"
gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH") gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH")
@ -65,7 +108,7 @@ stdenv.mkDerivation rec {
meta = { meta = {
description = "Free Software EDA Suite"; description = "Free Software EDA Suite";
homepage = http://www.kicad-pcb.org/; homepage = http://www.kicad-pcb.org/;
license = licenses.gpl2; license = [ licenses.gpl2 ] ++ optional (withLibraries || with3DPackages) licenses.cc-by-sa-40;
maintainers = with maintainers; [ berce ]; maintainers = with maintainers; [ berce ];
platforms = with platforms; linux; platforms = with platforms; linux;
}; };

View File

@ -22031,6 +22031,7 @@ in
wxGTK = wxGTK30; wxGTK = wxGTK30;
boost = boost160; boost = boost160;
}; };
kicad-with-3dpackages = kicad.override { with3DPackages = true; };
kicad-unstable = python.pkgs.callPackage ../applications/science/electronics/kicad/unstable.nix { kicad-unstable = python.pkgs.callPackage ../applications/science/electronics/kicad/unstable.nix {
wxGTK = wxGTK30; wxGTK = wxGTK30;