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
|
|
|
|
, lndir
|
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-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
|
|
|
|
, withOCC
|
|
|
|
, withNgspice
|
|
|
|
, withScripting
|
2021-12-30 13:39:12 +00:00
|
|
|
, withI18n
|
|
|
|
, withPCM
|
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
|
|
|
|
|
|
|
# tagged releases don't have "unknown"
|
|
|
|
# kicad nightlies use git describe --dirty
|
|
|
|
# nix removes .git, so its approximated here
|
2022-09-30 11:47:45 +00:00
|
|
|
postPatch = if (!stable) then ''
|
|
|
|
substituteInPlace cmake/KiCadVersion.cmake \
|
|
|
|
--replace "unknown" "${builtins.substring 0 10 src.rev}"
|
|
|
|
''
|
|
|
|
else "";
|
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
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
# RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
|
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
2022-09-30 11:47:45 +00:00
|
|
|
"-DKICAD_USE_EGL=ON"
|
2022-08-12 12:06:08 +00:00
|
|
|
]
|
|
|
|
++ optionals (withScripting) [
|
2021-12-30 13:39:12 +00:00
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON=ON"
|
2021-05-20 23:08:51 +00:00
|
|
|
]
|
2021-07-14 22:03:04 +00:00
|
|
|
++ optionals (!withScripting) [
|
|
|
|
"-DKICAD_SCRIPTING_WXPYTHON=OFF"
|
|
|
|
]
|
2021-12-30 13:39:12 +00:00
|
|
|
++ optional (!withNgspice) "-DKICAD_SPICE=OFF"
|
2021-05-20 23:08:51 +00: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-12-30 13:39:12 +00:00
|
|
|
++ optionals (!doInstallCheck) [
|
|
|
|
"-DKICAD_BUILD_QA_TESTS=OFF"
|
|
|
|
]
|
2021-05-20 23:08:51 +00:00
|
|
|
++ optionals (sanitizeAddress) [
|
|
|
|
"-DKICAD_SANITIZE_ADDRESS=ON"
|
|
|
|
]
|
|
|
|
++ optionals (sanitizeThreads) [
|
|
|
|
"-DKICAD_SANITIZE_THREADS=ON"
|
2021-12-30 13:39:12 +00:00
|
|
|
]
|
|
|
|
++ optionals (withI18n) [
|
|
|
|
"-DKICAD_BUILD_I18N=ON"
|
|
|
|
]
|
2022-01-19 23:45:15 +00:00
|
|
|
++ optionals (!withPCM && stable) [
|
2021-12-30 13:39:12 +00:00
|
|
|
"-DKICAD_PCM=OFF"
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00: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-12-06 16:07:01 +00:00
|
|
|
libepoxy
|
2021-05-20 23:08:51 +00:00
|
|
|
dbus.daemon
|
|
|
|
at-spi2-core
|
|
|
|
libXtst
|
|
|
|
];
|
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
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
2022-09-30 11:47:45 +00:00
|
|
|
++ optional (!stable) unixODBC
|
2021-07-14 22:03:04 +00:00
|
|
|
++ optional (withScripting) wxPython
|
2020-10-16 20:44:37 +00:00
|
|
|
++ optional (withNgspice) libngspice
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional (withOCC) opencascade-occt
|
|
|
|
++ optional (debug) valgrind
|
|
|
|
;
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# started becoming necessary halfway into 2022, not sure what changed to break a test...
|
|
|
|
preInstallCheck = optionals (withNgspice) [ "export LD_LIBRARY_PATH=${libngspice}/lib" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# debug builds fail all but the python test
|
2022-10-21 18:38:19 +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
|
|
|
};
|
|
|
|
}
|