2021-02-22 01:15:05 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-09 03:47:55 +02:00
|
|
|
, cmake
|
|
|
|
, libGLU
|
|
|
|
, libGL
|
|
|
|
, zlib
|
|
|
|
, wxGTK
|
|
|
|
, libX11
|
|
|
|
, gettext
|
|
|
|
, glew
|
|
|
|
, glm
|
|
|
|
, cairo
|
|
|
|
, curl
|
|
|
|
, openssl
|
|
|
|
, boost
|
2021-01-19 07:50:56 +01:00
|
|
|
, pkg-config
|
2020-10-09 03:47:55 +02:00
|
|
|
, doxygen
|
|
|
|
, pcre
|
|
|
|
, libpthreadstubs
|
|
|
|
, libXdmcp
|
|
|
|
, lndir
|
2019-11-26 12:02:49 +01:00
|
|
|
|
2020-10-10 23:44:56 +02:00
|
|
|
, stable
|
|
|
|
, baseName
|
2020-10-11 01:10:53 +02:00
|
|
|
, kicadSrc
|
|
|
|
, kicadVersion
|
|
|
|
, i18n
|
2020-10-10 23:44:56 +02:00
|
|
|
, withOCE
|
2020-10-09 03:47:55 +02:00
|
|
|
, opencascade
|
2020-10-10 23:44:56 +02:00
|
|
|
, withOCC
|
2020-10-09 03:47:55 +02:00
|
|
|
, opencascade-occt
|
2020-10-10 23:44:56 +02:00
|
|
|
, withNgspice
|
2020-10-09 03:47:55 +02:00
|
|
|
, libngspice
|
2020-10-10 23:44:56 +02:00
|
|
|
, withScripting
|
2020-10-09 03:47:55 +02:00
|
|
|
, swig
|
|
|
|
, python
|
|
|
|
, wxPython
|
2020-10-10 23:44:56 +02:00
|
|
|
, debug
|
2020-10-09 03:47:55 +02:00
|
|
|
, valgrind
|
2020-10-10 23:44:56 +02:00
|
|
|
, withI18n
|
2020-10-09 03:47:55 +02:00
|
|
|
, gtk3
|
2019-11-26 12:02:49 +01:00
|
|
|
}:
|
|
|
|
|
2021-01-15 14:21:58 +01:00
|
|
|
assert lib.asserts.assertMsg (!(withOCE && stdenv.isAarch64)) "OCE fails a test on Aarch64";
|
|
|
|
assert lib.asserts.assertMsg (!(withOCC && withOCE))
|
2020-10-10 23:44:56 +02:00
|
|
|
"Only one of OCC and OCE may be enabled";
|
2019-11-26 12:02:49 +01:00
|
|
|
let
|
2021-01-15 14:21:58 +01:00
|
|
|
inherit (lib) optional optionals;
|
2019-11-26 12:02:49 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-03-30 06:13:59 +02:00
|
|
|
pname = "kicad-base";
|
2020-10-11 01:10:53 +02:00
|
|
|
version = kicadVersion;
|
2019-11-26 12:02:49 +01:00
|
|
|
|
2020-10-11 01:10:53 +02:00
|
|
|
src = kicadSrc;
|
2019-11-26 12:02:49 +01:00
|
|
|
|
|
|
|
# tagged releases don't have "unknown"
|
2019-12-15 12:26:23 +01:00
|
|
|
# kicad nightlies use git describe --dirty
|
|
|
|
# nix removes .git, so its approximated here
|
2020-03-28 01:39:57 +01:00
|
|
|
# "-1" appended to indicate we're adding a patch
|
2019-12-15 12:26:23 +01:00
|
|
|
postPatch = ''
|
2019-11-26 12:02:49 +01:00
|
|
|
substituteInPlace CMakeModules/KiCadVersion.cmake \
|
2020-03-28 01:39:57 +01:00
|
|
|
--replace "unknown" "${builtins.substring 0 10 src.rev}-1" \
|
|
|
|
--replace "${version}" "${version}-1"
|
2019-11-26 12:02:49 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = optional (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
|
|
|
|
|
|
|
|
cmakeFlags =
|
2020-10-10 23:44:56 +02:00
|
|
|
optionals (withScripting) [
|
2019-11-26 12:02:49 +01:00
|
|
|
"-DKICAD_SCRIPTING=ON"
|
|
|
|
"-DKICAD_SCRIPTING_MODULES=ON"
|
|
|
|
"-DKICAD_SCRIPTING_PYTHON3=ON"
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON"
|
|
|
|
]
|
2020-10-10 23:44:56 +02:00
|
|
|
++ optional (!withScripting)
|
2019-11-26 12:02:49 +01:00
|
|
|
"-DKICAD_SCRIPTING=OFF"
|
2020-10-10 23:44:56 +02:00
|
|
|
++ optional (withNgspice) "-DKICAD_SPICE=ON"
|
2019-11-26 12:02:49 +01:00
|
|
|
++ optional (!withOCE) "-DKICAD_USE_OCE=OFF"
|
|
|
|
++ optional (!withOCC) "-DKICAD_USE_OCC=OFF"
|
2019-12-15 04:30:15 +01:00
|
|
|
++ optionals (withOCE) [
|
|
|
|
"-DKICAD_USE_OCE=ON"
|
|
|
|
"-DOCE_DIR=${opencascade}"
|
|
|
|
]
|
2019-11-26 12:02:49 +01:00
|
|
|
++ 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"
|
|
|
|
]
|
|
|
|
;
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ cmake doxygen pkg-config lndir ];
|
2019-11-26 12:02:49 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
2020-10-09 03:47:55 +02:00
|
|
|
libGLU
|
|
|
|
libGL
|
|
|
|
zlib
|
|
|
|
libX11
|
|
|
|
wxGTK
|
|
|
|
pcre
|
|
|
|
libXdmcp
|
|
|
|
gettext
|
|
|
|
glew
|
|
|
|
glm
|
|
|
|
libpthreadstubs
|
|
|
|
cairo
|
|
|
|
curl
|
|
|
|
openssl
|
|
|
|
boost
|
|
|
|
gtk3
|
2019-11-26 12:02:49 +01:00
|
|
|
]
|
2020-10-10 23:44:56 +02:00
|
|
|
++ optionals (withScripting) [ swig python wxPython ]
|
|
|
|
++ optional (withNgspice) libngspice
|
2019-11-26 12:02:49 +01: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-03-30 06:13:59 +02:00
|
|
|
lndir ${i18n}/share $out/share
|
2019-11-26 12:02:49 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2019-12-15 12:26:23 +01:00
|
|
|
description = "Just the built source without the libraries";
|
2019-11-26 12:02:49 +01:00
|
|
|
longDescription = ''
|
2019-12-15 12:26:23 +01:00
|
|
|
Just the build products, optionally with the i18n linked in
|
2019-11-26 12:02:49 +01:00
|
|
|
the libraries are passed via an env var in the wrapper, default.nix
|
|
|
|
'';
|
|
|
|
homepage = "https://www.kicad-pcb.org/";
|
2021-01-15 14:21:58 +01:00
|
|
|
license = lib.licenses.agpl3;
|
|
|
|
platforms = lib.platforms.all;
|
2019-11-26 12:02:49 +01:00
|
|
|
};
|
|
|
|
}
|