[NLopt/el5: 3/3] new upstream release (#1116586) adapted spec to use named conditionals for packages
by Björn 'besser82' Esser
commit 843dc01447c79106532ec579d3302bfb9c51a0b1
Author: Björn Esser <bjoern.esser(a)gmail.com>
Date: Thu Jul 17 12:06:53 2014 +0200
new upstream release (#1116586)
adapted spec to use named conditionals for packages
NLopt.spec | 97 ++++++++++++++++++++++++++++++++++++-----------------------
sources | 2 +-
2 files changed, 60 insertions(+), 39 deletions(-)
---
diff --git a/NLopt.spec b/NLopt.spec
index 40b5d93..08a2634 100644
--- a/NLopt.spec
+++ b/NLopt.spec
@@ -1,6 +1,17 @@
# Conditional for release and snapshot builds. Uncomment for release-builds.
%global rel_build 1
+# Conditionals controlling the build.
+%if 0%{?fedora} || 0%{?rhel} >= 6
+%global with_guile 1
+%endif # 0%{?fedora} || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%global with_py 1
+%endif # 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?fedora} || 0%{?rhel} >= 8
+%global with_py3 1
+%endif # 0%{?fedora} || 0%{?rhel} >= 8
+
# Settings used for build from snapshots.
%{!?rel_build:%global commit 35e63778654f55baafbdf554de58ac3c20220c33}
%{!?rel_build:%global commit_date 20130903}
@@ -16,8 +27,8 @@
%global __provides_exclude_from ^%{python2_sitearch}/.*\\.so
Name: NLopt
-Version: 2.4.1
-Release: 7%{?gitrel}%{?dist}
+Version: 2.4.2
+Release: 1%{?gitrel}%{?dist}
Summary: Open-Source library for nonlinear optimization
%{?el5:Group: System Environment/Libraries}
@@ -57,18 +68,6 @@ URL: http://ab-initio.mit.edu/%{lc_name}
%{?el5:BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)}
BuildRequires: libtool
BuildRequires: ncurses-devel
-BuildRequires: octave-devel
-%if 0%{?fedora} || 0%{?rhel} >= 6
-BuildRequires: guile-devel
-BuildRequires: pkgconfig
-BuildRequires: swig
-%endif
-%if 0%{?fedora} || 0%{?rhel} >= 7
-BuildRequires: numpy
-BuildRequires: python2-devel
-BuildRequires: python3-devel
-BuildRequires: python3-numpy
-%endif
# The "gnulib" is a copylib and has a wildcard-permission from FPC.
# See: https://fedorahosted.org/fpc/ticket/174
@@ -110,7 +109,7 @@ Provides: %{lc_name}-doc = %{version}-%{release}
This package contains documentation files for %{name}.
-%if 0%{?fedora} || 0%{?rhel} >= 6
+%if 0%{?with_guile}
%package -n guile-%{name}
# For compatibility with RHEL <= 6.
%{!?guile_pkgconf:%global guile_pkgconf %(pkg-config --list-all | grep guile | sed -e 's! .*$!!g')}
@@ -118,6 +117,10 @@ This package contains documentation files for %{name}.
Summary: Guile bindings for %{name}
+BuildRequires: guile-devel
+BuildRequires: pkgconfig
+BuildRequires: swig
+
Requires: guile%{?_isa}
Requires: %{name}%{?_isa} = %{version}-%{release}
@@ -140,7 +143,7 @@ Provides: guile-%{lc_name}-devel%{?_isa} = %{version}-%{release}
%description -n guile-%{name}-devel
This package contains Development files
of Guile bindings for %{name}.
-%endif
+%endif # 0%{?with_guile}
%package -n octave-%{name}
@@ -156,6 +159,8 @@ of Guile bindings for %{name}.
Summary: Octave bindings for %{name}
%{?el5:Group: System Environment/Libraries}
+BuildRequires: octave-devel
+
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: octave(api) = %{octave_api}
Requires(post): octave
@@ -168,10 +173,13 @@ Provides: octave-%{lc_name}%{?_isa} = %{version}-%{release}
This package contains the Octave bindings for %{name}.
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py}
%package -n python-%{name}
Summary: Python bindings for %{name}
+BuildRequires: numpy
+BuildRequires: python2-devel
+
Requires: %{name}%{?_isa} = %{version}-%{release}
Provides: python-%{lc_name} = %{version}-%{release}
@@ -179,11 +187,16 @@ Provides: python-%{lc_name}%{?_isa} = %{version}-%{release}
%description -n python-%{name}
This package contains Python bindings for %{name}.
+%endif # 0%{?with_py}
+%if 0%{?with_py3}
%package -n python3-%{name}
Summary: Python3 bindings for %{name}
+BuildRequires: python3-devel
+BuildRequires: python3-numpy
+
Requires: %{name}%{?_isa} = %{version}-%{release}
Provides: python3-%{lc_name} = %{version}-%{release}
@@ -191,7 +204,7 @@ Provides: python3-%{lc_name}%{?_isa} = %{version}-%{release}
%description -n python3-%{name}
This package contains Python3 bindings for %{name}.
-%endif
+%endif # 0%{?with_py3}
%prep
@@ -235,33 +248,33 @@ sed -i.orig -e 's!-l%{lc_name}!&_cxx!' ${_file} && \
touch -r ${_file}.orig ${_file} && \
rm -f ${_file}.orig
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py3}
# Creating a copy for building the Python3-plugin.
rm -rf %{py3dir}
cp -a . %{py3dir}
-%endif
+%endif # 0%{?with_py3}
%build
-%if 0%{?fedora} >= 19
+%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
export CFLAGS="%{optflags} -fpermissive"
export CXXFLAGS="%{optflags} -fpermissive"
-%endif #0%%{?fedora} >= 19
+%endif # 0%{?fedora} >= 19 || 0%{?rhel} >= 7
%configure \
--enable-shared \
--enable-maintainer-mode \
--with-cxx \
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py}
PYTHON=%{__python2} \
-%endif
+%endif # 0%{?with_py}
OCT_INSTALL_DIR=%{octpkglibdir}
# Parallel-build might fail because of some race-condition
#make %{?_smp_mflags}
make
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py3}
pushd %{py3dir}
%configure \
--enable-shared \
@@ -273,29 +286,31 @@ pushd %{py3dir}
# Parallel-build might fail because of some race-condition
#make %{?_smp_mflags}
make
-%endif
+%endif # 0%{?with_py3}
%install
%{?el5:rm -rf %{buildroot}}
make install DESTDIR=%{buildroot}
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py3}
pushd %{py3dir}
make install DESTDIR=%{buildroot}
popd
-%endif
+%endif # 0%{?with_py3}
# We don't want these static-libs and libtool-dumplings
find %{buildroot} -depth -name '*.*a' -print0 | xargs -0 rm -f
# Python bits need to be arched, but some end-up in %%{python_sitelib}.
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py}
[[ "%{python2_sitearch}" != "%{python2_sitelib}" ]] && \
mv -f %{buildroot}%{python2_sitelib}/* %{buildroot}%{python2_sitearch}
+%endif # 0%{?with_py}
+%if 0%{?with_py3}
[[ "%{python3_sitearch}" != "%{python3_sitelib}" ]] && \
mv -f %{buildroot}%{python3_sitelib}/* %{buildroot}%{python3_sitearch}
-%endif
+%endif # 0%{?with_py3}
# Setup octave stuff properly.
mkdir -p %{buildroot}%{octpkgdir}/packinfo
@@ -329,11 +344,11 @@ pushd test
make check
popd
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py3}
pushd %{py3dir}/test
make check
popd
-%endif
+%endif # 0%{?with_py3}
%{?el5:%clean}
@@ -343,10 +358,10 @@ popd
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-%if 0%{?fedora} || 0%{?rhel} >= 6
+%if 0%{?with_guile}
%post -n guile-%{name} -p /sbin/ldconfig
%postun -n guile-%{name} -p /sbin/ldconfig
-%endif
+%endif # 0%{?with_guile}
%if 0%{?fedora} || 0%{?rhel} >= 7
%post -n octave-%{name}
@@ -388,30 +403,36 @@ octave -H -q --no-window-system --no-site-file --eval "pkg rebuild"
%files doc
%doc AUTHOR* ChangeLog COPY* NEWS README* TODO *.[Pp][Dd][Ff].*
-%if 0%{?fedora} || 0%{?rhel} >= 6
+%if 0%{?with_guile}
%files -n guile-%{name}
%{_libdir}/lib%{lc_name}_cxx_guile.so.*
%{guile_sitedir}/*
%files -n guile-%{name}-devel
%{_libdir}/lib%{lc_name}_cxx_guile.so
-%endif
+%endif # 0%{?with_guile}
%files -n octave-%{name}
%{octpkglibdir}
%{octpkgdir}
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?with_py}
%files -n python-%{name}
%{python2_sitearch}/*
+%endif # 0%{?with_py}
+%if 0%{?with_py3}
%files -n python3-%{name}
%{python3_sitearch}/*.so*
%{python3_sitearch}/*.py*
%{python3_sitearch}/__pycache__/*.py*
-%endif
+%endif # 0%{?with_py3}
%changelog
+* Thu Jul 17 2014 Björn Esser <bjoern.esser(a)gmail.com> - 2.4.2-1
+- new upstream release (#1116586)
+- adapted spec to use named conditionals for packages
+
* Fri Jun 06 2014 Fedora Release Engineering <rel-eng(a)lists.fedoraproject.org> - 2.4.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
diff --git a/sources b/sources
index 0b3c715..2f09695 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-ed72dd533b641d7e1f93eb790dee828c NLopt-2.4.1.tar.gz
+d0b8f139a4acf29b76dbae69ade8ac54 NLopt-2.4.2.tar.gz