kicad: Fix rebuild when compressStep = false (#523928)
This commit is contained in:
@@ -62,7 +62,6 @@
|
||||
debug,
|
||||
sanitizeAddress,
|
||||
sanitizeThreads,
|
||||
templateDir ? null,
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (
|
||||
@@ -208,14 +207,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
dontStrip = debug;
|
||||
|
||||
# KiCad looks for the stock library tables at
|
||||
# KICAD_LIBRARY_DATA/template/{sym,fp}-lib-table, where KICAD_LIBRARY_DATA is
|
||||
# compiled in as $out/share/kicad. Those files live in separate library packages.
|
||||
postInstall = optionalString (templateDir != null) ''
|
||||
rm -rf $out/share/kicad/template
|
||||
ln -s ${templateDir} $out/share/kicad/template
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Just the built source without the libraries";
|
||||
longDescription = ''
|
||||
|
||||
@@ -186,7 +186,6 @@ stdenv.mkDerivation rec {
|
||||
inherit wxGTK python wxPython;
|
||||
inherit withNgspice withScripting withI18n;
|
||||
inherit debug sanitizeAddress sanitizeThreads;
|
||||
templateDir = template_dir;
|
||||
};
|
||||
|
||||
inherit pname;
|
||||
@@ -221,6 +220,36 @@ stdenv.mkDerivation rec {
|
||||
"${symbols}/share/kicad/template"
|
||||
];
|
||||
};
|
||||
|
||||
# KiCad looks up its stock library tables relative to GetStockDataPath(),
|
||||
# which our runtime_stock_data_path.patch lets us override via
|
||||
# NIX_KICAD10_STOCK_DATA_PATH. We synthesise a directory that mirrors
|
||||
# ${base}/share/kicad but replaces the upstream-installed (incomplete)
|
||||
# template/ with the merged template_dir from the library packages.
|
||||
# Doing this in the wrapper instead of in base.nix keeps the heavy
|
||||
# kicad-base compile independent of the (cheap) library packages, so
|
||||
# toggling overrides like compressStep doesn't force a base rebuild.
|
||||
baseWithTemplate = runCommand "kicad-stock-data" { } ''
|
||||
mkdir -p $out
|
||||
for d in ${base}/share/kicad/*; do
|
||||
name=$(basename "$d")
|
||||
[ "$name" = template ] || ln -s "$d" "$out/$name"
|
||||
done
|
||||
ln -s ${template_dir} $out/template
|
||||
'';
|
||||
|
||||
stockDataPath =
|
||||
if addons == [ ] then
|
||||
baseWithTemplate
|
||||
else
|
||||
symlinkJoin {
|
||||
name = "kicad_stock_data_path";
|
||||
paths = [
|
||||
baseWithTemplate
|
||||
"${addonsJoined}/share/kicad"
|
||||
];
|
||||
};
|
||||
|
||||
# We are emulating wrapGAppsHook3, along with other variables to the wrapper
|
||||
makeWrapperArgs =
|
||||
with passthru.libraries;
|
||||
@@ -238,19 +267,8 @@ stdenv.mkDerivation rec {
|
||||
"--set-default KICAD10_FOOTPRINT_DIR ${footprints}/share/kicad/footprints"
|
||||
"--set-default KICAD10_SYMBOL_DIR ${symbols}/share/kicad/symbols"
|
||||
"--set-default KICAD10_TEMPLATE_DIR ${template_dir}"
|
||||
"--set-default NIX_KICAD10_STOCK_DATA_PATH ${stockDataPath}"
|
||||
]
|
||||
++ optionals (addons != [ ]) (
|
||||
let
|
||||
stockDataPath = symlinkJoin {
|
||||
name = "kicad_stock_data_path";
|
||||
paths = [
|
||||
"${base}/share/kicad"
|
||||
"${addonsJoined}/share/kicad"
|
||||
];
|
||||
};
|
||||
in
|
||||
[ "--set-default NIX_KICAD10_STOCK_DATA_PATH ${stockDataPath}" ]
|
||||
)
|
||||
++ optionals with3d [
|
||||
"--set-default KICAD10_3DMODEL_DIR ${packages3d}/share/kicad/3dmodels"
|
||||
]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
diff --git a/common/paths.cpp b/common/paths.cpp
|
||||
index a74cdd9..790cc58 100644
|
||||
--- a/common/paths.cpp
|
||||
+++ b/common/paths.cpp
|
||||
@@ -151,6 +151,10 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir )
|
||||
@@ -13,3 +12,14 @@ index a74cdd9..790cc58 100644
|
||||
if( aRespectRunFromBuildDir && wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
// Allow debugging from build dir by placing relevant files/folders in the build root
|
||||
@@ -198,6 +202,10 @@ wxString PATHS::GetStockEDALibraryPath()
|
||||
{
|
||||
wxString path;
|
||||
|
||||
+ if( wxGetEnv( wxT( "NIX_KICAD10_STOCK_DATA_PATH" ), &path ) ) {
|
||||
+ return path;
|
||||
+ }
|
||||
+
|
||||
#if defined( __WXMAC__ )
|
||||
path = GetOSXKicadMachineDataDir();
|
||||
#elif defined( __WXMSW__ )
|
||||
|
||||
Reference in New Issue
Block a user