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
|
2023-02-16 17:41:37 +00:00
|
|
|
, fetchpatch
|
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
|
|
|
|
, withOCC
|
|
|
|
, 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
|
2023-02-16 17:41:37 +00:00
|
|
|
]
|
|
|
|
++ optionals (stable) # the 2 wxGTK ones should in the next stable point release
|
|
|
|
[
|
|
|
|
(fetchpatch { # for wxGTK 3.2.2.1's .1 field
|
|
|
|
name = "support wxWidgets subrelease field";
|
|
|
|
url = "https://gitlab.com/kicad/code/kicad/-/commit/b536580119c59fde78e38d8d6388f2540ecb6cf9.diff";
|
|
|
|
hash = "sha256-F+J5oZO0BsT1VWKpx0KGA7ecn5/PBgCw8uiScihM+54=";
|
|
|
|
})
|
|
|
|
(fetchpatch { # for wxGTK 3.2.2.1's .1 field, but for wxPython
|
|
|
|
name = "relax wxPython check to just major.minor";
|
|
|
|
url = "https://gitlab.com/kicad/code/kicad/-/commit/1e8cc6855d6a8fc1f9dfc933224c3a10fb759f9c.diff";
|
|
|
|
hash = "sha256-CGNgxZ7QiVLkaauNl7Pmcl152lwyDZqA/HSyFdOswwU=";
|
|
|
|
})
|
2022-12-28 21:21:41 +00:00
|
|
|
];
|
|
|
|
|
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
|
|
|
|
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"
|
2023-02-16 17:41:37 +00:00
|
|
|
"-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;qa_eeschema'" # upstream issue 12491
|
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"
|
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
|
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
|
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
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional (withOCC) opencascade-occt
|
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
|
|
|
};
|
|
|
|
}
|