kicad: add sanitizeAddress & sanitizeThreads options

only kicad 5.99 or later are affected
was briefly -DKICAD_SANITIZE=ON
are mutually exclusive according to a compiler error
This commit is contained in:
Evils 2021-01-23 10:58:33 +01:00
parent e37d772beb
commit e2661b00f7
2 changed files with 16 additions and 1 deletions

View File

@ -50,12 +50,18 @@
, withNgspice , withNgspice
, withScripting , withScripting
, debug , debug
, sanitizeAddress
, sanitizeThreads
, withI18n , withI18n
}: }:
assert lib.asserts.assertMsg (!(withOCE && stdenv.isAarch64)) "OCE fails a test on Aarch64"; assert lib.asserts.assertMsg (!(withOCE && stdenv.isAarch64)) "OCE fails a test on Aarch64";
assert lib.asserts.assertMsg (!(withOCC && withOCE)) assert lib.asserts.assertMsg (!(withOCC && withOCE))
"Only one of OCC and OCE may be enabled"; "Only one of OCC and OCE may be enabled";
assert lib.assertMsg (!(stable && (sanitizeAddress || sanitizeThreads)))
"Only kicad-unstable(-small) supports address/thread sanitation";
assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads))
"'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
let let
inherit (lib) optional optionals; inherit (lib) optional optionals;
in in
@ -98,6 +104,12 @@ stdenv.mkDerivation rec {
"-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_BUILD_TYPE=Debug"
"-DKICAD_STDLIB_DEBUG=ON" "-DKICAD_STDLIB_DEBUG=ON"
"-DKICAD_USE_VALGRIND=ON" "-DKICAD_USE_VALGRIND=ON"
]
++ optionals (sanitizeAddress) [
"-DKICAD_SANITIZE_ADDRESS=ON"
]
++ optionals (sanitizeThreads) [
"-DKICAD_SANITIZE_THREADS=ON"
]; ];
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -25,6 +25,8 @@
, withScripting ? true , withScripting ? true
, python3 , python3
, debug ? false , debug ? false
, sanitizeAddress ? false
, sanitizeThreads ? false
, with3d ? true , with3d ? true
, withI18n ? true , withI18n ? true
, srcs ? { } , srcs ? { }
@ -162,7 +164,8 @@ stdenv.mkDerivation rec {
inherit kicadSrc kicadVersion; inherit kicadSrc kicadVersion;
inherit (passthru) i18n; inherit (passthru) i18n;
inherit wxGTK python wxPython; inherit wxGTK python wxPython;
inherit debug withI18n withOCC withOCE withNgspice withScripting; inherit withI18n withOCC withOCE withNgspice withScripting;
inherit debug sanitizeAddress sanitizeThreads;
}; };
inherit pname; inherit pname;