Merge pull request #299273 from NickCao/toml-f

xTB ecosystem: build with meson, fix (cross) compilation
This commit is contained in:
Nick Cao 2024-03-27 10:37:37 -04:00 committed by GitHub
commit 9240e01b0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 75 additions and 88 deletions

View File

@ -1,8 +1,11 @@
{ stdenv { stdenv
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, cmake
, gfortran , gfortran
, meson
, ninja
, pkg-config
, python3
, blas , blas
, lapack , lapack
, mctc-lib , mctc-lib
@ -23,23 +26,20 @@ stdenv.mkDerivation rec {
hash = "sha256-VIV9953hx0MZupOARdH+P1h7JtZeJmTlqtO8si+lwdU="; hash = "sha256-VIV9953hx0MZupOARdH+P1h7JtZeJmTlqtO8si+lwdU=";
}; };
nativeBuildInputs = [ cmake gfortran ]; nativeBuildInputs = [ gfortran meson ninja pkg-config python3 ];
buildInputs = [ blas lapack mctc-lib mstore multicharge ]; buildInputs = [ blas lapack mctc-lib mstore multicharge ];
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
# Fix the Pkg-Config files for doubled store paths doCheck = true;
postPatch = '' postPatch = ''
substituteInPlace config/template.pc \ patchShebangs --build \
--replace "\''${prefix}/" "" config/install-mod.py \
app/tester.py
''; '';
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
];
doCheck = true;
preCheck = '' preCheck = ''
export OMP_NUM_THREADS=2 export OMP_NUM_THREADS=2
''; '';

View File

@ -2,9 +2,11 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, gfortran , gfortran
, meson
, ninja
, pkg-config , pkg-config
, python3
, json-fortran , json-fortran
, cmake
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -18,24 +20,18 @@ stdenv.mkDerivation rec {
hash = "sha256-AXjg/ZsitdDf9fNoGVmVal1iZ4/sxjJb7A9W4yye/rg="; hash = "sha256-AXjg/ZsitdDf9fNoGVmVal1iZ4/sxjJb7A9W4yye/rg=";
}; };
nativeBuildInputs = [ gfortran pkg-config cmake ]; nativeBuildInputs = [ gfortran meson ninja pkg-config python3 ];
buildInputs = [ json-fortran ]; buildInputs = [ json-fortran ];
outputs = [ "out" "dev" ]; 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; doCheck = true;
postPatch = ''
patchShebangs --build config/install-mod.py
'';
meta = with lib; { meta = with lib; {
description = "Modular computation tool chain library"; description = "Modular computation tool chain library";
mainProgram = "mctc-convert"; mainProgram = "mctc-convert";

View File

@ -1,8 +1,11 @@
{ stdenv { stdenv
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, cmake
, gfortran , gfortran
, meson
, ninja
, pkg-config
, python3
, mctc-lib , mctc-lib
}: }:
@ -17,22 +20,16 @@ stdenv.mkDerivation rec {
hash = "sha256-dN2BulLS/ENRFVdJIrZRxgBV8S4d5+7BjTCGnhBbf4I="; hash = "sha256-dN2BulLS/ENRFVdJIrZRxgBV8S4d5+7BjTCGnhBbf4I=";
}; };
nativeBuildInputs = [ cmake gfortran ]; nativeBuildInputs = [ gfortran meson ninja pkg-config python3 ];
buildInputs = [ mctc-lib ]; buildInputs = [ mctc-lib ];
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
# Fix the Pkg-Config files for doubled store paths
postPatch = '' postPatch = ''
substituteInPlace config/template.pc \ patchShebangs --build config/install-mod.py
--replace "\''${prefix}/" ""
''; '';
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
];
meta = with lib; { meta = with lib; {
description = "Molecular structure store for testing"; description = "Molecular structure store for testing";
license = licenses.asl20; license = licenses.asl20;

View File

@ -1,8 +1,12 @@
{ stdenv { stdenv
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, cmake , fetchpatch2
, gfortran , gfortran
, meson
, ninja
, pkg-config
, python3
, blas , blas
, lapack , lapack
, mctc-lib , mctc-lib
@ -22,23 +26,28 @@ stdenv.mkDerivation rec {
hash = "sha256-oUI5x5/Gd0EZBb1w+0jlJUF9X51FnkHFu8H7KctqXl0="; hash = "sha256-oUI5x5/Gd0EZBb1w+0jlJUF9X51FnkHFu8H7KctqXl0=";
}; };
nativeBuildInputs = [ cmake gfortran ]; patches = [
# Fix finding of MKL for Intel 2021 and newer
# Also fix finding mstore
# https://github.com/grimme-lab/multicharge/pull/20
(fetchpatch2 {
url = "https://github.com/grimme-lab/multicharge/commit/98a11ac524cd2a1bd9e2aeb8f4429adb2d76ee8.patch";
hash = "sha256-zZ2pcbyaHjN2ZxpMhlqUtIXImrVsLk/8WIcb9IYPgBw=";
})
];
nativeBuildInputs = [ gfortran meson ninja pkg-config python3 ];
buildInputs = [ blas lapack mctc-lib mstore ]; buildInputs = [ blas lapack mctc-lib mstore ];
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
# Fix the Pkg-Config files for doubled store paths doCheck = true;
postPatch = '' postPatch = ''
substituteInPlace config/template.pc \ patchShebangs --build config/install-mod.py
--replace "\''${prefix}/" ""
''; '';
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
];
doCheck = true;
preCheck = '' preCheck = ''
export OMP_NUM_THREADS=2 export OMP_NUM_THREADS=2
''; '';

View File

@ -2,7 +2,9 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, gfortran , gfortran
, cmake , meson
, ninja
, pkg-config
, mctc-lib , mctc-lib
, mstore , mstore
, toml-f , toml-f
@ -22,21 +24,12 @@ stdenv.mkDerivation rec {
hash = "sha256-dfXiKKCGJ69aExSKpVC3Bp//COy256R9PDyxCNmDsfo="; hash = "sha256-dfXiKKCGJ69aExSKpVC3Bp//COy256R9PDyxCNmDsfo=";
}; };
nativeBuildInputs = [ cmake gfortran ]; nativeBuildInputs = [ gfortran meson ninja pkg-config ];
buildInputs = [ mctc-lib mstore toml-f blas ]; buildInputs = [ mctc-lib mstore toml-f blas ];
outputs = [ "out" "dev" ]; 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; doCheck = true;
preCheck = '' preCheck = ''
export OMP_NUM_THREADS=2 export OMP_NUM_THREADS=2
@ -47,7 +40,7 @@ stdenv.mkDerivation rec {
mainProgram = "s-dftd3"; mainProgram = "s-dftd3";
license = with licenses; [ lgpl3Only gpl3Only ]; license = with licenses; [ lgpl3Only gpl3Only ];
homepage = "https://github.com/dftd3/simple-dftd3"; homepage = "https://github.com/dftd3/simple-dftd3";
platforms = [ "x86_64-linux" ]; platforms = platforms.linux;
maintainers = [ maintainers.sheepforce ]; maintainers = [ maintainers.sheepforce ];
}; };
} }

View File

@ -2,8 +2,10 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, fetchpatch , fetchpatch
, cmake
, gfortran , gfortran
, meson
, ninja
, pkg-config
, blas , blas
, lapack , lapack
, mctc-lib , mctc-lib
@ -35,13 +37,12 @@ stdenv.mkDerivation rec {
}) })
]; ];
# Fix the Pkg-Config files for doubled store paths nativeBuildInputs = [
postPatch = '' gfortran
substituteInPlace config/template.pc \ meson
--replace "\''${prefix}/" "" ninja
''; pkg-config
];
nativeBuildInputs = [ cmake gfortran ];
buildInputs = [ buildInputs = [
blas blas
@ -56,10 +57,6 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
];
doCheck = true; doCheck = true;
preCheck = '' preCheck = ''
export OMP_NUM_THREADS=2 export OMP_NUM_THREADS=2

View File

@ -1,4 +1,6 @@
{ buildPythonPackage { lib
, buildPythonPackage
, pythonAtLeast
, fetchpatch , fetchpatch
, meson , meson
, ninja , ninja
@ -15,6 +17,7 @@
, toml-f , toml-f
, multicharge , multicharge
, dftd4 , dftd4
, setuptools
}: }:
buildPythonPackage { buildPythonPackage {
@ -27,6 +30,8 @@ buildPythonPackage {
pkg-config pkg-config
gfortran gfortran
mctc-lib mctc-lib
] ++ lib.optionals (pythonAtLeast "3.12") [
setuptools
]; ];
buildInputs = [ buildInputs = [

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, gfortran, cmake }: { stdenv, lib, fetchFromGitHub, gfortran, meson, ninja, mesonEmulatorHook }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "test-drive"; pname = "test-drive";
@ -11,21 +11,18 @@ stdenv.mkDerivation rec {
hash = "sha256-ObAnHFP1Hp0knf/jtGHynVF0CCqK47eqetePx4NLmlM="; hash = "sha256-ObAnHFP1Hp0knf/jtGHynVF0CCqK47eqetePx4NLmlM=";
}; };
postPatch = ''
substituteInPlace config/template.pc \
--replace 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' "libdir=@CMAKE_INSTALL_LIBDIR@" \
--replace 'includedir=''${prefix}/@CMAKE_INSTALL_INCLUDEDIR@' "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
'';
nativeBuildInputs = [ nativeBuildInputs = [
gfortran gfortran
cmake meson
ninja
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
]; ];
meta = with lib; { meta = with lib; {
description = "Procedural Fortran testing framework"; description = "Procedural Fortran testing framework";
homepage = "https://github.com/fortran-lang/test-drive"; homepage = "https://github.com/fortran-lang/test-drive";
license = with licenses; [ asl20 mit ] ; license = with licenses; [ asl20 mit ];
platforms = platforms.linux; platforms = platforms.linux;
maintainers = [ maintainers.sheepforce ]; maintainers = [ maintainers.sheepforce ];
}; };

View File

@ -2,7 +2,9 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, gfortran , gfortran
, cmake , meson
, ninja
, pkg-config
, test-drive , test-drive
}: }:
@ -17,29 +19,19 @@ stdenv.mkDerivation rec {
hash = "sha256-+cac4rUNpd2w3yBdH1XoCKdJ9IgOHZioZg8AhzGY0FE="; hash = "sha256-+cac4rUNpd2w3yBdH1XoCKdJ9IgOHZioZg8AhzGY0FE=";
}; };
nativeBuildInputs = [ gfortran cmake ]; nativeBuildInputs = [ gfortran meson ninja pkg-config ];
buildInputs = [ test-drive ]; buildInputs = [ test-drive ];
outputs = [ "out" "dev" ]; 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; doCheck = true;
meta = with lib; { meta = with lib; {
description = "TOML parser implementation for data serialization and deserialization in Fortran"; description = "TOML parser implementation for data serialization and deserialization in Fortran";
license = with licenses; [ asl20 mit ]; license = with licenses; [ asl20 mit ];
homepage = "https://github.com/toml-f/toml-f"; homepage = "https://github.com/toml-f/toml-f";
platforms = [ "x86_64-linux" ]; platforms = platforms.linux;
maintainers = [ maintainers.sheepforce ]; maintainers = [ maintainers.sheepforce ];
}; };
} }

View File

@ -84,6 +84,7 @@ buildPythonPackage rec {
"test_n3_cis_ewald" "test_n3_cis_ewald"
"test_veff" "test_veff"
"test_collinear_kgks_gga" "test_collinear_kgks_gga"
"test_libxc_gga_deriv4"
]; ];
pytestFlagsArray = [ pytestFlagsArray = [