Skip to content

Commit

Permalink
rPackages.ChemmineOB: fix compile error
Browse files Browse the repository at this point in the history
- Don't override openbabel
- fix pointer name in ChemmineOB src instead
  • Loading branch information
Kupac committed Oct 29, 2024
1 parent 0fdb289 commit 069077c
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions pkgs/development/r-modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ let
sphereTessellation = with pkgs; [ gmp.dev mpfr.dev ];
vapour = with pkgs; [ proj.dev gdal ];
MedianaDesigner = [ pkgs.zlib.dev ];
ChemmineOB = [ pkgs.eigen ];
ChemmineOB = with pkgs; [ eigen openbabel ];
DGP4LCF = [ pkgs.lapack pkgs.blas ];
};

Expand Down Expand Up @@ -1582,29 +1582,26 @@ let
PKGCONFIG_LIBS = "-Wl,-rpath,${lib.getLib pkgs.openssl}/lib -L${lib.getLib pkgs.openssl}/lib -L${pkgs.cyrus_sasl.out}/lib -L${pkgs.zlib.out}/lib -lssl -lcrypto -lsasl2 -lz";
});

ChemmineOB = let
# R package doesn't compile with the latest (unstable) version.
# Override from nixpkgs-23.11
openbabel3 = pkgs.openbabel.overrideAttrs (attrs: {
version = "3.1.1";
src = pkgs.fetchFromGitHub {
owner = "openbabel";
repo = "openbabel";
rev = "openbabel-${lib.replaceStrings ["."] ["-"] attrs.version}";
sha256 = "sha256-wQpgdfCyBAoh4pmj9j7wPTlMtraJ62w/EShxi/olVMY=";
};
});
in
old.ChemmineOB.overrideAttrs (attrs: {
ChemmineOB = old.ChemmineOB.overrideAttrs (attrs: {
# pkg-config knows openbabel-3 without the .0
# Eigen3 is also looked for in the wrong location
# pointer was changed in newer version of openbabel:
# https://github.com/openbabel/openbabel/commit/305a6fd3183540e4a8ae1d79d10bf1860e6aa373
postPatch = ''
substituteInPlace configure \
--replace-fail openbabel-3.0 openbabel-3
substituteInPlace src/Makevars.in \
--replace-fail "-I/usr/include/eigen3" "-I${pkgs.eigen}/include/eigen3"
substituteInPlace src/ChemmineOB.cpp \
--replace-fail "obsharedptr<" "std::shared_ptr<"
'';
buildInputs = attrs.buildInputs ++ [openbabel3];

# copied from fastnlo-toolkit:
# None of our currently packaged versions of swig are C++17-friendly
# Use a workaround from https://github.com/swig/swig/issues/1538
env = (attrs.env or { }) // {
NIX_CFLAGS_COMPILE = (attrs.env.NIX_CFLAGS_COMPILE or "") + lib.optionalString stdenv.hostPlatform.isDarwin " -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES";
};
});

ps = old.ps.overrideAttrs (attrs: {
Expand Down

0 comments on commit 069077c

Please sign in to comment.