2021-02-24 18:30:23 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-11 12:50:04 +00:00
|
|
|
, cmake
|
|
|
|
, libGLU
|
|
|
|
, libGL
|
|
|
|
, zlib
|
|
|
|
, wxGTK
|
2022-10-30 15:09:59 +00:00
|
|
|
, gtk3
|
2020-10-11 12:50:04 +00:00
|
|
|
, libX11
|
|
|
|
, gettext
|
|
|
|
, glew
|
|
|
|
, glm
|
|
|
|
, cairo
|
|
|
|
, curl
|
|
|
|
, openssl
|
|
|
|
, boost
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-10-11 12:50:04 +00:00
|
|
|
, doxygen
|
2021-05-20 23:08:51 +00:00
|
|
|
, graphviz
|
2020-10-11 12:50:04 +00:00
|
|
|
, pcre
|
|
|
|
, libpthreadstubs
|
|
|
|
, libXdmcp
|
2022-09-30 11:47:45 +00:00
|
|
|
, unixODBC
|
2020-10-16 20:44:37 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
, util-linux
|
|
|
|
, libselinux
|
|
|
|
, libsepol
|
|
|
|
, libthai
|
|
|
|
, libdatrie
|
|
|
|
, libxkbcommon
|
2021-12-06 16:07:01 +00:00
|
|
|
, libepoxy
|
2021-05-20 23:08:51 +00:00
|
|
|
, dbus
|
|
|
|
, at-spi2-core
|
|
|
|
, libXtst
|
2022-12-28 21:21:41 +00:00
|
|
|
, pcre2
|
2023-02-16 17:41:37 +00:00
|
|
|
, libdeflate
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
, swig4
|
2021-05-20 23:08:51 +00:00
|
|
|
, python
|
|
|
|
, wxPython
|
|
|
|
, opencascade-occt
|
|
|
|
, libngspice
|
|
|
|
, valgrind
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
, stable
|
|
|
|
, baseName
|
|
|
|
, kicadSrc
|
|
|
|
, kicadVersion
|
|
|
|
, withNgspice
|
|
|
|
, withScripting
|
2021-12-30 13:39:12 +00:00
|
|
|
, withI18n
|
2020-10-16 20:44:37 +00:00
|
|
|
, debug
|
2021-05-20 23:08:51 +00:00
|
|
|
, sanitizeAddress
|
|
|
|
, sanitizeThreads
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads))
|
|
|
|
"'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
2021-08-22 07:53:02 +00:00
|
|
|
inherit (lib) optional optionals optionalString;
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-05-15 21:57:56 +00:00
|
|
|
pname = "kicad-base";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = if (stable) then kicadVersion else builtins.substring 0 10 src.rev;
|
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
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
patches = [
|
|
|
|
# upstream issue 12941 (attempted to upstream, but appreciably unacceptable)
|
|
|
|
./writable.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# tagged releases don't have "unknown"
|
|
|
|
# kicad nightlies use git describe --dirty
|
|
|
|
# nix removes .git, so its approximated here
|
2023-02-16 17:41:37 +00:00
|
|
|
postPatch = lib.optionalString (!stable) ''
|
2022-09-30 11:47:45 +00:00
|
|
|
substituteInPlace cmake/KiCadVersion.cmake \
|
|
|
|
--replace "unknown" "${builtins.substring 0 10 src.rev}"
|
2023-02-16 17:41:37 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
# some ngspice tests attempt to write to $HOME/.cache/
|
|
|
|
XDG_CACHE_HOME = "$TMP";
|
|
|
|
# failing tests still attempt to create $HOME though
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
cmakeFlags = [
|
2022-09-30 11:47:45 +00:00
|
|
|
"-DKICAD_USE_EGL=ON"
|
2023-04-12 12:48:02 +00:00
|
|
|
"-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade"
|
|
|
|
]
|
|
|
|
++ optionals (stable) [
|
|
|
|
# https://gitlab.com/kicad/code/kicad/-/issues/12491
|
|
|
|
# should be resolved in the next release
|
|
|
|
"-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;qa_eeschema'"
|
2022-08-12 12:06:08 +00:00
|
|
|
]
|
2023-04-12 12:48:02 +00:00
|
|
|
++ optional (stable && !withNgspice) "-DKICAD_SPICE=OFF"
|
2021-07-14 22:03:04 +00:00
|
|
|
++ optionals (!withScripting) [
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON=OFF"
|
|
|
|
]
|
2023-04-12 12:48:02 +00:00
|
|
|
++ optionals (withI18n) [
|
|
|
|
"-DKICAD_BUILD_I18N=ON"
|
|
|
|
]
|
|
|
|
++ optionals (!doInstallCheck) [
|
|
|
|
"-DKICAD_BUILD_QA_TESTS=OFF"
|
2021-05-20 23:08:51 +00:00
|
|
|
]
|
|
|
|
++ optionals (debug) [
|
|
|
|
"-DCMAKE_BUILD_TYPE=Debug"
|
|
|
|
"-DKICAD_STDLIB_DEBUG=ON"
|
|
|
|
"-DKICAD_USE_VALGRIND=ON"
|
|
|
|
]
|
|
|
|
++ optionals (sanitizeAddress) [
|
|
|
|
"-DKICAD_SANITIZE_ADDRESS=ON"
|
|
|
|
]
|
|
|
|
++ optionals (sanitizeThreads) [
|
|
|
|
"-DKICAD_SANITIZE_THREADS=ON"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
doxygen
|
|
|
|
graphviz
|
|
|
|
pkg-config
|
|
|
|
]
|
|
|
|
# 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
|
2021-12-06 16:07:01 +00:00
|
|
|
libepoxy
|
2022-12-02 08:20:57 +00:00
|
|
|
dbus
|
2021-05-20 23:08:51 +00:00
|
|
|
at-spi2-core
|
|
|
|
libXtst
|
2022-12-28 21:21:41 +00:00
|
|
|
pcre2
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2020-10-11 12:50:04 +00:00
|
|
|
libGLU
|
|
|
|
libGL
|
|
|
|
zlib
|
|
|
|
libX11
|
|
|
|
wxGTK
|
2022-10-30 15:09:59 +00:00
|
|
|
gtk3
|
2020-10-11 12:50:04 +00:00
|
|
|
pcre
|
|
|
|
libXdmcp
|
|
|
|
gettext
|
|
|
|
glew
|
|
|
|
glm
|
|
|
|
libpthreadstubs
|
|
|
|
cairo
|
|
|
|
curl
|
|
|
|
openssl
|
|
|
|
boost
|
2022-09-30 11:47:45 +00:00
|
|
|
swig4
|
2021-12-30 13:39:12 +00:00
|
|
|
python
|
2023-02-16 17:41:37 +00:00
|
|
|
unixODBC
|
|
|
|
libdeflate
|
2023-04-12 12:48:02 +00:00
|
|
|
opencascade-occt
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
2021-07-14 22:03:04 +00:00
|
|
|
++ optional (withScripting) wxPython
|
2020-10-16 20:44:37 +00:00
|
|
|
++ optional (withNgspice) libngspice
|
2022-12-28 21:21:41 +00:00
|
|
|
++ optional (debug) valgrind;
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# debug builds fail all but the python test
|
2022-12-28 21:21:41 +00:00
|
|
|
doInstallCheck = !(debug);
|
2020-04-24 23:36:52 +00:00
|
|
|
installCheckTarget = "test";
|
|
|
|
|
|
|
|
dontStrip = debug;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Just the built source without the libraries";
|
|
|
|
longDescription = ''
|
2021-12-30 13:39:12 +00:00
|
|
|
Just the build products, the libraries are passed via an env var in the wrapper, default.nix
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2021-10-17 09:34:42 +00:00
|
|
|
homepage = "https://www.kicad.org/";
|
2021-01-17 00:15:33 +00:00
|
|
|
license = lib.licenses.agpl3;
|
|
|
|
platforms = lib.platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|