mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 22:10:14 +00:00
Removing all of these dependencies changes nothing about the output derivation, so it seems to be fine. Saves quite a bit of building before on stdenv rebuilds which is nice, but also just cleans up dep trees
177 lines
4.1 KiB
Nix
177 lines
4.1 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
cmake,
|
|
zlib,
|
|
wxGTK,
|
|
gtk3,
|
|
gettext,
|
|
glew,
|
|
glm,
|
|
cairo,
|
|
curl,
|
|
openssl,
|
|
boost,
|
|
pkg-config,
|
|
doxygen,
|
|
unixodbc,
|
|
libgit2,
|
|
libsecret,
|
|
ninja,
|
|
writableTmpDirAsHomeHook,
|
|
|
|
swig,
|
|
python,
|
|
poppler,
|
|
wxPython,
|
|
opencascade-occt_7_6,
|
|
libngspice,
|
|
libspnav,
|
|
valgrind,
|
|
protobuf_29,
|
|
nng,
|
|
|
|
stable,
|
|
testing,
|
|
kicadSrc,
|
|
kicadVersion,
|
|
withNgspice,
|
|
withScripting,
|
|
withI18n,
|
|
debug,
|
|
sanitizeAddress,
|
|
sanitizeThreads,
|
|
}:
|
|
|
|
assert lib.assertMsg (
|
|
!(sanitizeAddress && sanitizeThreads)
|
|
) "'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
|
|
assert testing -> !stable -> throw "testing implies stable and cannot be used with stable = false";
|
|
|
|
let
|
|
opencascade-occt = opencascade-occt_7_6;
|
|
inherit (lib)
|
|
cmakeBool
|
|
cmakeFeature
|
|
optionals
|
|
optionalString
|
|
;
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "kicad-base";
|
|
version = if stable then kicadVersion else builtins.substring 0 10 finalAttrs.src.rev;
|
|
|
|
src = kicadSrc;
|
|
|
|
patches = [
|
|
# upstream issue 12941 (attempted to upstream, but appreciably unacceptable)
|
|
./writable.patch
|
|
# https://gitlab.com/kicad/code/kicad/-/issues/15687
|
|
./runtime_stock_data_path.patch
|
|
];
|
|
|
|
# tagged releases don't have "unknown"
|
|
# kicad testing and nightlies use git describe --dirty
|
|
# nix removes .git, so its approximated here
|
|
postPatch = lib.optionalString (!stable || testing) ''
|
|
substituteInPlace cmake/KiCadVersion.cmake \
|
|
--replace-fail "unknown" "${builtins.substring 0 10 finalAttrs.src.rev}"
|
|
|
|
substituteInPlace cmake/CreateGitVersionHeader.cmake \
|
|
--replace-fail "0000000000000000000000000000000000000000" "${finalAttrs.src.rev}"
|
|
'';
|
|
|
|
preConfigure = optionalString debug ''
|
|
export CFLAGS="''${CFLAGS:-} -Og -ggdb"
|
|
export CXXFLAGS="''${CXXFLAGS:-} -Og -ggdb"
|
|
'';
|
|
|
|
cmakeFlags = [
|
|
(cmakeBool "KICAD_USE_EGL" true)
|
|
(cmakeFeature "OCC_INCLUDE_DIR" "${opencascade-occt}/include/opencascade")
|
|
# https://gitlab.com/kicad/code/kicad/-/issues/17133
|
|
(cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;qa_spice")
|
|
(cmakeBool "KICAD_USE_CMAKE_FINDPROTOBUF" false)
|
|
(cmakeBool "KICAD_SCRIPTING_WXPYTHON" withScripting)
|
|
(cmakeBool "KICAD_BUILD_I18N" withI18n)
|
|
(cmakeBool "KICAD_BUILD_QA_TESTS" (!finalAttrs.doInstallCheck))
|
|
(cmakeBool "KICAD_STDLIB_DEBUG" debug)
|
|
(cmakeBool "KICAD_USE_VALGRIND" debug)
|
|
(cmakeBool "KICAD_SANITIZE_ADDRESS" sanitizeAddress)
|
|
(cmakeBool "KICAD_SANITIZE_THREADS" sanitizeThreads)
|
|
(cmakeBool "KICAD_SPICE" (!(stable && !withNgspice)))
|
|
(cmakeBool "KICAD_UPDATE_CHECK" false)
|
|
]
|
|
++ optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
|
|
(cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;'qa_spice|qa_cli'")
|
|
];
|
|
|
|
cmakeBuildType = if debug then "Debug" else "Release";
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
ninja
|
|
doxygen
|
|
pkg-config
|
|
libgit2
|
|
libsecret
|
|
];
|
|
|
|
buildInputs = [
|
|
zlib
|
|
wxGTK
|
|
gtk3
|
|
gettext
|
|
glew
|
|
glm
|
|
cairo
|
|
curl
|
|
openssl
|
|
boost
|
|
swig
|
|
python
|
|
poppler
|
|
unixodbc
|
|
opencascade-occt
|
|
protobuf_29
|
|
|
|
# This would otherwise cause a linking requirement for mbedtls.
|
|
(nng.override { mbedtlsSupport = false; })
|
|
]
|
|
++ optionals (stdenv.hostPlatform.isLinux) [
|
|
libspnav
|
|
]
|
|
++ optionals withScripting [ wxPython ]
|
|
++ optionals withNgspice [ libngspice ]
|
|
++ optionals debug [ valgrind ];
|
|
|
|
# debug builds fail all but the python test
|
|
doInstallCheck = !debug;
|
|
installCheckTarget = "test";
|
|
|
|
nativeInstallCheckInputs = [
|
|
(python.withPackages (
|
|
ps: with ps; [
|
|
numpy
|
|
pytest
|
|
cairosvg
|
|
pytest-image-diff
|
|
]
|
|
))
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
dontStrip = debug;
|
|
|
|
meta = {
|
|
description = "Just the built source without the libraries";
|
|
longDescription = ''
|
|
Just the build products, the libraries are passed via an env var in the wrapper, default.nix
|
|
'';
|
|
homepage = "https://www.kicad.org/";
|
|
license = lib.licenses.gpl3Plus;
|
|
platforms = lib.platforms.all;
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
};
|
|
})
|