Use CMake3 in EPEL7| Fix PPC64le builds (rhbz#1996330)

This commit is contained in:
Antonio Trande 2021-09-01 15:18:08 +02:00
parent eefb38117d
commit bc85ef2765
1 changed files with 56 additions and 15 deletions

View File

@ -6,24 +6,27 @@
# we don't want to provide private Perl or Python extension libs
%global __provides_exclude_from ^(%{perl_vendorarch}/auto|%{python3_sitearch})/.*\\.so$
%global __cmake_in_source_build 1
Name: openbabel
Version: 2.4.1
Release: 37%{?dist}
Release: 38%{?dist}
Summary: Chemistry software file format converter
License: GPLv2
URL: https://openbabel.org/
Source0: https://github.com/openbabel/openbabel/archive/openbabel-%(echo %{version} | tr '.' '-').tar.gz
Source1: obgui.desktop
# fix perl modules install path
Patch1: %{name}-perl.patch
Patch1: openbabel-perl.patch
# fix plugin directory location (#680292, patch by lg)
Patch4: openbabel-plugindir.patch
# fix SWIG_init even when not using swig (#772149)
Patch6: openbabel-noswig-rubymethod.patch
# On F-17, directory for C ruby files changed to use vendorarch directory
Patch7: openbabel-ruby19-vendorarch.patch
# temporarily disable some tests on:
# - ppc64 and s390(x) to unblock other builds (#1108103)
# - ARM (#1094491)
@ -31,18 +34,23 @@ Patch7: openbabel-ruby19-vendorarch.patch
# Upstream bugs: https://sourceforge.net/p/openbabel/bugs/927/ https://sourceforge.net/p/openbabel/bugs/945/
Patch8: openbabel-disable-tests.patch
Patch9: openbabel-narrowing-conversion.patch
# Fix path to libdir in .pc file
# https://bugzilla.redhat.com/show_bug.cgi?id=1669664
Patch10: openbabel-fix-libdir-in-pkgconfig.patch
# Math 4 test is failing on s390x only
Patch11: openbabel-disable-tests-s390x.patch
# Fix inconsistent whitespace
Patch12: openbabel-taberror.patch
# Fix import of dl module in python3.7
# https://github.com/openbabel/openbabel/pull/372
Patch13: openbabel-python-dl.patch
BuildRequires: make
BuildRequires: cmake
BuildRequires: cmake3
BuildRequires: dos2unix
BuildRequires: desktop-file-utils
BuildRequires: eigen3-devel
@ -162,6 +170,8 @@ dos2unix -k \
convert src/GUI/babel.xpm -transparent white babel.png
cp -p %{SOURCE1} obgui.desktop
# Remove duplicate html files
pushd doc
for man in *.1; do
@ -173,7 +183,15 @@ done
popd
%build
%cmake \
mkdir -p %{_target_platform}
%if 0%{?fedora} || 0%{?eln}
# RHBZ #1996330
%ifarch %{power64}
export CXXFLAGS="%{optflags} -DEIGEN_ALTIVEC_DISABLE_MMA"
%endif
%endif
%cmake3 -B %{_target_platform} \
-Wno-dev \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DBUILD_GUI:BOOL=ON \
-DPYTHON_BINDINGS:BOOL=ON \
@ -185,26 +203,45 @@ popd
-DRUN_SWIG=true \
-DENABLE_TESTS:BOOL=ON \
-DOPTIMIZE_NATIVE=OFF
%cmake_build
%make_build -C %{_target_platform}
%install
%cmake_install
%make_install -C %{_target_platform}
rm %{buildroot}%{_libdir}/cmake/openbabel2/*.cmake
rm -f %{buildroot}%{_libdir}/cmake/openbabel2/*.cmake
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications obgui.desktop
install -Dpm644 babel.png %{buildroot}%{_datadir}/pixmaps/babel.png
%if 1
%check
# rm the built ruby bindings for testsuite to succeed (bug #1191173)
rm %{_lib}/openbabel.so
export CTEST_OUTPUT_ON_FAILURE=1 PYTHONPATH=%{buildroot}%{python3_sitearch}
%make_build test
%define _vpath_builddir %{_target_platform}
pushd %{_vpath_builddir}
# rm the built ruby bindings for testsuite to succeed (Red Hat bugzilla ticket #1191173)
rm -f %{_lib}/openbabel.so
# needed by openbabel python module
cp -p %{_lib}/_openbabel.so ../scripts/python/
export CTEST_OUTPUT_ON_FAILURE=1
export PYTHONPATH=%{buildroot}%{python3_sitearch}
export LD_LIBRARY_PATH=%{buildroot}%{libdir}:%{buildroot}%{libdir}/openbabel:%{buildroot}%{perl_vendorarch}/*/Chemistry/OpenBabel:%{buildroot}%{ruby_vendorarchdir}
%if 0%{?el7}
ctest3 -j1 --force-new-ctest-process -E 'test_cifspacegroup_1|test_cifspacegroup_2'
%else
# See https://github.com/openbabel/openbabel/issues/2138
%ifarch aarch64 %{arm} %{power64} s390x
ctest3 -j1 --force-new-ctest-process -E 'pybindtest_bindings|pybindtest_obconv_writers'
%else
ctest3 -j1 --force-new-ctest-process
%endif
%endif
%endif
%if 0%{?el7}
%ldconfig_scriptlets libs
%endif
%files
%{_bindir}/babel
@ -248,6 +285,10 @@ export CTEST_OUTPUT_ON_FAILURE=1 PYTHONPATH=%{buildroot}%{python3_sitearch}
%{ruby_vendorarchdir}/openbabel.so
%changelog
* Wed Sep 01 2021 Antonio Trande <sagitter@fedoraproject.org> - 2.4.1-38
- Use CMake3 in EPEL7
- Fix PPC64le builds (rhbz#1996330)
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.1-37
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild