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
|
2021-11-11 04:35:34 +00:00
|
|
|
, libepoxy
|
2021-04-23 04:55:43 +01:00
|
|
|
, dbus
|
|
|
|
, at-spi2-core
|
|
|
|
, libXtst
|
|
|
|
|
|
|
|
, swig
|
|
|
|
, python
|
|
|
|
, wxPython
|
|
|
|
, opencascade-occt
|
|
|
|
, libngspice
|
|
|
|
, valgrind
|
|
|
|
|
2020-10-10 22:44:56 +01:00
|
|
|
, stable
|
|
|
|
, baseName
|
2020-10-11 00:10:53 +01:00
|
|
|
, kicadSrc
|
|
|
|
, kicadVersion
|
2020-10-10 22:44:56 +01:00
|
|
|
, withOCC
|
|
|
|
, withNgspice
|
|
|
|
, withScripting
|
2021-12-23 13:52:07 +00:00
|
|
|
, withI18n
|
|
|
|
, withPCM
|
2020-10-10 22:44:56 +01:00
|
|
|
, debug
|
2021-01-23 09:58:33 +00:00
|
|
|
, sanitizeAddress
|
|
|
|
, sanitizeThreads
|
2019-11-26 11:02:49 +00:00
|
|
|
}:
|
|
|
|
|
2021-01-23 09:58:33 +00:00
|
|
|
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-12-23 13:52:07 +00:00
|
|
|
cmakeFlags = optionals (withScripting) [
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON=ON"
|
2021-04-23 04:55:43 +01:00
|
|
|
]
|
2021-06-05 12:28:53 +01:00
|
|
|
++ optionals (!withScripting) [
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON=OFF"
|
|
|
|
]
|
2021-12-25 23:55:34 +00:00
|
|
|
++ optional (!withNgspice) "-DKICAD_SPICE=OFF"
|
2021-04-23 04:55:43 +01:00
|
|
|
++ optional (!withOCC) "-DKICAD_USE_OCC=OFF"
|
|
|
|
++ 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
|
|
|
]
|
2021-12-26 00:23:07 +00:00
|
|
|
++ optionals (!doInstallCheck) [
|
|
|
|
"-DKICAD_BUILD_QA_TESTS=OFF"
|
|
|
|
]
|
2021-01-23 09:58:33 +00:00
|
|
|
++ optionals (sanitizeAddress) [
|
|
|
|
"-DKICAD_SANITIZE_ADDRESS=ON"
|
|
|
|
]
|
|
|
|
++ optionals (sanitizeThreads) [
|
|
|
|
"-DKICAD_SANITIZE_THREADS=ON"
|
2021-12-23 13:52:07 +00:00
|
|
|
]
|
|
|
|
++ optionals (withI18n) [
|
|
|
|
"-DKICAD_BUILD_I18N=ON"
|
|
|
|
]
|
2022-01-03 13:36:12 +00:00
|
|
|
++ optionals (!withPCM && stable) [
|
2021-12-23 13:52:07 +00:00
|
|
|
"-DKICAD_PCM=OFF"
|
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
|
2021-11-11 04:35:34 +00:00
|
|
|
libepoxy
|
2021-04-23 04:55:43 +01:00
|
|
|
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
|
2021-12-23 13:52:07 +00:00
|
|
|
swig
|
|
|
|
python
|
2019-11-26 11:02:49 +00:00
|
|
|
]
|
2021-06-05 12:28:53 +01:00
|
|
|
++ optional (withScripting) wxPython
|
2020-10-10 22:44:56 +01:00
|
|
|
++ optional (withNgspice) libngspice
|
2019-11-26 11:02:49 +00:00
|
|
|
++ optional (withOCC) opencascade-occt
|
|
|
|
++ optional (debug) valgrind
|
|
|
|
;
|
|
|
|
|
|
|
|
# debug builds fail all but the python test
|
2021-12-27 04:45:34 +00:00
|
|
|
#doInstallCheck = !debug;
|
|
|
|
# temporarily disabled until upstream issue 9888 is resolved
|
|
|
|
doInstallCheck = false;
|
2019-11-26 11:02:49 +00:00
|
|
|
installCheckTarget = "test";
|
|
|
|
|
|
|
|
dontStrip = debug;
|
|
|
|
|
|
|
|
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 = ''
|
2021-12-23 13:25:32 +00:00
|
|
|
Just the build products, the libraries are passed via an env var in the wrapper, default.nix
|
2019-11-26 11:02:49 +00:00
|
|
|
'';
|
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
|
|
|
};
|
|
|
|
}
|