2019-03-11 15:54:13 +00:00
|
|
|
{ wxGTK, lib, stdenv, fetchurl, fetchFromGitHub, cmake, libGLU_combined, zlib
|
2018-07-26 13:47:07 +01:00
|
|
|
, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig
|
|
|
|
, doxygen, pcre, libpthreadstubs, libXdmcp
|
2018-07-31 14:37:59 +01:00
|
|
|
, wrapGAppsHook
|
2018-07-26 13:47:07 +01:00
|
|
|
, oceSupport ? true, opencascade
|
|
|
|
, ngspiceSupport ? true, libngspice
|
2018-07-31 14:44:49 +01:00
|
|
|
, swig, python, pythonPackages
|
2019-03-11 15:54:13 +00:00
|
|
|
, lndir, withLibraries ? true, with3DPackages ? false
|
2018-07-26 13:47:07 +01:00
|
|
|
}:
|
2010-08-31 09:19:28 +01:00
|
|
|
|
2018-07-26 13:47:07 +01:00
|
|
|
assert ngspiceSupport -> libngspice != null;
|
2016-03-31 03:26:54 +01:00
|
|
|
|
2018-07-26 13:47:07 +01:00
|
|
|
with lib;
|
2019-03-11 15:54:13 +00:00
|
|
|
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 {
|
2018-07-26 13:47:07 +01:00
|
|
|
name = "kicad-${version}";
|
|
|
|
series = "5.0";
|
2019-01-01 19:02:29 +00:00
|
|
|
version = "5.0.2";
|
2016-03-31 03:26:54 +01:00
|
|
|
|
2018-07-26 13:47:07 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://launchpad.net/kicad/${series}/${version}/+download/kicad-${version}.tar.xz";
|
2019-01-01 19:02:29 +00:00
|
|
|
sha256 = "10605rr10x0353n6yk2z095ydnkd1i6j1ncbq64pfxdn5vkhcd1g";
|
2018-07-26 13:47:07 +01:00
|
|
|
};
|
2016-08-25 22:11:27 +01:00
|
|
|
|
2018-07-26 13:47:07 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMakeModules/KiCadVersion.cmake \
|
|
|
|
--replace no-vcs-found ${version}
|
2010-08-31 09:19:28 +01:00
|
|
|
'';
|
2010-08-22 13:09:47 +01:00
|
|
|
|
2018-07-31 14:44:49 +01:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DKICAD_SCRIPTING=ON"
|
|
|
|
"-DKICAD_SCRIPTING_MODULES=ON"
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON=ON"
|
|
|
|
# nix installs wxPython headers in wxPython package, not in wxwidget
|
|
|
|
# as assumed. We explicitely set the header location.
|
|
|
|
"-DCMAKE_CXX_FLAGS=-I${pythonPackages.wxPython}/include/wx-3.0"
|
|
|
|
] ++ optionals (oceSupport) [ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade}" ]
|
|
|
|
++ optional (ngspiceSupport) "-DKICAD_SPICE=ON";
|
2018-07-26 13:47:07 +01:00
|
|
|
|
2018-07-31 14:37:59 +01:00
|
|
|
nativeBuildInputs = [
|
2018-08-13 00:47:02 +01:00
|
|
|
cmake
|
2018-07-31 14:37:59 +01:00
|
|
|
doxygen
|
|
|
|
pkgconfig
|
|
|
|
wrapGAppsHook
|
|
|
|
pythonPackages.wrapPython
|
2019-03-11 15:54:13 +00:00
|
|
|
lndir
|
2018-07-31 14:37:59 +01:00
|
|
|
];
|
|
|
|
pythonPath = [ pythonPackages.wxPython ];
|
|
|
|
propagatedBuildInputs = [ pythonPackages.wxPython ];
|
|
|
|
|
2018-07-26 13:47:07 +01:00
|
|
|
buildInputs = [
|
2019-03-11 15:54:13 +00:00
|
|
|
libGLU_combined zlib libX11 wxGTK pcre libXdmcp glew glm libpthreadstubs
|
2018-07-26 13:47:07 +01:00
|
|
|
cairo curl openssl boost
|
2018-07-31 14:44:49 +01:00
|
|
|
swig python
|
2018-07-26 13:47:07 +01:00
|
|
|
] ++ optional (oceSupport) opencascade
|
2018-07-31 14:44:49 +01:00
|
|
|
++ optional (ngspiceSupport) libngspice;
|
2018-07-31 14:37:59 +01:00
|
|
|
|
|
|
|
# this breaks other applications in kicad
|
|
|
|
dontWrapGApps = true;
|
|
|
|
|
2019-03-11 15:54:13 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2018-07-31 14:37:59 +01:00
|
|
|
preFixup = ''
|
|
|
|
buildPythonPath "$out $pythonPath"
|
|
|
|
gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH")
|
|
|
|
|
|
|
|
wrapProgram "$out/bin/kicad" "''${gappsWrapperArgs[@]}"
|
|
|
|
'';
|
2016-03-31 03:26:54 +01:00
|
|
|
|
2010-08-22 13:09:47 +01:00
|
|
|
meta = {
|
|
|
|
description = "Free Software EDA Suite";
|
2017-08-01 21:03:30 +01:00
|
|
|
homepage = http://www.kicad-pcb.org/;
|
2019-03-11 15:54:13 +00:00
|
|
|
license = [ licenses.gpl2 ] ++ optional (withLibraries || with3DPackages) licenses.cc-by-sa-40;
|
2018-07-26 13:47:07 +01:00
|
|
|
maintainers = with maintainers; [ berce ];
|
|
|
|
platforms = with platforms; linux;
|
2010-08-22 13:09:47 +01:00
|
|
|
};
|
|
|
|
}
|