mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
d98b76cf5b
PCM is no longer optional removed in 211820a689a618ac5bcbea19a8c58d345ce25ddb -unknown suffix is back 3e373da8c25048205dfa2278079555a522fd2e62
177 lines
3.3 KiB
Nix
177 lines
3.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, cmake
|
|
, libGLU
|
|
, libGL
|
|
, zlib
|
|
, wxGTK
|
|
, libX11
|
|
, gettext
|
|
, glew
|
|
, glm
|
|
, cairo
|
|
, curl
|
|
, openssl
|
|
, boost
|
|
, pkg-config
|
|
, doxygen
|
|
, graphviz
|
|
, pcre
|
|
, libpthreadstubs
|
|
, libXdmcp
|
|
, lndir
|
|
|
|
, util-linux
|
|
, libselinux
|
|
, libsepol
|
|
, libthai
|
|
, libdatrie
|
|
, libxkbcommon
|
|
, libepoxy
|
|
, dbus
|
|
, at-spi2-core
|
|
, libXtst
|
|
|
|
, swig
|
|
, python
|
|
, wxPython
|
|
, opencascade-occt
|
|
, libngspice
|
|
, valgrind
|
|
|
|
, stable
|
|
, baseName
|
|
, kicadSrc
|
|
, kicadVersion
|
|
, withOCC
|
|
, withNgspice
|
|
, withScripting
|
|
, withI18n
|
|
, withPCM
|
|
, debug
|
|
, sanitizeAddress
|
|
, sanitizeThreads
|
|
}:
|
|
|
|
assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads))
|
|
"'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
|
|
|
|
let
|
|
inherit (lib) optional optionals optionalString;
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "kicad-base";
|
|
version = if (stable) then kicadVersion else builtins.substring 0 10 src.rev;
|
|
|
|
src = kicadSrc;
|
|
|
|
# tagged releases don't have "unknown"
|
|
# kicad nightlies use git describe --dirty
|
|
# nix removes .git, so its approximated here
|
|
postPatch = ''
|
|
substituteInPlace CMakeModules/KiCadVersion.cmake \
|
|
--replace "unknown" "${builtins.substring 0 10 src.rev}" \
|
|
'';
|
|
|
|
makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];
|
|
|
|
cmakeFlags = optionals (withScripting) [
|
|
"-DKICAD_SCRIPTING_WXPYTHON=ON"
|
|
]
|
|
++ optionals (!withScripting) [
|
|
"-DKICAD_SCRIPTING_WXPYTHON=OFF"
|
|
]
|
|
++ optional (!withNgspice) "-DKICAD_SPICE=OFF"
|
|
++ 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"
|
|
]
|
|
++ optionals (!doInstallCheck) [
|
|
"-DKICAD_BUILD_QA_TESTS=OFF"
|
|
]
|
|
++ optionals (sanitizeAddress) [
|
|
"-DKICAD_SANITIZE_ADDRESS=ON"
|
|
]
|
|
++ optionals (sanitizeThreads) [
|
|
"-DKICAD_SANITIZE_THREADS=ON"
|
|
]
|
|
++ optionals (withI18n) [
|
|
"-DKICAD_BUILD_I18N=ON"
|
|
]
|
|
++ optionals (!withPCM && stable) [
|
|
"-DKICAD_PCM=OFF"
|
|
];
|
|
|
|
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
|
|
libepoxy
|
|
dbus.daemon
|
|
at-spi2-core
|
|
libXtst
|
|
];
|
|
|
|
buildInputs = [
|
|
libGLU
|
|
libGL
|
|
zlib
|
|
libX11
|
|
wxGTK
|
|
wxGTK.gtk
|
|
pcre
|
|
libXdmcp
|
|
gettext
|
|
glew
|
|
glm
|
|
libpthreadstubs
|
|
cairo
|
|
curl
|
|
openssl
|
|
boost
|
|
swig
|
|
python
|
|
]
|
|
++ optional (withScripting) wxPython
|
|
++ optional (withNgspice) libngspice
|
|
++ optional (withOCC) opencascade-occt
|
|
++ optional (debug) valgrind
|
|
;
|
|
|
|
# debug builds fail all but the python test
|
|
#doInstallCheck = !debug;
|
|
# temporarily disabled until upstream issue 9888 is resolved
|
|
doInstallCheck = false;
|
|
installCheckTarget = "test";
|
|
|
|
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.agpl3;
|
|
platforms = lib.platforms.all;
|
|
};
|
|
}
|