003f2b9
# Obsolete autotools m4 used
003f2b9
# https://github.com/INCF/libneurosim/issues/11
003f2b9
fc50732
%global commit 03646747c8fe64fa3439ac2d282623b659f60c22
003f2b9
%global shortcommit %(c=%{commit}; echo ${c:0:7})
003f2b9
003f2b9
%global _description \
003f2b9
libneurosim is a general library that provides interfaces and common utility \
003f2b9
code for neuronal simulators. \
003f2b9
\
003f2b9
Currently it provides the ConnectionGenerator interface. \
003f2b9
\
003f2b9
The ConnectionGenerator API is a standard interface supporting efficient \
003f2b9
generation of network connectivity during model setup in neuronal network \
003f2b9
simulators. It is intended as an abstraction isolating both sides of the API: \
003f2b9
any simulator can use a given connection generator and a given simulator can \
003f2b9
use any library providing the ConnectionGenerator interface. It was initially \
003f2b9
developed to support the use of libcsa from NEST.
003f2b9
72cf5a4
%bcond_without mpich
72cf5a4
%bcond_without openmpi
003f2b9
23fdcc5
# https://fedoraproject.org/wiki/Packaging:DistTag?rd=Packaging/DistTag#Conditionals
003f2b9
# Disabled for rawhide + F30
72cf5a4
%if 0%{?fedora} >= 30
72cf5a4
%bcond_with py2
23fdcc5
%else
72cf5a4
%bcond_without py2
23fdcc5
%endif
003f2b9
003f2b9
Name:           libneurosim
003f2b9
Version:        0
72cf5a4
Release:        4.20181124.git%{shortcommit}%{?dist}
003f2b9
Summary:        Common interfaces for neuronal simulators
003f2b9
003f2b9
License:        GPLv3+
003f2b9
URL:            https://github.com/INCF/%{name}
fc50732
Source0:        https://github.com/INCF/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
003f2b9
003f2b9
BuildRequires:  automake
003f2b9
BuildRequires:  autoconf
003f2b9
BuildRequires:  libtool-ltdl-devel
003f2b9
BuildRequires:  libtool
003f2b9
BuildRequires:  gcc-c++
003f2b9
BuildRequires:  python3-devel
003f2b9
72cf5a4
%if %{with py2}
003f2b9
BuildRequires:  python2-devel
003f2b9
%endif
003f2b9
003f2b9
# Pull in the common package
003f2b9
Requires:       %{name}-common = %{version}-%{release}
003f2b9
003f2b9
%description
003f2b9
%{_description}
003f2b9
003f2b9
%package        devel
003f2b9
Summary:        Development files for %{name}
003f2b9
Requires:       %{name}%{?_isa} = %{version}-%{release}
003f2b9
003f2b9
%description    devel
003f2b9
The %{name}-devel package contains libraries and header files for
003f2b9
developing applications that use %{name}.
003f2b9
003f2b9
%package        common
003f2b9
Summary:        Common files for %{name}
003f2b9
BuildArch:      noarch
003f2b9
003f2b9
%description    common
003f2b9
The %{name}-common package contains files required by all sub packages.
003f2b9
72cf5a4
%if %{with openmpi}
003f2b9
%package openmpi
003f2b9
Summary:        %{name} built with openmpi
003f2b9
BuildRequires:  openmpi-devel
003f2b9
BuildRequires:  rpm-mpi-hooks
003f2b9
Requires:       openmpi
003f2b9
Requires:       %{name}-common = %{version}-%{release}
003f2b9
%description openmpi
003f2b9
%{_description}
003f2b9
003f2b9
%package openmpi-devel
003f2b9
Summary:        %{name} built with openmpi
003f2b9
BuildRequires:  openmpi-devel
003f2b9
BuildRequires:  rpm-mpi-hooks
003f2b9
Requires:       openmpi
003f2b9
Requires:       %{name}-openmpi%{?_isa} = %{version}-%{release}
003f2b9
%description openmpi-devel
003f2b9
%{_description}
003f2b9
003f2b9
%endif
003f2b9
003f2b9
72cf5a4
%if %{with mpich}
003f2b9
%package mpich
003f2b9
Summary:        %{name} built with mpich
003f2b9
BuildRequires:  mpich-devel
003f2b9
BuildRequires:  rpm-mpi-hooks
003f2b9
Requires:       mpich
003f2b9
Requires:       %{name}-common = %{version}-%{release}
003f2b9
003f2b9
%description mpich
003f2b9
%{_description}
003f2b9
003f2b9
%package mpich-devel
003f2b9
Summary:        %{name} built with mpich
003f2b9
BuildRequires:  mpich-devel
003f2b9
BuildRequires:  rpm-mpi-hooks
003f2b9
Requires:       mpich
003f2b9
Requires:       %{name}-mpich%{?_isa} = %{version}-%{release}
003f2b9
%description mpich-devel
003f2b9
%{_description}
003f2b9
003f2b9
%endif
003f2b9
003f2b9
%prep
003f2b9
%autosetup -c -n %{name}-%{commit}
003f2b9
003f2b9
# Make these accessible here
003f2b9
cp -v %{name}-%{commit}/COPYING .
003f2b9
cp -v %{name}-%{commit}/README.md .
003f2b9
003f2b9
# Default is py3
72cf5a4
%if %{with py2}
003f2b9
    cp -a %{name}-%{commit} %{name}-%{commit}-py2
003f2b9
%endif
003f2b9
72cf5a4
%if %{with mpich}
72cf5a4
    %if %{with py2}
003f2b9
        cp -a %{name}-%{commit}-py2 %{name}-%{commit}-mpich-py2
003f2b9
    %endif
003f2b9
    cp -a %{name}-%{commit} %{name}-%{commit}-mpich
003f2b9
%endif
003f2b9
72cf5a4
%if %{with openmpi}
72cf5a4
    %if %{with py2}
003f2b9
        cp -a %{name}-%{commit}-py2 %{name}-%{commit}-openmpi-py2
003f2b9
    %endif
003f2b9
    cp -a %{name}-%{commit} %{name}-%{commit}-openmpi
003f2b9
%endif
003f2b9
003f2b9
%build
003f2b9
003f2b9
%global do_build \
003f2b9
pushd %{name}-%{commit}$MPI_COMPILE_TYPE && \
003f2b9
./autogen.sh && \
003f2b9
%{set_build_flags} \
003f2b9
./configure --disable-static \\\
003f2b9
--disable-silent-rules \\\
003f2b9
--with-python=$PYTHON_VERSION \\\
003f2b9
--with-mpi=$MPI_YES \\\
003f2b9
--prefix=$MPI_HOME \\\
003f2b9
--libdir=$MPI_LIB \\\
003f2b9
--includedir=$MPI_INCLUDE \\\
003f2b9
--bindir=$MPI_BIN \\\
003f2b9
--mandir=$MPI_MAN && \
003f2b9
%make_build STRIP=/bin/true && \
003f2b9
popd || exit -1
003f2b9
003f2b9
003f2b9
# Python 3
003f2b9
MPI_COMPILE_TYPE=""
003f2b9
PYTHON_VERSION=3
003f2b9
MPI_YES="no"
003f2b9
MPI_HOME=%{_prefix}
003f2b9
MPI_LIB=%{_libdir}
003f2b9
MPI_INCLUDE=%{_includedir}
003f2b9
MPI_BIN=%{_bindir}
003f2b9
MPI_MAN=%{_mandir}
003f2b9
%{do_build}
003f2b9
003f2b9
# Python 2
72cf5a4
%if %{with py2}
003f2b9
MPI_COMPILE_TYPE="-py2"
003f2b9
PYTHON_VERSION=2
003f2b9
MPI_YES="no"
003f2b9
MPI_HOME=%{_prefix}
003f2b9
MPI_LIB=%{_libdir}
003f2b9
MPI_INCLUDE=%{_includedir}
003f2b9
MPI_BIN=%{_bindir}
003f2b9
MPI_MAN=%{_mandir}
003f2b9
%{do_build}
003f2b9
%endif
003f2b9
003f2b9
# Mpich
72cf5a4
%if %{with mpich}
003f2b9
%{_mpich_load}
003f2b9
# Python 3
003f2b9
MPI_COMPILE_TYPE="-mpich"
003f2b9
PYTHON_VERSION=3
003f2b9
MPI_YES="yes"
003f2b9
%{do_build}
003f2b9
003f2b9
# Python 2
72cf5a4
%if %{with py2}
003f2b9
MPI_COMPILE_TYPE="-mpich-py2"
003f2b9
PYTHON_VERSION=2
003f2b9
MPI_YES="yes"
003f2b9
%{do_build}
003f2b9
%endif
003f2b9
%{_mpich_unload}
003f2b9
%endif
003f2b9
003f2b9
# Openmpi
72cf5a4
%if %{with openmpi}
003f2b9
%{_openmpi_load}
003f2b9
# Python 3
003f2b9
MPI_COMPILE_TYPE="-openmpi"
003f2b9
PYTHON_VERSION=3
003f2b9
MPI_YES="yes"
003f2b9
%{do_build}
003f2b9
003f2b9
# Python 2
72cf5a4
%if %{with py2}
003f2b9
MPI_COMPILE_TYPE="-openmpi-py2"
003f2b9
PYTHON_VERSION=2
003f2b9
MPI_YES="yes"
003f2b9
%{do_build}
003f2b9
%endif
003f2b9
%{_openmpi_unload}
003f2b9
%endif
003f2b9
003f2b9
%install
003f2b9
%global do_install \
003f2b9
%make_install -C %{name}-%{commit}$MPI_COMPILE_TYPE STRIP=/bin/true || exit -1
003f2b9
003f2b9
003f2b9
# Python 3
003f2b9
MPI_COMPILE_TYPE=""
003f2b9
PYTHON_VERSION=3
003f2b9
%{do_install}
003f2b9
003f2b9
# Python 2
72cf5a4
%if %{with py2}
003f2b9
MPI_COMPILE_TYPE="-py2"
003f2b9
PYTHON_VERSION=2
003f2b9
%{do_install}
003f2b9
%endif
003f2b9
003f2b9
# Mpich
72cf5a4
%if %{with mpich}
003f2b9
%{_mpich_load}
003f2b9
# Python 3
003f2b9
MPI_TYPE="mpich"
003f2b9
MPI_COMPILE_TYPE="-mpich"
003f2b9
PYTHON_VERSION=3
003f2b9
PY_VERSION=%{python3_version}
003f2b9
%{do_install}
003f2b9
003f2b9
# Python 2
72cf5a4
%if %{with py2}
003f2b9
MPI_COMPILE_TYPE="-mpich-py2"
003f2b9
PYTHON_VERSION=2
003f2b9
PY_VERSION=%{python2_version}
003f2b9
%{do_install}
003f2b9
%endif
003f2b9
%{_mpich_unload}
003f2b9
%endif
003f2b9
003f2b9
# Openmpi
72cf5a4
%if %{with openmpi}
003f2b9
%{_openmpi_load}
003f2b9
MPI_TYPE="openmpi"
003f2b9
# Python3
003f2b9
MPI_COMPILE_TYPE="-openmpi"
003f2b9
PYTHON_VERSION=3
003f2b9
PY_VERSION=%{python3_version}
003f2b9
%{do_install}
003f2b9
003f2b9
# Python 2
72cf5a4
%if %{with py2}
003f2b9
MPI_COMPILE_TYPE="-openmpi-py2"
003f2b9
PYTHON_VERSION=2
003f2b9
PY_VERSION=%{python2_version}
003f2b9
%{do_install}
003f2b9
%endif
003f2b9
%{_openmpi_unload}
003f2b9
%endif
003f2b9
003f2b9
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
003f2b9
003f2b9
%ldconfig_scriptlets
003f2b9
003f2b9
%files
003f2b9
%{_libdir}/%{name}.so.0
003f2b9
%{_libdir}/%{name}.so.0.0.0
fc50732
%{_libdir}/libpy3neurosim.so.0
fc50732
%{_libdir}/libpy3neurosim.so.0.0.0
72cf5a4
%if %{with py2}
fc50732
%{_libdir}/libpy2neurosim.so.0
fc50732
%{_libdir}/libpy2neurosim.so.0.0.0
fc50732
%{_libdir}/libpyneurosim.so.0
fc50732
%{_libdir}/libpyneurosim.so.0.0.0
fc50732
%endif
003f2b9
003f2b9
%files devel
003f2b9
%{_includedir}/neurosim
fc50732
%{_libdir}/%{name}.so
fc50732
%{_libdir}/libpy3neurosim.so
72cf5a4
%if %{with py2}
fc50732
%{_libdir}/libpy2neurosim.so
fc50732
%{_libdir}/libpyneurosim.so
fc50732
%endif
003f2b9
003f2b9
%files common
003f2b9
%license COPYING
003f2b9
%doc README.md
003f2b9
72cf5a4
%if %{with mpich}
003f2b9
%files mpich
003f2b9
%{_libdir}/mpich/lib/%{name}.so.0
003f2b9
%{_libdir}/mpich/lib/%{name}.so.0.0.0
fc50732
%{_libdir}/mpich/lib/libpy3neurosim.so.0
fc50732
%{_libdir}/mpich/lib/libpy3neurosim.so.0.0.0
72cf5a4
%if %{with py2}
fc50732
%{_libdir}/mpich/lib/libpy2neurosim.so.0
fc50732
%{_libdir}/mpich/lib/libpy2neurosim.so.0.0.0
fc50732
%{_libdir}/mpich/lib/libpyneurosim.so.0
fc50732
%{_libdir}/mpich/lib/libpyneurosim.so.0.0.0
fc50732
%endif
003f2b9
003f2b9
%files mpich-devel
003f2b9
%{_includedir}/mpich*/neurosim
fc50732
%{_libdir}/mpich/lib/%{name}.so
fc50732
%{_libdir}/mpich/lib/libpy3neurosim.so
72cf5a4
%if %{with py2}
fc50732
%{_libdir}/mpich/lib/libpy2neurosim.so
fc50732
%{_libdir}/mpich/lib/libpyneurosim.so
003f2b9
%endif
003f2b9
%endif
003f2b9
72cf5a4
%if %{with openmpi}
003f2b9
%files openmpi
003f2b9
%{_libdir}/openmpi/lib/%{name}.so.0
003f2b9
%{_libdir}/openmpi/lib/%{name}.so.0.0.0
fc50732
%{_libdir}/openmpi/lib/libpy3neurosim.so.0
fc50732
%{_libdir}/openmpi/lib/libpy3neurosim.so.0.0.0
72cf5a4
%if %{with py2}
fc50732
%{_libdir}/openmpi/lib/libpy2neurosim.so.0
fc50732
%{_libdir}/openmpi/lib/libpy2neurosim.so.0.0.0
fc50732
%{_libdir}/openmpi/lib/libpyneurosim.so.0
fc50732
%{_libdir}/openmpi/lib/libpyneurosim.so.0.0.0
fc50732
%endif
003f2b9
003f2b9
%files openmpi-devel
003f2b9
%{_includedir}/openmpi*/neurosim
fc50732
%{_libdir}/openmpi/lib/%{name}.so
fc50732
%{_libdir}/openmpi/lib/libpy3neurosim.so
72cf5a4
%if %{with py2}
fc50732
%{_libdir}/openmpi/lib/libpy2neurosim.so
fc50732
%{_libdir}/openmpi/lib/libpyneurosim.so
003f2b9
%endif
003f2b9
%endif
003f2b9
fc50732
003f2b9
%changelog
72cf5a4
* Sat Nov 24 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0-4.20181124.git0364674
72cf5a4
- Use bcond conditionals
72cf5a4
fc50732
* Sat Nov 24 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0-3.20181124.git0364674
fc50732
- Update to latest upstream commit
fc50732
- Put libraries in correct locations. libpyneurosim is NOT a python extension module
fc50732
- Remove python sub packages: other software must link against both libneurosim and libpyneurosim
fc50732
- All explained in: https://github.com/INCF/libneurosim/issues/12
fc50732
23fdcc5
* Sun Oct 28 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0-2.20181028.git7d074da
23fdcc5
- Rebuild using conditional
23fdcc5
003f2b9
* Thu Oct 25 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0-1.20181025.git7d074da
003f2b9
- Place python so in correct location
003f2b9
- Correct devel file list
003f2b9
003f2b9
* Fri Oct 19 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0-1.20181019.git57b76e2
003f2b9
- Correct release field
003f2b9
- Correct autosetup usage
003f2b9
- Move common files to -common sub package
003f2b9
- Explicitly version sonames
003f2b9
- Use tweaks suggested in review
003f2b9
- Make python3 default
003f2b9
- Enable debuginfo
003f2b9
- Update to latest upstream commit
003f2b9
- Initial build