Merge pull request #331723 from sheepforce/openbabel-fix

openbabel: fix build errors with python 3.12
This commit is contained in:
Markus Kowalewski
2024-08-05 11:12:32 +02:00
committed by GitHub
2 changed files with 30 additions and 12 deletions
@@ -1,4 +1,21 @@
{ stdenv, lib, fetchFromGitHub, cmake, perl, zlib, libxml2, eigen, python, cairo, pcre, pkg-config, swig, rapidjson }:
{ stdenv
, lib
, fetchFromGitHub
, cmake
, perl
, zlib
, libxml2
, eigen
, python
, cairo
, pcre
, pkg-config
, swig
, rapidjson
, boost
, maeparser
, coordgenlibs
}:
stdenv.mkDerivation rec {
pname = "openbabel";
@@ -15,22 +32,23 @@ stdenv.mkDerivation rec {
sed '1i#include <ctime>' -i include/openbabel/obutil.h # gcc12
'';
buildInputs = [ perl zlib libxml2 eigen python cairo pcre swig rapidjson ];
buildInputs = [ perl zlib libxml2 eigen python cairo pcre swig rapidjson boost maeparser coordgenlibs ];
nativeBuildInputs = [ cmake pkg-config ];
pythonMajorMinor = "${python.sourceVersion.major}.${python.sourceVersion.minor}";
cmakeFlags = [
"-DRUN_SWIG=ON"
"-DPYTHON_BINDINGS=ON"
];
preConfigure = ''
cmakeFlagsArray+=(
"-DRUN_SWIG=ON"
"-DPYTHON_BINDINGS=ON"
"-DPYTHON_INSTDIR=$out/${python.sitePackages}"
)
'';
# Setuptools only accepts PEP 440 version strings. The "unstable" identifier
# can not be used. Instead we pretend to be the 3.2 beta release.
postFixup = ''
cat <<EOF > $out/lib/python$pythonMajorMinor/site-packages/setup.py
from distutils.core import setup
cat << EOF > $out/${python.sitePackages}/setup.py
from setuptools import setup
setup(
name = 'pyopenbabel',
@@ -8,9 +8,9 @@
buildPythonPackage rec {
inherit (openbabel) pname version;
src = "${openbabel}/lib/python${python.sourceVersion.major}.${python.sourceVersion.minor}/site-packages";
src = "${openbabel}/${python.sitePackages}";
nativeBuildInputs = [ openbabel ];
buildInputs = [ openbabel ];
# these env variables are used by the bindings to find libraries
# they need to be included explicitly in your nix-shell for