2021-02-22 00:15:05 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-09 02:47:55 +01:00
|
|
|
, cmake
|
|
|
|
, libGLU
|
|
|
|
, libGL
|
|
|
|
, zlib
|
|
|
|
, wxGTK
|
|
|
|
, libX11
|
|
|
|
, gettext
|
|
|
|
, glew
|
|
|
|
, glm
|
|
|
|
, cairo
|
|
|
|
, curl
|
|
|
|
, openssl
|
|
|
|
, boost
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2020-10-09 02:47:55 +01:00
|
|
|
, doxygen
|
2021-04-23 04:55:43 +01:00
|
|
|
, graphviz
|
2020-10-09 02:47:55 +01:00
|
|
|
, pcre
|
|
|
|
, libpthreadstubs
|
|
|
|
, libXdmcp
|
|
|
|
, lndir
|
2019-11-26 11:02:49 +00:00
|
|
|
|
2021-04-23 04:55:43 +01:00
|
|
|
, util-linux
|
|
|
|
, libselinux
|
|
|
|
, libsepol
|
|
|
|
, libthai
|
|
|
|
, libdatrie
|
|
|
|
, libxkbcommon
|
|
|
|
, epoxy
|
|
|
|
, dbus
|
|
|
|
, at-spi2-core
|
|
|
|
, libXtst
|
|
|
|
|
|
|
|
, swig
|
|
|
|
, python
|
|
|
|
, wxPython
|
|
|
|
, opencascade
|
|
|
|
, opencascade-occt
|
|
|
|
, libngspice
|
|
|
|
, valgrind
|
|
|
|
|
2020-10-10 22:44:56 +01:00
|
|
|
, stable
|
|
|
|
, baseName
|
2020-10-11 00:10:53 +01:00
|
|
|
, kicadSrc
|
|
|
|
, kicadVersion
|
|
|
|
, i18n
|
2020-10-10 22:44:56 +01:00
|
|
|
, withOCE
|
|
|
|
, withOCC
|
|
|
|
, withNgspice
|
|
|
|
, withScripting
|
|
|
|
, debug
|
2021-01-23 09:58:33 +00:00
|
|
|
, sanitizeAddress
|
|
|
|
, sanitizeThreads
|
2020-10-10 22:44:56 +01:00
|
|
|
, withI18n
|
2019-11-26 11:02:49 +00:00
|
|
|
}:
|
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
assert lib.asserts.assertMsg (!(withOCE && stdenv.isAarch64)) "OCE fails a test on Aarch64";
|
|
|
|
assert lib.asserts.assertMsg (!(withOCC && withOCE))
|
2020-10-10 22:44:56 +01:00
|
|
|
"Only one of OCC and OCE may be enabled";
|
2021-01-23 09:58:33 +00:00
|
|
|
assert lib.assertMsg (!(stable && (sanitizeAddress || sanitizeThreads)))
|
|
|
|
"Only kicad-unstable(-small) supports address/thread sanitation";
|
|
|
|
assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads))
|
|
|
|
"'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
|
2021-06-05 12:28:53 +01:00
|
|
|
|
2019-11-26 11:02:49 +00:00
|
|
|
let
|
2021-08-18 01:14:20 +01:00
|
|
|
inherit (lib) optional optionals optionalString;
|
2019-11-26 11:02:49 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-03-30 05:13:59 +01:00
|
|
|
pname = "kicad-base";
|
2021-04-07 06:39:58 +01:00
|
|
|
version = if (stable) then kicadVersion else builtins.substring 0 10 src.rev;
|
2019-11-26 11:02:49 +00:00
|
|
|
|
2020-10-11 00:10:53 +01:00
|
|
|
src = kicadSrc;
|
2019-11-26 11:02:49 +00:00
|
|
|
|
|
|
|
# tagged releases don't have "unknown"
|
2019-12-15 11:26:23 +00:00
|
|
|
# kicad nightlies use git describe --dirty
|
|
|
|
# nix removes .git, so its approximated here
|
|
|
|
postPatch = ''
|
2019-11-26 11:02:49 +00:00
|
|
|
substituteInPlace CMakeModules/KiCadVersion.cmake \
|
2021-04-23 04:55:43 +01:00
|
|
|
--replace "unknown" "${builtins.substring 0 10 src.rev}" \
|
2019-11-26 11:02:49 +00:00
|
|
|
'';
|
|
|
|
|
2021-04-23 04:55:43 +01:00
|
|
|
makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
|
2019-11-26 11:02:49 +00:00
|
|
|
|
2021-06-05 12:28:53 +01:00
|
|
|
cmakeFlags = optionals (stable && withScripting) [
|
2021-04-23 04:55:43 +01:00
|
|
|
"-DKICAD_SCRIPTING=ON"
|
|
|
|
"-DKICAD_SCRIPTING_MODULES=ON"
|
|
|
|
"-DKICAD_SCRIPTING_PYTHON3=ON"
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON"
|
|
|
|
]
|
2021-06-05 12:28:53 +01:00
|
|
|
++ optionals (!withScripting) [
|
2021-04-23 04:55:43 +01:00
|
|
|
"-DKICAD_SCRIPTING=OFF"
|
2021-06-05 12:28:53 +01:00
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON=OFF"
|
|
|
|
]
|
2021-04-23 04:55:43 +01:00
|
|
|
++ optional (withNgspice) "-DKICAD_SPICE=ON"
|
|
|
|
++ 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"
|
2021-01-23 09:58:33 +00:00
|
|
|
]
|
|
|
|
++ optionals (sanitizeAddress) [
|
|
|
|
"-DKICAD_SANITIZE_ADDRESS=ON"
|
|
|
|
]
|
|
|
|
++ optionals (sanitizeThreads) [
|
|
|
|
"-DKICAD_SANITIZE_THREADS=ON"
|
2021-04-23 04:55:43 +01:00
|
|
|
];
|
2019-11-26 11:02:49 +00:00
|
|
|
|
2021-04-23 04:55:43 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
doxygen
|
|
|
|
graphviz
|
|
|
|
pkg-config
|
|
|
|
lndir
|
|
|
|
]
|
|
|
|
# wanted by configuration on linux, doesn't seem to affect performance
|
|
|
|
# no effect on closure size
|
|
|
|
++ optionals (stdenv.isLinux) [
|
|
|
|
util-linux
|
|
|
|
libselinux
|
|
|
|
libsepol
|
|
|
|
libthai
|
|
|
|
libdatrie
|
|
|
|
libxkbcommon
|
|
|
|
epoxy
|
|
|
|
dbus.daemon
|
|
|
|
at-spi2-core
|
|
|
|
libXtst
|
|
|
|
];
|
2019-11-26 11:02:49 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2020-10-09 02:47:55 +01:00
|
|
|
libGLU
|
|
|
|
libGL
|
|
|
|
zlib
|
|
|
|
libX11
|
|
|
|
wxGTK
|
2021-04-23 04:55:43 +01:00
|
|
|
wxGTK.gtk
|
2020-10-09 02:47:55 +01:00
|
|
|
pcre
|
|
|
|
libXdmcp
|
|
|
|
gettext
|
|
|
|
glew
|
|
|
|
glm
|
|
|
|
libpthreadstubs
|
|
|
|
cairo
|
|
|
|
curl
|
|
|
|
openssl
|
|
|
|
boost
|
2019-11-26 11:02:49 +00:00
|
|
|
]
|
2021-06-05 12:28:53 +01:00
|
|
|
# unstable requires swig and python
|
|
|
|
# wxPython still optional
|
|
|
|
++ optionals (withScripting || (!stable)) [ swig python ]
|
|
|
|
++ optional (withScripting) wxPython
|
2020-10-10 22:44:56 +01:00
|
|
|
++ optional (withNgspice) libngspice
|
2019-11-26 11:02:49 +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;
|
|
|
|
|
2021-08-18 01:14:20 +01:00
|
|
|
postInstall = optionalString (withI18n) ''
|
2019-11-26 11:02:49 +00:00
|
|
|
mkdir -p $out/share
|
2020-03-30 05:13:59 +01:00
|
|
|
lndir ${i18n}/share $out/share
|
2019-11-26 11:02:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2019-12-15 11:26:23 +00:00
|
|
|
description = "Just the built source without the libraries";
|
2019-11-26 11:02:49 +00:00
|
|
|
longDescription = ''
|
2019-12-15 11:26:23 +00:00
|
|
|
Just the build products, optionally with the i18n linked in
|
2019-11-26 11:02:49 +00:00
|
|
|
the libraries are passed via an env var in the wrapper, default.nix
|
|
|
|
'';
|
2021-10-19 22:30:31 +01:00
|
|
|
homepage = "https://www.kicad.org/";
|
2021-01-15 13:21:58 +00:00
|
|
|
license = lib.licenses.agpl3;
|
|
|
|
platforms = lib.platforms.all;
|
2019-11-26 11:02:49 +00:00
|
|
|
};
|
|
|
|
}
|