kicad.libraries.packages3d: use stepreduce & stepZ

this makes it buildable by hydra

stepreduce brings down closure size from 5.4G to 3.3G
zip brings it down from 3.3G to 1.6G (or 5.4G to 1.9G without reduce)

xz compressed NAR sizes are:
plain: 373M
gzip: 712M
zip: 712M
stepreduce: 262M
stepreduce & gzip: 465M
stepreduce & zip: 468M
This commit is contained in:
Evils 2023-07-11 10:01:16 +02:00 committed by Bjørn Forsman
parent d204d55813
commit 29bf6c5ca5

View File

@ -2,6 +2,9 @@
, cmake
, gettext
, libSrc
, stepreduce
, parallel
, zip
}:
let
mkLib = name:
@ -11,14 +14,20 @@ let
src = libSrc name;
nativeBuildInputs = [ cmake ];
nativeBuildInputs = [ cmake ]
++ lib.optionals (name == "packages3d") [
stepreduce
parallel
zip
];
postInstall = lib.optional (name == "packages3d") ''
find $out -type f -name '*.step' | parallel 'stepreduce {} {} && zip -9 {.}.stpZ {} && rm {}'
'';
meta = rec {
license = lib.licenses.cc-by-sa-40;
platforms = lib.platforms.all;
# the 3d models are a ~1 GiB download and occupy ~5 GiB in store.
# this would exceed the hydra output limit
hydraPlatforms = if (name == "packages3d") then [ ] else platforms;
};
};
in