2020-10-16 20:44:37 +00:00
|
|
|
{ stdenv
|
2020-10-11 12:50:04 +00:00
|
|
|
, fetchFromGitLab
|
|
|
|
, cmake
|
|
|
|
, libGLU
|
|
|
|
, libGL
|
|
|
|
, zlib
|
|
|
|
, wxGTK
|
|
|
|
, libX11
|
|
|
|
, gettext
|
|
|
|
, glew
|
|
|
|
, glm
|
|
|
|
, cairo
|
|
|
|
, curl
|
|
|
|
, openssl
|
|
|
|
, boost
|
|
|
|
, pkgconfig
|
|
|
|
, doxygen
|
|
|
|
, pcre
|
|
|
|
, libpthreadstubs
|
|
|
|
, libXdmcp
|
|
|
|
, fetchpatch
|
|
|
|
, lndir
|
2020-10-16 20:44:37 +00:00
|
|
|
, callPackage
|
|
|
|
|
|
|
|
, stable
|
|
|
|
, baseName
|
|
|
|
, kicadSrc
|
|
|
|
, kicadVersion
|
|
|
|
, i18n
|
|
|
|
, withOCE
|
2020-10-11 12:50:04 +00:00
|
|
|
, opencascade
|
2020-10-16 20:44:37 +00:00
|
|
|
, withOCC
|
2020-10-11 12:50:04 +00:00
|
|
|
, opencascade-occt
|
2020-10-16 20:44:37 +00:00
|
|
|
, withNgspice
|
2020-10-11 12:50:04 +00:00
|
|
|
, libngspice
|
2020-10-16 20:44:37 +00:00
|
|
|
, withScripting
|
2020-10-11 12:50:04 +00:00
|
|
|
, swig
|
|
|
|
, python
|
|
|
|
, wxPython
|
2020-10-16 20:44:37 +00:00
|
|
|
, debug
|
2020-10-11 12:50:04 +00:00
|
|
|
, valgrind
|
2020-10-16 20:44:37 +00:00
|
|
|
, withI18n
|
2020-10-11 12:50:04 +00:00
|
|
|
, gtk3
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
assert stdenv.lib.asserts.assertMsg (!(withOCE && stdenv.isAarch64)) "OCE fails a test on Aarch64";
|
|
|
|
assert stdenv.lib.asserts.assertMsg (!(withOCC && withOCE))
|
|
|
|
"Only one of OCC and OCE may be enabled";
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
2020-10-16 20:44:37 +00:00
|
|
|
inherit (stdenv.lib) optional optionals;
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-05-15 21:57:56 +00:00
|
|
|
pname = "kicad-base";
|
2020-10-16 20:44:37 +00:00
|
|
|
version = kicadVersion;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
src = kicadSrc;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# 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";
|
|
|
|
sha256 = "00ifd3fas8lid8svzh1w67xc8kyx89qidp7gm633r014j3kjkgcd";
|
|
|
|
}
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
# tagged releases don't have "unknown"
|
|
|
|
# kicad nightlies use git describe --dirty
|
|
|
|
# nix removes .git, so its approximated here
|
2020-05-15 21:57:56 +00:00
|
|
|
# "-1" appended to indicate we're adding a patch
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMakeModules/KiCadVersion.cmake \
|
2020-05-15 21:57:56 +00:00
|
|
|
--replace "unknown" "${builtins.substring 0 10 src.rev}-1" \
|
|
|
|
--replace "${version}" "${version}-1"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = optional (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
|
|
|
|
|
|
|
|
cmakeFlags =
|
2020-10-16 20:44:37 +00:00
|
|
|
optionals (withScripting) [
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DKICAD_SCRIPTING=ON"
|
|
|
|
"-DKICAD_SCRIPTING_MODULES=ON"
|
|
|
|
"-DKICAD_SCRIPTING_PYTHON3=ON"
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON"
|
|
|
|
]
|
2020-10-16 20:44:37 +00:00
|
|
|
++ optional (!withScripting)
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DKICAD_SCRIPTING=OFF"
|
2020-10-16 20:44:37 +00:00
|
|
|
++ optional (withNgspice) "-DKICAD_SPICE=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional (!withOCE) "-DKICAD_USE_OCE=OFF"
|
|
|
|
++ optional (!withOCC) "-DKICAD_USE_OCC=OFF"
|
|
|
|
++ optionals (withOCE) [
|
|
|
|
"-DKICAD_USE_OCE=ON"
|
|
|
|
"-DOCE_DIR=${opencascade}"
|
|
|
|
]
|
|
|
|
++ optionals (withOCC) [
|
|
|
|
"-DKICAD_USE_OCC=ON"
|
|
|
|
"-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade"
|
|
|
|
]
|
|
|
|
++ optionals (debug) [
|
|
|
|
"-DCMAKE_BUILD_TYPE=Debug"
|
|
|
|
"-DKICAD_STDLIB_DEBUG=ON"
|
|
|
|
"-DKICAD_USE_VALGRIND=ON"
|
|
|
|
]
|
|
|
|
;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake doxygen pkgconfig lndir ];
|
|
|
|
|
|
|
|
buildInputs = [
|
2020-10-11 12:50:04 +00:00
|
|
|
libGLU
|
|
|
|
libGL
|
|
|
|
zlib
|
|
|
|
libX11
|
|
|
|
wxGTK
|
|
|
|
pcre
|
|
|
|
libXdmcp
|
|
|
|
gettext
|
|
|
|
glew
|
|
|
|
glm
|
|
|
|
libpthreadstubs
|
|
|
|
cairo
|
|
|
|
curl
|
|
|
|
openssl
|
|
|
|
boost
|
|
|
|
gtk3
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
2020-10-16 20:44:37 +00:00
|
|
|
++ optionals (withScripting) [ swig python wxPython ]
|
|
|
|
++ optional (withNgspice) libngspice
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional (withOCE) opencascade
|
|
|
|
++ optional (withOCC) opencascade-occt
|
|
|
|
++ optional (debug) valgrind
|
|
|
|
;
|
|
|
|
|
|
|
|
# debug builds fail all but the python test
|
|
|
|
# 5.1.x fails the eeschema test
|
|
|
|
doInstallCheck = !debug && !stable;
|
|
|
|
installCheckTarget = "test";
|
|
|
|
|
|
|
|
dontStrip = debug;
|
|
|
|
|
|
|
|
postInstall = optional (withI18n) ''
|
|
|
|
mkdir -p $out/share
|
2020-05-15 21:57:56 +00:00
|
|
|
lndir ${i18n}/share $out/share
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Just the built source without the libraries";
|
|
|
|
longDescription = ''
|
|
|
|
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/";
|
2020-10-16 20:44:37 +00:00
|
|
|
license = stdenv.lib.licenses.agpl3;
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|