From 8e3f5d5e9f32460577cceca6ac7ade12adae5a19 Mon Sep 17 00:00:00 2001 From: Eleni Mathioulaki <emathioulaki@athenarc.gr> Date: Tue, 21 Nov 2023 15:07:00 +0200 Subject: [PATCH] fix openbabel build failure with gcc12 --- packages/openbabel/gcc12-cmake.patch | 37 ++++++++++++++++++++++++++++ packages/openbabel/package.py | 3 +++ 2 files changed, 40 insertions(+) create mode 100644 packages/openbabel/gcc12-cmake.patch diff --git a/packages/openbabel/gcc12-cmake.patch b/packages/openbabel/gcc12-cmake.patch new file mode 100644 index 00000000..c568c899 --- /dev/null +++ b/packages/openbabel/gcc12-cmake.patch @@ -0,0 +1,37 @@ +From c0570bfeb2d7e0a6a6de1f257cf28e7f3cac8739 Mon Sep 17 00:00:00 2001 +From: Sam James <sam@gentoo.org> +Date: Sun, 12 Jun 2022 11:23:59 +0100 +Subject: [PATCH] CMake: fix time check typo (fixes build failure w/ GCC 12) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Without this fixed check, we get a build failure with GCC 12: +``` +/var/tmp/portage/sci-chemistry/openbabel-3.1.1_p20210225/work/openbabel-08e23f39b0cc39b4eebd937a5a2ffc1a7bac3e1b/include/openbabel/obutil.h:65:14: error: �~@~Xclock�~@~Y was not declared in this scope; did you mean �~@~Xclock_t�~@~Y? + 65 | start= clock(); + | ^~~~~ + | clock_t +``` + +Bug: https://bugs.gentoo.org/851510 +--- + src/config.h.cmake | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/config.h.cmake b/src/config.h.cmake +index 1c59c67699..26e5dde94f 100644 +--- a/src/config.h.cmake ++++ b/src/config.h.cmake +@@ -182,8 +182,8 @@ + #define OB_MODULE_PATH "@OB_MODULE_PATH@" + + #ifndef TIME_WITH_SYS_TIME +- #ifdef HAVE_SYS_TIME +- #ifdef HAVE_TIME ++ #ifdef HAVE_SYS_TIME_H ++ #ifdef HAVE_TIME_H + #define TIME_WITH_SYS_TIME 1 + #else + #define TIME_WITH_SYS_TIME 0 + diff --git a/packages/openbabel/package.py b/packages/openbabel/package.py index 37be524c..ea99f8d4 100644 --- a/packages/openbabel/package.py +++ b/packages/openbabel/package.py @@ -58,6 +58,9 @@ class Openbabel(CMakePackage): # Convert tabs to spaces. Allows unit tests to pass patch("testpdbformat-tabs-to-spaces.patch", when="@:2.4.1") + # CMake: fix time check typo (fixes build failure w/ GCC 12) + patch("gcc12-cmake.patch", when="@:3.1.1") + def cmake_args(self): spec = self.spec args = [] -- GitLab