Conditionally build python3

This commit is contained in:
Jaroslav Škarvada 2013-05-09 13:13:33 +02:00
parent 3f153e743f
commit 3aece1cd19

View File

@ -1,6 +1,12 @@
%define pkg_version 4.5
%define api_version 0.6.0
%global with_python3 1
%if 0%{?rhel}
%global with_python3 0
%endif
%{!?tcl_version: %define tcl_version %(echo 'puts $tcl_version' | tclsh)}
%{!?tcl_sitearch: %define tcl_sitearch %{_prefix}/%{_lib}/tcl%{tcl_version}}
@ -13,7 +19,7 @@
Name: brltty
Version: %{pkg_version}
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
Group: System Environment/Daemons
URL: http://mielke.cc/brltty/
@ -116,6 +122,7 @@ Summary: Python binding for BrlAPI
%description -n python-brlapi
This package provides the Python binding for BrlAPI.
%if %{with_python3}
%package -n python3-brlapi
Version: %{api_version}
Group: Development/System
@ -126,6 +133,7 @@ BuildRequires: python3-devel
Summary: Python 3 binding for BrlAPI
%description -n python3-brlapi
This package provides the Python 3 binding for BrlAPI.
%endif
%package -n brlapi-java
Version: %{api_version}
@ -157,9 +165,11 @@ This package provides the OCaml binding for BrlAPI.
%setup -q
%patch4 -p1 -b .loadLibrary
%if %{with_python3}
# Make a copy of the source tree for building the Python 3 module
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
# Add the openjdk include directories to CPPFLAGS
@ -188,11 +198,13 @@ configure_opts=" \
%configure $configure_opts PYTHON=%{__python2}
make %{?_smp_mflags}
%if %{with_python3}
# ... and then do it again for the Python 3 module
pushd %{py3dir}
%configure $configure_opts PYTHON=%{__python3}
make %{?_smp_mflags}
popd
%endif
find . \( -path ./doc -o -path ./Documents \) -prune -o \
\( -name 'README*' -o -name '*.txt' -o -name '*.html' -o \
@ -221,12 +233,14 @@ make install JAVA_JAR_DIR=%{_jnidir} \
JAVA_JNI_DIR=%{_libdir}/brltty \
JAVA_JNI=yes
%if %{with_python3}
# Python 3
pushd %{py3dir}
make install JAVA_JAR_DIR=%{_jnidir} \
JAVA_JNI_DIR=%{_libdir}/brltty \
JAVA_JNI=yes
popd
%endif
install -d -m 755 "${RPM_BUILD_ROOT}%{_sysconfdir}" "$RPM_BUILD_ROOT%{_mandir}/man5"
install -m 644 Documents/brltty.conf "${RPM_BUILD_ROOT}%{_sysconfdir}"
@ -319,9 +333,11 @@ exit 0
%{python_sitearch}/brlapi.so
%{python_sitearch}/Brlapi-%{api_version}-*.egg-info
%if %{with_python3}
%files -n python3-brlapi
%{python3_sitearch}/brlapi.cpython-*.so
%{python3_sitearch}/Brlapi-%{api_version}-*.egg-info
%endif
%files -n brlapi-java
%{_libdir}/brltty/libbrlapi_java.so
@ -334,6 +350,9 @@ exit 0
%endif
%changelog
* Thu May 9 2013 Jaroslav Škarvada <jskarvad@redhat.com> - 4.5-4
- Conditionally build python3
* Tue Apr 30 2013 Jon Ciesla <limburgher@gmail.com> - 4.5-3
- Add bluetooth support, BZ 916628.