Workaround armv7hl FTBFS, add python3 subpackage

This commit is contained in:
Sandro Mani 2017-08-08 09:49:12 +02:00
parent 1803631c67
commit 4b5da7b4c9
2 changed files with 84 additions and 12 deletions

View File

@ -1,6 +1,6 @@
Name: libkml
Version: 1.3.0
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Reference implementation of OGC KML 2.2
License: BSD
@ -14,6 +14,8 @@ Patch2: 0003-Fix-python-tests.patch
Patch3: 0004-Correctly-build-and-run-java-test.patch
# Fix a fragile test failing on i686
Patch4: fragile_test.patch
# Don't bytecompile python sources as part of build process, leave it to rpmbuild
Patch5: libkml_dont-bytecompile.patch
BuildRequires: cmake
BuildRequires: curl-devel
@ -25,6 +27,7 @@ BuildRequires: junit
BuildRequires: minizip-devel
%if 0%{?fedora}
BuildRequires: python2-devel
BuildRequires: python3-devel
%else
BuildRequires: python-devel
%endif
@ -43,12 +46,21 @@ Earth, as well as several utility libraries for working with other formats.
%package -n python2-%{name}
Summary: Python bindings for %{name}
Summary: Python 2 bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
The python2-%{name} package contains Python bindings for %{name}.
The python2-%{name} package contains Python 2 bindings for %{name}.
%package -n python3-%{name}
Summary: Python 3 bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name}
The python3-%{name} package contains Python 3 bindings for %{name}.
%package java
@ -71,30 +83,57 @@ developing applications that use %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%autosetup -p1
%build
mkdir build_py2
pushd build_py2
%ifarch armv7hl
%define awtlib -DJAVA_AWT_LIBRARY=`find /usr/lib/jvm/ -name libjawt.so | grep jre/lib/arm \`
%endif
%cmake -DWITH_SWIG=ON -DWITH_PYTHON=ON -DWITH_JAVA=ON \
-DJNI_INSTALL_DIR=%{_libdir}/%{name} \
-DCMAKE_INSTALL_DIR=%{_libdir}/cmake/%{name} \
-DINCLUDE_INSTALL_DIR=%{_includedir}/kml \
-DPYTHON_LIBRARY=%{_libdir}/libpython%{python2_version}.so \
-DPYTHON_INCLUDE_DIR=%{_includedir}/python%{python2_version}/ \
-DPYTHON_INSTALL_DIR=%{python2_sitearch} \
%{?awtlib} \
-DBUILD_TESTING=ON \
-DBUILD_EXAMPLES=ON
make %{?_smp_mflags}
-DBUILD_EXAMPLES=ON \
..
%make_build
popd
mkdir build_py3
pushd build_py3
%cmake -DWITH_SWIG=ON -DWITH_PYTHON=ON -DWITH_JAVA=OFF \
-DJNI_INSTALL_DIR=%{_libdir}/%{name} \
-DCMAKE_INSTALL_DIR=%{_libdir}/cmake/%{name} \
-DINCLUDE_INSTALL_DIR=%{_includedir}/kml \
-DPYTHON_LIBRARY=%{_libdir}/libpython%{python3_version}m.so \
-DPYTHON_INCLUDE_DIR=%{_includedir}/python%{python3_version}m/ \
-DPYTHON_INSTALL_DIR=%{python3_sitearch} \
-DBUILD_TESTING=ON \
-DBUILD_EXAMPLES=OFF \
..
%make_build
popd
%install
%make_install
%make_install -C build_py2
%make_install -C build_py3
%check
pushd build_py2
ctest -V
popd
pushd build_py3
ctest -V
popd
%post -p /sbin/ldconfig
@ -111,6 +150,11 @@ ctest -V
%{python2_sitearch}/*.so
%{python2_sitearch}/*.py*
%files -n python3-%{name}
%{python3_sitearch}/*.so
%{python3_sitearch}/*.py
%{python3_sitearch}/__pycache__/*.pyc
%files java
%{_javadir}/LibKML.jar
%{_libdir}/%{name}/
@ -123,6 +167,10 @@ ctest -V
%{_libdir}/cmake/%{name}/
%changelog
* Mon Aug 07 2017 Sandro Mani <manisandro@gmail.com> - 1.3.0-8
- Workaround armv7hl FTBFS
- Add python3 bindings
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

View File

@ -0,0 +1,24 @@
diff -rupN libkml-1.3.0/src/swig/CMakeLists.txt libkml-1.3.0-new/src/swig/CMakeLists.txt
--- libkml-1.3.0/src/swig/CMakeLists.txt 2015-12-21 18:23:05.000000000 +0100
+++ libkml-1.3.0-new/src/swig/CMakeLists.txt 2017-08-07 21:26:23.717928168 +0200
@@ -23,12 +23,6 @@ if(WITH_PYTHON)
set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}PYTHON_wrap.cxx COMPILE_FLAGS "-Wno-long-long" )
swig_add_module(${MODULE_NAME} python ${INTERFACE_FILE})
swig_link_libraries(${MODULE_NAME} kmlbase kmlengine kmldom ${PYTHON_LIBRARIES})
- add_custom_command(
- TARGET _${MODULE_NAME}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo "Byte-compiling ${MODULE_NAME}.py"
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/pycompile.py ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py
- DEPENDS kmlbase kmlengine kmldom)
install(TARGETS
_${MODULE_NAME}
@@ -36,7 +30,6 @@ if(WITH_PYTHON)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py
- ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.pyc
DESTINATION ${PYTHON_INSTALL_DIR})
endforeach()