Blame python-graph-tool.spec

564204d
# Koji has two types of builders:
564204d
# 16Gb + 6 cores
564204d
# 128Gb + 48 cores
564204d
# There's no way to choose either, so we rely on luck
564204d
#
564204d
# This needs about 15 gigs per thread, otherwise OOMs. So, we calculate the number of threads we can afford to use for make:
564204d
# meminfo gives output in kB (1000 bytes)
ed6313d
%global numthreads %(awk '/MemTotal:/ {print int($2/15e6)}' /proc/meminfo)
564204d
# But make sure it is > 0
564204d
%if 0%{numthreads} == 0
564204d
%global numthreads 1
564204d
%endif
564204d
564204d
# If _smp_build_ncpus is not defined (on older rpms)
564204d
# assume there's only one
564204d
%if 0%{?_smp_build_ncpus} == 0
564204d
%global _smp_build_ncpus 1
564204d
%endif
564204d
564204d
# Use the smaller number of threads
564204d
%if 0%{numthreads} > 0%{?_smp_build_ncpus}
564204d
%global numthreads %{?_smp_build_ncpus}
564204d
%endif
564204d
b20f124
# Builds fail with LTO
b20f124
%global _lto_cflags %{nil}
b20f124
564204d
%global _description %{expand:
564204d
Graph-tool is an efficient Python module for manipulation and statistical
564204d
analysis of graphs (a.k.a. networks). Contrary to most other python modules
564204d
with similar functionality, the core data structures and algorithms are
564204d
implemented in C++, making extensive use of template metaprogramming, based
564204d
heavily on the Boost Graph Library. This confers it a level of performance that
564204d
is comparable (both in memory usage and computation time) to that of a pure
564204d
C/C++ library.
564204d
564204d
Please refer to https://graph-tool.skewed.de/static/doc/index.html for
564204d
documentation.}
564204d
ae3baf0
Name:           python-graph-tool
3f5393a
Version:        2.43
4295705
Release:        %autorelease
564204d
Summary:        Efficient network analysis tool written in Python
564204d
2ed0ef0
# The entire source is LGPL-3.0-or-later, except:
2ed0ef0
#   - BSL-1.0: src/boost-workaround/
2ed0ef0
#              src/graph/graphml.cpp
2ed0ef0
#              src/graph/read_graphviz_new.cpp
2ed0ef0
# Additionally, the following are under other licenses but do not contribute to
2ed0ef0
# the licenses of the binary RPMs:
2ed0ef0
#   - FSFULLR: aclocal.m4
2ed0ef0
#   - FSFUL (or perhaps FSFUL AND LGPL-3.0-or-later): configure
2ed0ef0
#   - GPL-2.0-or-later: build-aux/compile
2ed0ef0
#                       build-aux/depcomp
2ed0ef0
#                       build-aux/ltmain.sh
2ed0ef0
#                       build-aux/py-compile
2ed0ef0
#                       m4/ax_boost_python.m4
2ed0ef0
#   - GPL-3.0-or-later: build-aux/config.guess
2ed0ef0
#                       build-aux/config.sub
2ed0ef0
#                       m4/ax_create_pkgconfig_info.m4
2ed0ef0
#                       m4/ax_openmp.m4
2ed0ef0
#                       m4/ax_python_devel.m4
2ed0ef0
#   - X11: build-aux/install-sh
2ed0ef0
#   - FSFAP: m4/ax_boost_base.m4
2ed0ef0
#            m4/ax_boost_context.m4
2ed0ef0
#            m4/ax_boost_coroutine.m4
2ed0ef0
#            m4/ax_boost_graph.m4
2ed0ef0
#            m4/ax_boost_iostreams.m4
2ed0ef0
#            m4/ax_boost_regex.m4
2ed0ef0
#            m4/ax_boost_thread.m4
2ed0ef0
#            m4/ax_cxx_compile_stdcxx.m4,
2ed0ef0
#            m4/ax_cxx_compile_stdcxx_17.m4
2ed0ef0
#            m4/ax_lib_cgal_core.m4
2ed0ef0
#            m4/ax_python_module.m4
2ed0ef0
License:        LGPL-3.0-or-later AND BSL-1.0
564204d
URL:            https://graph-tool.skewed.de/
ae3baf0
Source0:        https://downloads.skewed.de/graph-tool/graph-tool-%{version}.tar.bz2
3f5393a
# Remove the compilation flags upstream sets
3f5393a
Patch0:         0001-remove-upstream-compilation-flags.patch
564204d
d41b471
# Need to reduce debugging symbols to make compiling possible on these
d41b471
# architectures at all. See:
d41b471
#   https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/GIBNORLNGSUHAMX6PZ7XUPQ2SQUK7AX4/
d41b471
#
d41b471
# Works around:
d41b471
# Fails on armv7hl:
d41b471
#   virtual memory exhausted
15648c6
# https://bugzilla.redhat.com/show_bug.cgi?id=1771024
cbdaebc
%ifarch armv7hl
d41b471
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
d41b471
%endif
d41b471
d41b471
# Fails on i686, armv7hl
d41b471
#   ../../../src/pcg-cpp/include/pcg_random.hpp:1247:40: error: call to
d41b471
#       non-'constexpr' function 'pcg_extras::uint_x4<U, V>
d41b471
#       pcg_extras::operator-(const pcg_extras::uint_x4<U, V>&, const
d41b471
#       pcg_extras::uint_x4<U, V>&) [with UInt = unsigned int; UIntX2 = long
d41b471
#       long unsigned int]'
d41b471
#    1247 |         (state_type(1U) << table_pow2) - state_type(1U);
d41b471
#         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
d41b471
#   In file included from ../../../src/pcg-cpp/include/pcg_extras.hpp:84,
d41b471
#                    from ../../../src/pcg-cpp/include/pcg_random.hpp:114,
d41b471
#                    from ../../../src/graph/random.hh:21,
d41b471
#                    from graph_motifs.hh:26,
d41b471
#                    from graph_motifs.cc:24:
d41b471
#   ../../../src/pcg-cpp/include/pcg_uint128.hpp:642:22: note:
d41b471
#       'pcg_extras::uint_x4<U, V> pcg_extras::operator-(const
d41b471
#       pcg_extras::uint_x4<U, V>&, const pcg_extras::uint_x4<U, V>&) [with
d41b471
#       UInt = unsigned int; UIntX2 = long long unsigned int]' declared here
d41b471
#     642 | uint_x4<UInt,UIntX2> operator-(const uint_x4<UInt,UIntX2>& a,
d41b471
#         |                      ^~~~~~~~
d41b471
# issue filed: https://git.skewed.de/count0/graph-tool/issues/617
d41b471
# https://bugzilla.redhat.com/show_bug.cgi?id=1771023
d41b471
# https://bugzilla.redhat.com/show_bug.cgi?id=1771024
d41b471
#
d41b471
# Takes ~23 hours on x86_64 if we get unlucky and get a 6 core 16gig machine,
d41b471
#   ~4 hours if we get a 48 core 128gig machine
15648c6
# Takes ~45 hours on aarch64
0847f4b
ExcludeArch:    %{ix86} armv7hl
15648c6
3f5393a
BuildRequires:  make
564204d
BuildRequires:  git-core
564204d
BuildRequires:  autoconf
564204d
BuildRequires:  automake
564204d
BuildRequires:  libtool
ed6313d
BuildRequires:  gawk
564204d
564204d
%description %_description
564204d
7e9b2e3
ae3baf0
%package -n python3-graph-tool
564204d
Summary:        %{summary}
7e9b2e3
564204d
BuildRequires:  python3-devel
564204d
BuildRequires:  boost-devel
564204d
BuildRequires:  boost-python3-devel
564204d
BuildRequires:  CGAL-devel
0de7654
# CGAL is header-only since version 5.4.0, so we must BR the virtual -static
0de7654
# subpackage for tracking, per Fedora guidelines
0de7654
BuildRequires:  CGAL-static
5d3997b
BuildRequires:  pkgconfig(cairomm-1.0)
564204d
BuildRequires:  expat-devel
7e9b2e3
BuildRequires:  gcc-c++
564204d
BuildRequires:  gmp-devel
564204d
BuildRequires:  gtk3-devel
564204d
BuildRequires:  python3-cairo-devel
564204d
BuildRequires:  python3-devel
564204d
BuildRequires:  %{py3_dist scipy}
564204d
BuildRequires:  %{py3_dist matplotlib}
564204d
BuildRequires:  %{py3_dist numpy}
564204d
BuildRequires:  sparsehash-devel
7e9b2e3
# BR -static package of header-only libraries for tracking per guidelines
7e9b2e3
BuildRequires:  pcg-cpp-devel
7e9b2e3
BuildRequires:  pcg-cpp-static
564204d
564204d
Provides:       graph-tool%{?_isa} = %{version}-%{release}
564204d
ae3baf0
%description -n python3-graph-tool %_description
564204d
7e9b2e3
ae3baf0
%package -n python3-graph-tool-devel
7e9b2e3
Summary:        %{summary}
7e9b2e3
ae3baf0
Requires:       python3-graph-tool%{?_isa} = %{version}-%{release}
7e9b2e3
# Since this header-only package is re-exposed as part of the extension API,
7e9b2e3
# dependent packages should ideally also BuildRequire pcg-cpp-static for
7e9b2e3
# tracking, per guidelines.
13da695
Requires:       pcg-cpp-devel
7e9b2e3
7e9b2e3
Provides:       graph-tool-devel%{?_isa} = %{version}-%{release}
7e9b2e3
ae3baf0
%description -n python3-graph-tool-devel %_description
7e9b2e3
7e9b2e3
564204d
%prep
ae3baf0
%autosetup -S git -n graph-tool-%{version}
8e0ba16
# Remove shebangs from non-script sources
8e0ba16
#
8e0ba16
# The pattern of selecting files before modifying them with sed keeps us from
8e0ba16
# unnecessarily discarding the original mtimes on unmodified files.
7e9b2e3
find 'src' -type f -name '*.py' \
8e0ba16
    -exec gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' |
8e0ba16
  xargs -r sed -r -i '1{/^#!/d}'
8e0ba16
# Fix shebang(s) in sample script(s)
8e0ba16
%py3_shebang_fix doc
564204d
7e9b2e3
# Unbundle pcg-cpp. To avoid having to patch the Makefiles, we use symbolic
7e9b2e3
# links from the original locations. Note that these are followed when the
7e9b2e3
# extension API headers are installed, so we need to re-create them afterwards.
7e9b2e3
rm -vf src/pcg-cpp/include/*
7e9b2e3
ln -sv \
7e9b2e3
    '%{_includedir}/pcg_extras.hpp' \
7e9b2e3
    '%{_includedir}/pcg_random.hpp' \
7e9b2e3
    '%{_includedir}/pcg_uint128.hpp' \
7e9b2e3
    'src/pcg-cpp/include/'
7e9b2e3
5a77255
# Drop intersphinx mappings, since we can’t download remote inventories and
5a77255
# can’t easily produce working hyperlinks from inventories in local
5a77255
# documentation packages.
5a77255
echo 'intersphinx_mapping.clear()' >> doc/conf.py
5a77255
564204d
564204d
%build
9d80138
%if 0%{?fc38}
9d80138
# Workaround for CGAL/mpfr issue:
9d80138
#   Apparent incompatibility with mpfr 4.1.1 (compiler error)
9d80138
#   https://bugzilla.redhat.com/show_bug.cgi?id=2144197
9d80138
%set_build_flags
9d80138
export CPPFLAGS="${CPPFLAGS} -fpermissive"
9d80138
%endif
9d80138
564204d
./autogen.sh
f61c178
%configure \
f61c178
    --with-python-module-path=%{python3_sitearch} \
f61c178
    --with-boost-libdir=%{_libdir} \
f61c178
    --enable-debug
564204d
echo "Building with %{numthreads} of %{?_smp_build_ncpus} available CPUs"
564204d
# Uses the latest value set by -j
564204d
%make_build -j%{numthreads}
564204d
7e9b2e3
564204d
%install
564204d
%make_install
564204d
564204d
# Remove installed doc sources
ae3baf0
rm -rf %{buildroot}/%{_datadir}/doc/graph-tool
564204d
564204d
# Remove static objects
7e9b2e3
find %{buildroot} -name '*.la' -print -delete
7e9b2e3
7e9b2e3
# Restore symbolic links that were followed in “wheelification”
7e9b2e3
ln -svf \
7e9b2e3
    '%{_includedir}/pcg_extras.hpp' \
7e9b2e3
    '%{_includedir}/pcg_random.hpp' \
7e9b2e3
    '%{_includedir}/pcg_uint128.hpp' \
ae3baf0
    '%{buildroot}%{python3_sitearch}/graph_tool/include/pcg-cpp/'
564204d
564204d
ae3baf0
%files -n python3-graph-tool
11e6013
%license COPYING src/boost-workaround/LICENSE_1_0.txt
564204d
%doc README.md ChangeLog AUTHORS
3a5edd4
%{python3_sitearch}/graph_tool/
3a5edd4
%exclude %{python3_sitearch}/graph_tool/include/
7e9b2e3
7e9b2e3
ae3baf0
%files -n python3-graph-tool-devel
3a5edd4
%{python3_sitearch}/graph_tool/include/
ae3baf0
%{_libdir}/pkgconfig/graph-tool-py%{python3_version}.pc
564204d
7e9b2e3
564204d
%changelog
4295705
%autochangelog