about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/openbabel
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/openbabel')
-rw-r--r--nixpkgs/pkgs/development/libraries/openbabel/2.nix37
-rw-r--r--nixpkgs/pkgs/development/libraries/openbabel/default.nix51
2 files changed, 88 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/openbabel/2.nix b/nixpkgs/pkgs/development/libraries/openbabel/2.nix
new file mode 100644
index 000000000000..0cc752d993fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openbabel/2.nix
@@ -0,0 +1,37 @@
+{stdenv, lib, fetchFromGitHub, fetchpatch, cmake, zlib, libxml2, eigen, python3, cairo, pcre, pkg-config }:
+
+stdenv.mkDerivation rec {
+  pname = "openbabel";
+  version = "2.4.1";
+
+  src = fetchFromGitHub {
+    owner = "openbabel";
+    repo = "openbabel";
+    rev = "openbabel-${lib.replaceStrings ["."] ["-"] version}";
+    sha256 = "sha256-+pXsWMzex7rB1mm6dnTHzAcyw9jImgx1OZuLeCvbeJ0=";
+  };
+
+  patches = [
+    # ARM / AArch64 fixes.
+    (fetchpatch {
+      url = "https://github.com/openbabel/openbabel/commit/ee11c98a655296550710db1207b294f00e168216.patch";
+      sha256 = "0wjqjrkr4pfirzzicdvlyr591vppydk572ix28jd2sagnfnf566g";
+    })
+  ];
+
+  postPatch = ''
+    sed '1i#include <ctime>' -i include/openbabel/obutil.h # gcc12
+  '';
+
+  buildInputs = [ zlib libxml2 eigen python3 cairo pcre ];
+
+  nativeBuildInputs = [ cmake pkg-config ];
+
+  meta = with lib; {
+    description = "A toolbox designed to speak the many languages of chemical data";
+    homepage = "http://openbabel.org";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ danielbarter ];
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openbabel/default.nix b/nixpkgs/pkgs/development/libraries/openbabel/default.nix
new file mode 100644
index 000000000000..f472f7b06364
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openbabel/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, lib, fetchFromGitHub, cmake, perl, zlib, libxml2, eigen, python, cairo, pcre, pkg-config, swig, rapidjson }:
+
+stdenv.mkDerivation rec {
+  pname = "openbabel";
+  version = "unstable-06-12-23";
+
+  src = fetchFromGitHub {
+    owner = "openbabel";
+    repo = pname;
+    rev = "32cf131444c1555c749b356dab44fb9fe275271f";
+    hash = "sha256-V0wrZVrojCZ9Knc5H6cPzPoYWVosRZ6Sn4PX+UFEfHY=";
+  };
+
+  postPatch = ''
+    sed '1i#include <ctime>' -i include/openbabel/obutil.h # gcc12
+  '';
+
+  buildInputs = [ perl zlib libxml2 eigen python cairo pcre swig rapidjson ];
+
+  nativeBuildInputs = [ cmake pkg-config ];
+
+  pythonMajorMinor = "${python.sourceVersion.major}.${python.sourceVersion.minor}";
+
+  cmakeFlags = [
+    "-DRUN_SWIG=ON"
+    "-DPYTHON_BINDINGS=ON"
+  ];
+
+  # 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
+
+    setup(
+        name = 'pyopenbabel',
+        version = '3.2b1',
+        packages = ['openbabel'],
+        package_data = {'openbabel' : ['_openbabel.so']}
+    )
+    EOF
+  '';
+
+  meta = with lib; {
+    description = "A toolbox designed to speak the many languages of chemical data";
+    homepage = "http://openbabel.org";
+    platforms = platforms.all;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ danielbarter ];
+  };
+}