openbabel: unstable-06-12-23 -> 3.1.1-unstable-2024-12-21, fix build with CMake 4 (#443853)

This commit is contained in:
K900
2025-09-18 05:42:49 +00:00
committed by GitHub
11 changed files with 187 additions and 191 deletions
+21 -3
View File
@@ -1,5 +1,6 @@
{
fetchFromGitHub,
fetchpatch,
lib,
stdenv,
boost,
@@ -19,6 +20,14 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-casFPNbPv9mkKpzfBENW7INClypuCO1L7clLGBXvSvI=";
};
patches = [
(fetchpatch {
name = "coordgenlibs-fix-unused-but-set-variable.patch";
url = "https://github.com/schrodinger/coordgenlibs/commit/6a1485643feb71c6d609d263f28751004c733cf7.patch";
hash = "sha256-x34v+XumVip43LYb4bEkdqPFcTRTeC/zsRuQjnrh2zw=";
})
];
nativeBuildInputs = [ cmake ];
buildInputs = [
boost
@@ -26,12 +35,21 @@ stdenv.mkDerivation (finalAttrs: {
maeparser
];
env = lib.optionalAttrs stdenv.cc.isClang {
NIX_CFLAGS_COMPILE = "-Wno-unused-but-set-variable";
};
# Fix the build with CMake 4.
#
# See: <https://github.com/schrodinger/coordgenlibs/pull/130>
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail \
'cmake_minimum_required(VERSION 3.2)' \
'cmake_minimum_required(VERSION 3.5)'
'';
doCheck = true;
# Fix the build with Clang 20.
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=deprecated-literal-operator";
meta = with lib; {
description = "Schrodinger-developed 2D Coordinate Generation";
homepage = "https://github.com/schrodinger/coordgenlibs";
@@ -0,0 +1,77 @@
From fda825d390af8b5eaf79d7b7c39c19ab5ce317ac Mon Sep 17 00:00:00 2001
From: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Date: Wed, 26 Mar 2025 10:24:42 +0000
Subject: [PATCH] cmake4 compat :
* up cmake_minimum_required to 3.10
* delete CMP0042 because OLD behavior is removed in cmake-4 and
is no longer used.
* set ENABLE_EXPORTS for test_runner (OLD behavior for CMP0065 is removed
in cmake4)
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
---
CMakeLists.txt | 7 ++-----
doc/examples/static_executable/CMakeLists.txt | 2 +-
scripts/CMakeLists.txt | 2 +-
test/CMakeLists.txt | 1 +
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d2a9f143e..f8440e412e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
-# Please ensure that any changes remain compliant with 3.1.
+# Please ensure that any changes remain compliant with 3.10.
if(NOT EMBED_OPENBABEL)
- cmake_minimum_required(VERSION 3.1)
+ cmake_minimum_required(VERSION 3.10)
endif()
project(openbabel)
@@ -10,9 +10,6 @@ set (CMAKE_CXX_STANDARD 11)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
- if(POLICY CMP0042)
- cmake_policy(SET CMP0042 OLD)
- endif()
endif()
include (CheckCXXCompilerFlag)
diff --git a/doc/examples/static_executable/CMakeLists.txt b/doc/examples/static_executable/CMakeLists.txt
index 0ed21beaaf..63dae2a468 100644
--- a/doc/examples/static_executable/CMakeLists.txt
+++ b/doc/examples/static_executable/CMakeLists.txt
@@ -25,7 +25,7 @@
#
# This line is required for cmake backwards compatibility.
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 3.10)
# Name of your project
project(myproject)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 792e4592d0..eafda66c5a 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.6.0)
+cmake_minimum_required(VERSION 3.10.0)
# Library versioning (used in Mac Python bindings)x
set(SOVERSION 4)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2ecf0dbe22..280eac471f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -152,6 +152,7 @@ endif()
add_executable(test_runner ${srclist} obtest.cpp)
target_link_libraries(test_runner ${libs})
+set_target_properties(test_runner PROPERTIES ENABLE_EXPORTS TRUE)
if(NOT BUILD_SHARED AND NOT BUILD_MIXED)
set_target_properties(test_runner PROPERTIES LINK_SEARCH_END_STATIC TRUE)
+84
View File
@@ -0,0 +1,84 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
ninja,
perl,
zlib,
libxml2,
eigen,
python3,
cairo,
pkg-config,
swig,
rapidjson,
boost,
maeparser,
coordgenlibs,
ctestCheckHook,
}:
stdenv.mkDerivation {
pname = "openbabel";
version = "3.1.1-unstable-2024-12-21";
src = fetchFromGitHub {
owner = "openbabel";
repo = "openbabel";
rev = "889c350feb179b43aa43985799910149d4eaa2bc";
hash = "sha256-pJbvKBjpvXNjTZRxD2AqEarqmq+Pq08uvGvog/k/a7k=";
};
patches = [
# <https://github.com/openbabel/openbabel/pull/2784>
./fix-cmake-4.patch
];
nativeBuildInputs = [
cmake
ninja
swig
pkg-config
];
buildInputs = [
perl
zlib
libxml2
eigen
python3
cairo
rapidjson
boost
maeparser
coordgenlibs
];
nativeCheckInputs = [
ctestCheckHook
];
cmakeFlags = [
(lib.cmakeBool "RUN_SWIG" true)
(lib.cmakeBool "PYTHON_BINDINGS" true)
(lib.cmakeFeature "PYTHON_INSTDIR" "${placeholder "out"}/${python3.sitePackages}")
];
disabledTests = [
"test_cifspacegroup_11"
"pybindtest_obconv_writers"
];
doCheck = true;
dontUseNinjaCheck = true;
meta = {
description = "Toolbox designed to speak the many languages of chemical data";
homepage = "http://openbabel.org";
platforms = lib.platforms.all;
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ danielbarter ];
};
}
@@ -1,62 +0,0 @@
{
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
];
cmakeFlags = [ "-DCMAKE_CXX_STANDARD=14" ];
nativeBuildInputs = [
cmake
pkg-config
];
meta = with lib; {
description = "Toolbox designed to speak the many languages of chemical data";
homepage = "http://openbabel.org";
platforms = platforms.all;
maintainers = with maintainers; [ danielbarter ];
license = licenses.gpl2Plus;
};
}
@@ -1,84 +0,0 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
perl,
zlib,
libxml2,
eigen,
python3,
cairo,
pkg-config,
swig,
rapidjson,
boost,
maeparser,
coordgenlibs,
}:
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
python3
cairo
rapidjson
boost
maeparser
coordgenlibs
];
nativeBuildInputs = [
cmake
swig
pkg-config
];
preConfigure = ''
cmakeFlagsArray+=(
"-DRUN_SWIG=ON"
"-DPYTHON_BINDINGS=ON"
"-DPYTHON_INSTDIR=$out/${python3.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/${python3.sitePackages}/setup.py
from setuptools import setup
setup(
name = 'pyopenbabel',
version = '3.2b1',
packages = ['openbabel'],
package_data = {'openbabel' : ['_openbabel.so']}
)
EOF
'';
meta = with lib; {
description = "Toolbox designed to speak the many languages of chemical data";
homepage = "http://openbabel.org";
platforms = platforms.all;
license = licenses.gpl2Plus;
maintainers = with maintainers; [ danielbarter ];
};
}
@@ -20,7 +20,7 @@
let
pythonWP = python3.withPackages (
p: with p; [
openbabel-bindings
openbabel
numpy
]
);
@@ -1,32 +0,0 @@
{
lib,
openbabel,
python,
buildPythonPackage,
}:
buildPythonPackage {
format = "setuptools";
inherit (openbabel) pname version;
src = "${openbabel}/${python.sitePackages}";
buildInputs = [ openbabel ];
# these env variables are used by the bindings to find libraries
# they need to be included explicitly in your nix-shell for
# some functionality to work (inparticular, pybel).
# see https://openbabel.org/docs/dev/Installation/install.html
BABEL_LIBDIR = "${openbabel}/lib/openbabel/3.1.0";
LD_LIBRARY_PATH = "${openbabel}/lib";
doCheck = false;
pythonImportsCheck = [ "openbabel" ];
meta = with lib; {
homepage = "http://openbabel.org/wiki/Main_Page";
description = "Python bindings for openbabel";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ danielbarter ];
};
}
+2
View File
@@ -1860,6 +1860,8 @@ mapAliases {
onevpl-intel-gpu = lib.warnOnInstantiate "onevpl-intel-gpu has been renamed to vpl-gpu-rt" vpl-gpu-rt; # Added 2024-06-04
openai-triton-llvm = triton-llvm; # added 2024-07-18
openai-whisper-cpp = whisper-cpp; # Added 2024-12-13
openbabel2 = throw "openbabel2 has been removed, as it was unused and unmaintained upstream; please use openbabel"; # Added 2025-09-17
openbabel3 = openbabel; # Added 2025-09-17
opencv2 = throw "opencv2 has been removed as it is obsolete and was not used by any other package; please migrate to OpenCV 4"; # Added 2024-08-20
opencv3 = throw "opencv3 has been removed as it is obsolete and was not used by any other package; please migrate to OpenCV 4"; # Added 2024-08-20
openafs_1_8 = openafs; # Added 2022-08-22
-6
View File
@@ -8499,12 +8499,6 @@ with pkgs;
openal = openalSoft;
openbabel = openbabel3;
openbabel2 = callPackage ../development/libraries/openbabel/2.nix { };
openbabel3 = callPackage ../development/libraries/openbabel { };
opencascade-occt_7_6 = opencascade-occt.overrideAttrs rec {
pname = "opencascade-occt";
version = "7.6.2";
+1
View File
@@ -494,6 +494,7 @@ mapAliases ({
openai-triton-cuda = triton-cuda; # added 2024-07-18
openai-triton-no-cuda = triton-no-cuda; # added 2024-07-18
openapi-schema-pydantic = throw "openapi-schema-pydantic has been removed, since it is no longer maintained"; # added 2023-10-30
openbabel-bindings = openbabel; # added 2025-09-17
opencv3 = throw "opencv3 has been removed as it is obsolete"; # added 2023-10-12
openllm = throw "openllm has moved to pkgs.openllm"; # added 2021-12-31
openllm-client = throw "openllm-client has been removed, since it is abandoned due to a change in philosophy"; # added 2024-08-24
+1 -3
View File
@@ -10934,9 +10934,7 @@ self: super: with self; {
openapi3 = callPackage ../development/python-modules/openapi3 { };
openbabel-bindings = callPackage ../development/python-modules/openbabel-bindings {
openbabel = pkgs.openbabel.override { python3 = python; };
};
openbabel = toPythonModule (pkgs.openbabel.override { python3 = python; });
opencamlib = callPackage ../development/python-modules/opencamlib { };