Fix for #1624 by using CMake's version parsing. Also move to using CMake's internal version comparison operators.mhiretskiy
parent
2edd041638
commit
df3a9cff3f
@ -0,0 +1 @@
|
||||
DIST openbabel-2.4.1.tar.gz 11618304 BLAKE2B 8fc051e83add9be6456e281a109bd6bbec282a64ffc83309819f0decbf167b4914fbb7f1966e95e103f268754045b804317f51c79a952ace707c6af2bd320125 SHA512 427e678f0a911bd27b9a8a05e60b6e09f113be4e5dd180daaf80c28d06368e52b57501261755ab3817a8d31f2754db24471fd0ceee706d029386d6f70800e9c6
|
@ -0,0 +1,13 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 0ee545cf..7f4b944e 100755
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -239,7 +239,7 @@ check_type_size(clock_t CLOCK_T)
|
||||
# Get the GCC version - from KDE4 cmake files
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
|
||||
- string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
|
||||
+ string(REGEX MATCH "[34567]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
|
||||
# gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
|
||||
# patch level, handle this here:
|
||||
if (NOT _gcc_version)
|
@ -0,0 +1,199 @@
|
||||
From 00120f89cf62b121c30d0b2a891b159e19b53624 Mon Sep 17 00:00:00 2001
|
||||
From: David Hall <david@acpharis.com>
|
||||
Date: Mon, 4 Sep 2017 00:30:10 +0000
|
||||
Subject: [PATCH] Compiler version parsing and comparison from CMake 2.8
|
||||
|
||||
Fix for #1624 by using CMake's version parsing. Also move to using
|
||||
CMake's internal version comparison operators.
|
||||
---
|
||||
CMakeLists.txt | 35 ++++----
|
||||
cmake/modules/MacroEnsureVersion.cmake | 117 -------------------------
|
||||
2 files changed, 17 insertions(+), 135 deletions(-)
|
||||
delete mode 100644 cmake/modules/MacroEnsureVersion.cmake
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b28ca09ce..1c3adfee7 100755
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,16 +1,11 @@
|
||||
-# Please ensure that any changes remain compliant with 2.4.8.
|
||||
+# Please ensure that any changes remain compliant with 2.8.10.
|
||||
if(NOT EMBED_OPENBABEL)
|
||||
- cmake_minimum_required(VERSION 2.4.8)
|
||||
+ cmake_minimum_required(VERSION 2.8.10)
|
||||
endif()
|
||||
|
||||
project(openbabel)
|
||||
set(CMAKE_MODULE_PATH ${openbabel_SOURCE_DIR}/cmake/modules)
|
||||
|
||||
-# Allow loose loop constructs, i.e. no matching in if/else/endif or loops.
|
||||
-# Note that this is true by default in CMake 2.6.0, but we currently only
|
||||
-# require CMake 2.4.8 - remove this when the CMake requirement is bumped.
|
||||
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1)
|
||||
-
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
cmake_policy(SET CMP0005 OLD) # add_definitions need updating to set to NEW
|
||||
@@ -20,7 +15,6 @@ if(COMMAND cmake_policy)
|
||||
endif()
|
||||
|
||||
include (CheckCXXCompilerFlag)
|
||||
-include (MacroEnsureVersion)
|
||||
|
||||
# Version numbering - should be bumped for each release
|
||||
# Note that for "beta" releases, we should start at x.90.0 -- we've
|
||||
@@ -239,16 +233,21 @@ check_type_size(clock_t CLOCK_T)
|
||||
|
||||
# Get the GCC version - from KDE4 cmake files
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
- exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
|
||||
- string(REGEX MATCH "[34567]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
|
||||
- # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
|
||||
- # patch level, handle this here:
|
||||
- if (NOT _gcc_version)
|
||||
- string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
|
||||
- endif ()
|
||||
- macro_ensure_version("4.0.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_0)
|
||||
- macro_ensure_version("4.1.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_1)
|
||||
- macro_ensure_version("4.2.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_2)
|
||||
+ if(NOT(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.0.0))
|
||||
+ set(GCC_IS_NEWER_THAN_4_0 TRUE)
|
||||
+ else()
|
||||
+ set(GCC_IS_NEWER_THAN_4_0 FALSE)
|
||||
+ endif()
|
||||
+ if(NOT(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.1.0))
|
||||
+ set(GCC_IS_NEWER_THAN_4_1 TRUE)
|
||||
+ else()
|
||||
+ set(GCC_IS_NEWER_THAN_4_1 FALSE)
|
||||
+ endif()
|
||||
+ if(NOT(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.2.0))
|
||||
+ set(GCC_IS_NEWER_THAN_4_2 TRUE)
|
||||
+ else()
|
||||
+ set(GCC_IS_NEWER_THAN_4_2 FALSE)
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
diff --git a/cmake/modules/MacroEnsureVersion.cmake b/cmake/modules/MacroEnsureVersion.cmake
|
||||
deleted file mode 100644
|
||||
index 6797e5b7d..000000000
|
||||
--- a/cmake/modules/MacroEnsureVersion.cmake
|
||||
+++ /dev/null
|
||||
@@ -1,117 +0,0 @@
|
||||
-# This file defines the following macros for developers to use in ensuring
|
||||
-# that installed software is of the right version:
|
||||
-#
|
||||
-# MACRO_ENSURE_VERSION - test that a version number is greater than
|
||||
-# or equal to some minimum
|
||||
-# MACRO_ENSURE_VERSION_RANGE - test that a version number is greater than
|
||||
-# or equal to some minimum and less than some
|
||||
-# maximum
|
||||
-# MACRO_ENSURE_VERSION2 - deprecated, do not use in new code
|
||||
-#
|
||||
-
|
||||
-# MACRO_ENSURE_VERSION
|
||||
-# This macro compares version numbers of the form "x.y.z" or "x.y"
|
||||
-# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
|
||||
-# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
|
||||
-# Leading and trailing text is ok, e.g.
|
||||
-# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
|
||||
-# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
|
||||
-
|
||||
-# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
-#
|
||||
-# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
-
|
||||
-# MACRO_ENSURE_VERSION_RANGE
|
||||
-# This macro ensures that a version number of the form
|
||||
-# "x.y.z" or "x.y" falls within a range defined by
|
||||
-# min_version <= found_version < max_version.
|
||||
-# If this expression holds, FOO_VERSION_OK will be set TRUE
|
||||
-#
|
||||
-# Example: MACRO_ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK )
|
||||
-#
|
||||
-# This macro will break silently if any of x,y,z are greater than 100.
|
||||
-#
|
||||
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
-#
|
||||
-# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
-
|
||||
-# NORMALIZE_VERSION
|
||||
-# Helper macro to convert version numbers of the form "x.y.z"
|
||||
-# to an integer equal to 10^4 * x + 10^2 * y + z
|
||||
-#
|
||||
-# This macro will break silently if any of x,y,z are greater than 100.
|
||||
-#
|
||||
-# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
-#
|
||||
-# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
-
|
||||
-# CHECK_RANGE_INCLUSIVE_LOWER
|
||||
-# Helper macro to check whether x <= y < z
|
||||
-#
|
||||
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
-#
|
||||
-# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
-
|
||||
-
|
||||
-MACRO(NORMALIZE_VERSION _requested_version _normalized_version)
|
||||
- STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}")
|
||||
- if (_threePartMatch)
|
||||
- # parse the parts of the version string
|
||||
- STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}")
|
||||
- STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}")
|
||||
- STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}")
|
||||
- else (_threePartMatch)
|
||||
- STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}")
|
||||
- STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}")
|
||||
- set(_patch_vers "0")
|
||||
- endif (_threePartMatch)
|
||||
-
|
||||
- # compute an overall version number which can be compared at once
|
||||
- MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}")
|
||||
-ENDMACRO(NORMALIZE_VERSION)
|
||||
-
|
||||
-MACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok)
|
||||
- if (${_value} LESS ${_lower_limit})
|
||||
- set( ${_ok} FALSE )
|
||||
- elseif (${_value} EQUAL ${_lower_limit})
|
||||
- set( ${_ok} TRUE )
|
||||
- elseif (${_value} EQUAL ${_upper_limit})
|
||||
- set( ${_ok} FALSE )
|
||||
- elseif (${_value} GREATER ${_upper_limit})
|
||||
- set( ${_ok} FALSE )
|
||||
- else (${_value} LESS ${_lower_limit})
|
||||
- set( ${_ok} TRUE )
|
||||
- endif (${_value} LESS ${_lower_limit})
|
||||
-ENDMACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER)
|
||||
-
|
||||
-MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
|
||||
- NORMALIZE_VERSION( ${requested_version} req_vers_num )
|
||||
- NORMALIZE_VERSION( ${found_version} found_vers_num )
|
||||
-
|
||||
- if (found_vers_num LESS req_vers_num)
|
||||
- set( ${var_too_old} FALSE )
|
||||
- else (found_vers_num LESS req_vers_num)
|
||||
- set( ${var_too_old} TRUE )
|
||||
- endif (found_vers_num LESS req_vers_num)
|
||||
-
|
||||
-ENDMACRO(MACRO_ENSURE_VERSION)
|
||||
-
|
||||
-MACRO(MACRO_ENSURE_VERSION2 requested_version2 found_version2 var_too_old2)
|
||||
- MACRO_ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2})
|
||||
-ENDMACRO(MACRO_ENSURE_VERSION2)
|
||||
-
|
||||
-MACRO(MACRO_ENSURE_VERSION_RANGE min_version found_version max_version var_ok)
|
||||
- NORMALIZE_VERSION( ${min_version} req_vers_num )
|
||||
- NORMALIZE_VERSION( ${found_version} found_vers_num )
|
||||
- NORMALIZE_VERSION( ${max_version} max_vers_num )
|
||||
-
|
||||
- MACRO_CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok})
|
||||
-ENDMACRO(MACRO_ENSURE_VERSION_RANGE)
|
||||
-
|
||||
-
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="project">
|
||||
<email>sci-chemistry@gentoo.org</email>
|
||||
<name>Gentoo Chemistry Project</name>
|
||||
</maintainer>
|
||||
<longdescription>
|
||||
OpenBabel is a chemical toolbox designed to speak the many languages of
|
||||
chemical data. It's an open, collaborative project allowing anyone to
|
||||
search, convert, analyze, or store data from molecular modeling, chemistry,
|
||||
solid-state materials, biochemistry, or related areas. This package enables
|
||||
to access OpenBabel library from Python programs.
|
||||
</longdescription>
|
||||
<upstream>
|
||||
<remote-id type="sourceforge">openbabel</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
@ -0,0 +1,92 @@
|
||||
# Copyright 1999-2017 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=6
|
||||
|
||||
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
|
||||
|
||||
inherit cmake-utils python-r1
|
||||
|
||||
DESCRIPTION="Python bindings for OpenBabel (including Pybel)"
|
||||
HOMEPAGE="http://openbabel.sourceforge.net/"
|
||||
SRC_URI="mirror://sourceforge/openbabel/openbabel-${PV}.tar.gz"
|
||||
|
||||
KEYWORDS="amd64 ~arm x86 ~amd64-linux ~x86-linux"
|
||||
SLOT="0/5"
|
||||
LICENSE="GPL-2"
|
||||
IUSE=""
|
||||
|
||||
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
||||
|
||||
RDEPEND="${PYTHON_DEPS}
|
||||
~sci-chemistry/openbabel-${PV}
|
||||
sys-libs/zlib"
|
||||
DEPEND="${RDEPEND}
|
||||
>=dev-lang/swig-2"
|
||||
|
||||
S="${WORKDIR}"/openbabel-${PV}
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.3.2-gcc-6_and_7-backport.patch
|
||||
"${FILESDIR}"/${PN}-2.4.1-fix_cmake.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
cmake-utils_src_prepare
|
||||
sed \
|
||||
-e "s:\"\.\.\":\"${EPREFIX}/usr\":g" \
|
||||
-i test/testbabel.py || die
|
||||
swig -python -c++ -small -O -templatereduce -naturalvar \
|
||||
-I"${EPREFIX}/usr/include/openbabel-2.0" \
|
||||
-o scripts/python/openbabel-python.cpp \
|
||||
-DHAVE_EIGEN \
|
||||
-outdir scripts/python \
|
||||
scripts/openbabel-python.i \
|
||||
|| die "Regeneration of openbabel-python.cpp failed"
|
||||
sed \
|
||||
-e '/__GNUC__/s:== 4:>= 4:g' \
|
||||
-i include/openbabel/shared_ptr.h || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
my_impl_src_configure() {
|
||||
local mycmakeargs=(
|
||||
-DCMAKE_INSTALL_RPATH=
|
||||
-DBINDINGS_ONLY=ON
|
||||
-DBABEL_SYSTEM_LIBRARY="${EPREFIX}/usr/$(get_libdir)/libopenbabel.so"
|
||||
-DOB_MODULE_PATH="${EPREFIX}/usr/$(get_libdir)/openbabel/${PV}"
|
||||
-DLIB_INSTALL_DIR="${D}$(python_get_sitedir)"
|
||||
-DPYTHON_BINDINGS=ON
|
||||
-DPYTHON_EXECUTABLE=${PYTHON}
|
||||
-DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
|
||||
-DPYTHON_INCLUDE_PATH="$(python_get_includedir)"
|
||||
-DPYTHON_LIBRARY="$(python_get_library_path)"
|
||||
-DENABLE_TESTS=ON
|
||||
-DCMAKE_INSTALL_PREFIX="${ED%/}/usr"
|
||||
)
|
||||
|
||||
cmake-utils_src_configure
|
||||
}
|
||||
|
||||
python_foreach_impl my_impl_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
python_foreach_impl cmake-utils_src_make bindings_python
|
||||
}
|
||||
|
||||
src_test() {
|
||||
python_foreach_impl cmake-utils_src_test -R py
|
||||
}
|
||||
|
||||
src_install() {
|
||||
my_impl_src_install() {
|
||||
cd "${BUILD_DIR}" || die
|
||||
|
||||
cmake -DCOMPONENT=bindings_python -P cmake_install.cmake
|
||||
|
||||
python_optimize
|
||||
}
|
||||
|
||||
python_foreach_impl my_impl_src_install
|
||||
}
|
Loading…
Reference in new issue