From 71e47e8a232fc3a4fd1817d33028194ada8d3554 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 11 Jan 2024 17:29:43 +0100 Subject: [PATCH 1/7] mctc-lib: enable shared builds on !isStatic platforms --- .../science/chemistry/mctc-lib/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix b/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix index aeb7c8bb6f56..a3726ea5e5dd 100644 --- a/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix +++ b/pkgs/development/libraries/science/chemistry/mctc-lib/default.nix @@ -22,11 +22,18 @@ stdenv.mkDerivation rec { buildInputs = [ json-fortran ]; - postInstall = '' - substituteInPlace $out/lib/pkgconfig/${pname}.pc \ - --replace "''${prefix}/" "" + outputs = [ "out" "dev" ]; + + # Fix the Pkg-Config files for doubled store paths + postPatch = '' + substituteInPlace config/template.pc \ + --replace "\''${prefix}/" "" ''; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" + ]; + doCheck = true; meta = with lib; { From 9250befb66367bb67cca3101f7464d7ded05e953 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 11 Jan 2024 17:28:09 +0100 Subject: [PATCH 2/7] toml-f: enable shared builds on !isStatic platforms --- pkgs/development/libraries/toml-f/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/toml-f/default.nix b/pkgs/development/libraries/toml-f/default.nix index ed6fc26ee205..28fb3dadce48 100644 --- a/pkgs/development/libraries/toml-f/default.nix +++ b/pkgs/development/libraries/toml-f/default.nix @@ -21,11 +21,18 @@ stdenv.mkDerivation rec { buildInputs = [ test-drive ]; - postInstall = '' - substituteInPlace $out/lib/pkgconfig/${pname}.pc \ - --replace "''${prefix}/" "" + outputs = [ "out" "dev" ]; + + # Fix the Pkg-Config files for doubled store paths + postPatch = '' + substituteInPlace config/template.pc \ + --replace "\''${prefix}/" "" ''; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" + ]; + doCheck = true; meta = with lib; { From a3f4b8c7da2b8707205041f9144024a983886e98 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Fri, 12 Jan 2024 12:31:10 +0100 Subject: [PATCH 3/7] tblite: enable shared builds on !isStatic platforms tblite: fix pkg-config --- .../science/chemistry/tblite/default.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/science/chemistry/tblite/default.nix b/pkgs/development/libraries/science/chemistry/tblite/default.nix index 7cc64937dc13..bea5793addbf 100644 --- a/pkgs/development/libraries/science/chemistry/tblite/default.nix +++ b/pkgs/development/libraries/science/chemistry/tblite/default.nix @@ -35,6 +35,12 @@ stdenv.mkDerivation rec { }) ]; + # Fix the Pkg-Config files for doubled store paths + postPatch = '' + substituteInPlace config/template.pc \ + --replace "\''${prefix}/" "" + ''; + nativeBuildInputs = [ cmake gfortran ]; buildInputs = [ @@ -48,16 +54,17 @@ stdenv.mkDerivation rec { simple-dftd3 ]; + outputs = [ "out" "dev" ]; + + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" + ]; + doCheck = true; preCheck = '' export OMP_NUM_THREADS=2 ''; - postInstall = '' - substituteInPlace $out/lib/pkgconfig/${pname}.pc \ - --replace "''${prefix}" "" - ''; - meta = with lib; { description = "Light-weight tight-binding framework"; license = with licenses; [ gpl3Plus lgpl3Plus ]; From 6631798926b430943266bf844a8ae5a27f7d7e69 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 11 Jan 2024 17:28:38 +0100 Subject: [PATCH 4/7] simple-dftd3: enable shared builds on !isStatic platforms --- .../science/chemistry/simple-dftd3/default.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix b/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix index 1f5e4b250a91..ae5e30d73608 100644 --- a/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix +++ b/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix @@ -26,10 +26,16 @@ stdenv.mkDerivation rec { buildInputs = [ mctc-lib mstore toml-f blas ]; - postInstall = '' - substituteInPlace $out/lib/pkgconfig/s-dftd3.pc \ - --replace "''${prefix}/" "" + outputs = [ "out" "dev" ]; + + # Fix the Pkg-Config files for doubled store paths + postPatch = '' + substituteInPlace config/template.pc \ + --replace "\''${prefix}/" "" ''; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" + ]; doCheck = true; preCheck = '' From 0138d805ddce32a6327e562d132236a4310423e9 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 11 Jan 2024 17:28:55 +0100 Subject: [PATCH 5/7] multicharge: enable shared builds on !isStatic platforms --- .../science/chemistry/multicharge/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/chemistry/multicharge/default.nix b/pkgs/development/libraries/science/chemistry/multicharge/default.nix index f61f11225f1b..b90f073a4f2e 100644 --- a/pkgs/development/libraries/science/chemistry/multicharge/default.nix +++ b/pkgs/development/libraries/science/chemistry/multicharge/default.nix @@ -26,11 +26,18 @@ stdenv.mkDerivation rec { buildInputs = [ blas lapack mctc-lib mstore ]; - postInstall = '' - substituteInPlace $out/lib/pkgconfig/${pname}.pc \ - --replace "''${prefix}/" "" + outputs = [ "out" "dev" ]; + + # Fix the Pkg-Config files for doubled store paths + postPatch = '' + substituteInPlace config/template.pc \ + --replace "\''${prefix}/" "" ''; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" + ]; + doCheck = true; preCheck = '' export OMP_NUM_THREADS=2 From 00713edc7bc763a268a6b5b39df202bdfca258e0 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 11 Jan 2024 17:29:26 +0100 Subject: [PATCH 6/7] mstore: enable shared builds on !isStatic platforms --- .../libraries/science/chemistry/mstore/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/chemistry/mstore/default.nix b/pkgs/development/libraries/science/chemistry/mstore/default.nix index 86e03df16b0e..948d11435461 100644 --- a/pkgs/development/libraries/science/chemistry/mstore/default.nix +++ b/pkgs/development/libraries/science/chemistry/mstore/default.nix @@ -21,11 +21,18 @@ stdenv.mkDerivation rec { buildInputs = [ mctc-lib ]; - postInstall = '' - substituteInPlace $out/lib/pkgconfig/${pname}.pc \ - --replace "''${prefix}/" "" + outputs = [ "out" "dev" ]; + + # Fix the Pkg-Config files for doubled store paths + postPatch = '' + substituteInPlace config/template.pc \ + --replace "\''${prefix}/" "" ''; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" + ]; + meta = with lib; { description = "Molecular structure store for testing"; license = licenses.asl20; From dc237ef7f577bada0022109bed5727d7f74effa6 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 11 Jan 2024 17:29:59 +0100 Subject: [PATCH 7/7] dftd4: enable shared builds on !isStatic platforms --- .../libraries/science/chemistry/dftd4/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/chemistry/dftd4/default.nix b/pkgs/development/libraries/science/chemistry/dftd4/default.nix index 52c9b4de20a5..d791a7d4e3d6 100644 --- a/pkgs/development/libraries/science/chemistry/dftd4/default.nix +++ b/pkgs/development/libraries/science/chemistry/dftd4/default.nix @@ -27,11 +27,18 @@ stdenv.mkDerivation rec { buildInputs = [ blas lapack mctc-lib mstore multicharge ]; - postInstall = '' - substituteInPlace $out/lib/pkgconfig/${pname}.pc \ - --replace "''${prefix}/" "" + outputs = [ "out" "dev" ]; + + # Fix the Pkg-Config files for doubled store paths + postPatch = '' + substituteInPlace config/template.pc \ + --replace "\''${prefix}/" "" ''; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}" + ]; + doCheck = true; preCheck = '' export OMP_NUM_THREADS=2