[packages/libdigidocpp] - updated to 3.16.0, added python3 binding

qboosh qboosh at pld-linux.org
Mon Feb 19 20:37:05 CET 2024


commit 1785bb97be25aeec4e9d85aaee8251ee5edbc350
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Feb 19 20:22:40 2024 +0100

    - updated to 3.16.0, added python3 binding

 DIGIDOCPP_VERSION.patch   | 21 -----------
 libdigidocpp-link.patch   | 15 ++++----
 libdigidocpp-python.patch | 29 +++++++++++++++
 libdigidocpp.spec         | 90 +++++++++++++++++++++++++++--------------------
 4 files changed, 89 insertions(+), 66 deletions(-)
---
diff --git a/libdigidocpp.spec b/libdigidocpp.spec
index 1c56d58..6e51ca1 100644
--- a/libdigidocpp.spec
+++ b/libdigidocpp.spec
@@ -1,13 +1,15 @@
 #
 # Conditional build:
-%bcond_without	perl		# Perl module
-%bcond_without	php		# PHP module
-%bcond_without	python		# Python module
-%bcond_with	bindings	# build bindings (currently only C#/Win32 and Java/Android supported)
+%bcond_without	java		# Java module
+%bcond_with	perl		# Perl module
+%bcond_with	php		# PHP module
+%bcond_without	python		# Python 3 module
+%bcond_without	bindings	# build bindings (currently only C#/Win32 and Java/Android supported)
 # https://github.com/open-eid/libdigidocpp/issues/231
-%bcond_with	podofo
+%bcond_with	podofo		# outdated PoDoFo support (disabled in sources)
 
 %if %{without bindings}
+%undefine	with_java
 %undefine	with_perl
 %undefine	with_php
 %undefine	with_python
@@ -16,44 +18,45 @@
 Summary:	Library for creating and validating BDoc and DDoc containers
 Summary(pl.UTF-8):	Biblioteka do tworzenia i sprawdzania poprawności kontenerów BDoc i DDoc
 Name:		libdigidocpp
-Version:	3.13.8
-Release:	3
+Version:	3.16.0
+Release:	1
 License:	LGPL v2.1+
 Group:		Libraries
+#Source0Download: https://github.com/open-eid/libdigidocpp/releases
 Source0:	https://github.com/open-eid/libdigidocpp/releases/download/v%{version}/%{name}-%{version}.tar.gz
-# Source0-md5:	2d35f37dc103e3cecb57f0332f46ff31
+# Source0-md5:	879590bba8b236b128646871003593cd
 Patch0:		%{name}-link.patch
-Patch1:		DIGIDOCPP_VERSION.patch
+Patch1:		%{name}-python.patch
 URL:		https://github.com/open-eid/libdigidocpp
 # for tests
 BuildRequires:	boost-devel
-BuildRequires:	cmake >= 3.0
+BuildRequires:	cmake >= 3.16
 BuildRequires:	doxygen
-BuildRequires:	libdigidoc-devel >= 3.9
 BuildRequires:	libstdc++-devel
-BuildRequires:	minizip-devel
-BuildRequires:	openssl-devel >= 1.0.1
+BuildRequires:	minizip-devel >= 1
+BuildRequires:	openssl-devel >= 1.1.1
+%if %{with perl}
+BuildRequires:	perl-devel
+%endif
+%if %{with php}
+BuildRequires:	php-devel >= 4:5.0.4
+%endif
 BuildRequires:	pkgconfig
 %{?with_podofo:BuildRequires:	podofo-devel}
+BuildRequires:	rpm-build >= 4.6
 BuildRequires:	rpmbuild(macros) >= 1.734
+%if %{with perl} || %{with php} || %{with python}
+BuildRequires:	swig
+%endif
 BuildRequires:	xerces-c-devel
 BuildRequires:	xml-security-c-devel
 BuildRequires:	xsd >= 4.0
 BuildRequires:	xxd
 BuildRequires:	zlib-devel
-%if %{with perl} || %{with php} || %{with python}
-BuildRequires:	swig
-%endif
-%if %{with perl}
-BuildRequires:	perl-devel
-%endif
-%if %{with php}
-BuildRequires:	php-devel >= 4:5.0.4
-%endif
 %if %{with python}
-BuildRequires:	python-devel
+BuildRequires:	python3-devel >= 1:3.2
+BuildRequires:	swig-python >= 2
 %endif
-Requires:	libdigidoc >= 3.9
 Requires:	opensc
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -87,6 +90,7 @@ wykorzystujących bibliotekę libdigidocpp.
 Summary:	API documentation for libdigidocpp library
 Summary(pl.UTF-8):	Dokumentacja API biblioteki libdigidocpp
 Group:		Documentation
+BuildArch:	noarch
 
 %description apidocs
 API documentation for libdigidocpp library.
@@ -123,18 +127,19 @@ PHP bindings for libdigidocpp library.
 %description -n php-digidoc -l pl.UTF-8
 Wiązania PHP do biblioteki libdigidocpp.
 
-%package -n python-digidoc
+%package -n python3-digidoc
 Summary:	Python bindings for libdigidocpp library
 Summary(pl.UTF-8):	Wiązania Pythona do biblioteki libdigidocpp
 Group:		Development/Languages/Python
 Requires:	%{name} = %{version}-%{release}
 Provides:	%{name}-python = %{version}-%{release}
 Obsoletes:	libdigidocpp-python < 0.3.0-1
+Obsoletes:	python-digidoc < 0.3.0-2
 
-%description -n python-digidoc
+%description -n python3-digidoc
 Python bindings for libdigidocpp library.
 
-%description -n python-digidoc -l pl.UTF-8
+%description -n python3-digidoc -l pl.UTF-8
 Wiązania Pythona do biblioteki libdigidocpp.
 
 %prep
@@ -145,15 +150,12 @@ Wiązania Pythona do biblioteki libdigidocpp.
 # Remove bundled copy of minizip
 %{__rm} -r src/minizip
 
-%{!?with_podofo:sed -i -e 's#PODOFO_FOUND#0#g' src/CMakeLists.txt}
-
 %build
-install -d build
-cd build
-%cmake .. \
-	-DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name}
+%cmake -B build \
+	-DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} \
+	-DPython3_SITELIB=%{py3_sitedir}
 
-%{__make}
+%{__make} -C build
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -161,9 +163,17 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+%py3_comp $RPM_BUILD_ROOT%{py3_sitedir}
+%py3_ocomp $RPM_BUILD_ROOT%{py3_sitedir}
+
 # packaged as %doc
 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}
 
+# should be as dll not sources
+%{__rm} -r $RPM_BUILD_ROOT%{_includedir}/digidocpp_csharp
+# should be as jar not sources
+%{__rm} -r $RPM_BUILD_ROOT%{_includedir}/ee/ria/libdigidocpp
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -175,8 +185,6 @@ rm -rf $RPM_BUILD_ROOT
 %doc AUTHORS COPYING README.md RELEASE-NOTES.md
 %dir %{_sysconfdir}/digidocpp
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/digidocpp/digidocpp.conf
-# XXX ?
-%{_sysconfdir}/digidocpp/878252.p12
 %{_sysconfdir}/digidocpp/schema
 %attr(755,root,root) %{_libdir}/libdigidocpp.so.*.*.*
 %ghost %attr(755,root,root) %{_libdir}/libdigidocpp.so.1
@@ -193,6 +201,10 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc build/doc/*
 
+# TODO: csharp, java bindings?
+#%attr(755,root,root) %{_libdir}/libdigidoc_csharp.so
+#%attr(755,root,root) %{_libdir}/libdigidoc_java.so
+
 %if %{with perl}
 %files -n perl-digidoc
 %defattr(644,root,root,755)
@@ -209,7 +221,9 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %if %{with python}
-%files -n python-digidoc
+%files -n python3-digidoc
 %defattr(644,root,root,755)
-%{py_sitedir}/*
+%attr(755,root,root) %{py3_sitedir}/_digidoc_python.so
+%{py3_sitedir}/digidoc.py
+%{py3_sitedir}/__pycache__/digidoc.cpython-*.py[co]
 %endif
diff --git a/DIGIDOCPP_VERSION.patch b/DIGIDOCPP_VERSION.patch
deleted file mode 100644
index 4cdf81c..0000000
--- a/DIGIDOCPP_VERSION.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- libdigidocpp/./src/libdigidocpp.pc.cmake~	2018-12-10 22:32:50.373425891 +0200
-+++ libdigidocpp/./src/libdigidocpp.pc.cmake	2018-12-10 22:36:22.574581291 +0200
-@@ -5,6 +5,6 @@
- 
- Name: libdigidocpp
- Description: Libdigidocpp C++ library for handling digitally signed documents
--Version: @DIGIDOCPP_VERSION@
-+Version: @PROJECT_VERSION@
- Libs: -L${libdir} -ldigidocpp
- Cflags: -I${includedir}
---- libdigidocpp/./etc/Doxyfile.in~	2018-12-10 22:32:50.276754142 +0200
-+++ libdigidocpp/./etc/Doxyfile.in	2018-12-10 22:36:15.097521556 +0200
-@@ -38,7 +38,7 @@
- # could be handy for archiving the generated documentation or if some version
- # control system is used.
- 
--PROJECT_NUMBER         = @DIGIDOCPP_VERSION@
-+PROJECT_NUMBER         = @PROJECT_VERSION@
- 
- # Using the PROJECT_BRIEF tag one can provide an optional one line description
- # for a project that appears at the top of each page and should give viewer a
diff --git a/libdigidocpp-link.patch b/libdigidocpp-link.patch
index c0d2cd1..c99d924 100644
--- a/libdigidocpp-link.patch
+++ b/libdigidocpp-link.patch
@@ -1,10 +1,11 @@
---- libdigidocpp-3.13.8/src/CMakeLists.txt~	2018-12-10 14:04:37.000000000 +0200
-+++ libdigidocpp-3.13.8/src/CMakeLists.txt	2018-12-10 18:41:24.155653928 +0200
-@@ -233,6 +233,7 @@
-     ${CMAKE_DL_LIBS}
-     ${MINIZIP_LIBRARIES}
-     digidocpp_priv
-+    pthread
+--- libdigidocpp-3.16.0/src/CMakeLists.txt.orig	2023-08-10 10:07:19.000000000 +0200
++++ libdigidocpp-3.16.0/src/CMakeLists.txt	2024-02-11 19:06:40.301637257 +0100
+@@ -245,7 +245,7 @@ set_target_properties(digidocpp PROPERTI
  )
  
+ target_include_directories(digidocpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+-target_link_libraries(digidocpp PRIVATE ${CMAKE_DL_LIBS} minizip digidocpp_priv digidocpp_ver)
++target_link_libraries(digidocpp PRIVATE ${CMAKE_DL_LIBS} minizip digidocpp_priv digidocpp_ver pthread)
+ 
  if( BUILD_TOOLS )
+     add_executable(digidoc-tool digidoc-tool.rc digidoc-tool.cpp)
diff --git a/libdigidocpp-python.patch b/libdigidocpp-python.patch
new file mode 100644
index 0000000..e0f5f59
--- /dev/null
+++ b/libdigidocpp-python.patch
@@ -0,0 +1,29 @@
+--- libdigidocpp-3.16.0/src/CMakeLists.txt.orig	2024-02-19 19:29:57.049518786 +0100
++++ libdigidocpp-3.16.0/src/CMakeLists.txt	2024-02-19 19:47:49.477042281 +0100
+@@ -292,19 +292,19 @@ if(SWIG_FOUND)
+         set_property(TARGET digidoc_python PROPERTY SWIG_COMPILE_DEFINITIONS $<$<PLATFORM_ID:Windows>:SWIGWIN>)
+         #configure_file(setup.py.cmake setup.py)
+         #install(CODE "execute_process(COMMAND python3 ${CMAKE_CURRENT_BINARY_DIR}/setup.py install)")
+-        if(NOT Python3_SITELIB)
++        if(NOT Python3_SITEARCH)
+             execute_process(COMMAND /usr/bin/python3 -c
+-                "from distutils import sysconfig;print(sysconfig.get_python_lib(plat_specific=False,standard_lib=False))"
+-                OUTPUT_VARIABLE Python3_SITELIB OUTPUT_STRIP_TRAILING_WHITESPACE)
++                "from distutils import sysconfig;print(sysconfig.get_python_lib(plat_specific=True,standard_lib=False))"
++                OUTPUT_VARIABLE Python3_SITEARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
+         endif()
+         if(WIN32)
+-            set(Python3_SITELIB ${CMAKE_INSTALL_BINDIR})
+-            install(FILES $<TARGET_PDB_FILE:digidoc_python> DESTINATION ${Python3_SITELIB} OPTIONAL)
++            set(Python3_SITEARCH ${CMAKE_INSTALL_BINDIR})
++            install(FILES $<TARGET_PDB_FILE:digidoc_python> DESTINATION ${Python3_SITEARCH} OPTIONAL)
+         else()
+             set_target_properties(digidoc_python PROPERTIES SUFFIX .so)
+         endif()
+-        install(TARGETS digidoc_python DESTINATION ${Python3_SITELIB})
+-        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/digidoc.py DESTINATION ${Python3_SITELIB})
++       install(TARGETS digidoc_python DESTINATION ${Python3_SITEARCH})
++       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/digidoc.py DESTINATION ${Python3_SITEARCH})
+     endif()
+ 
+     set(CMAKE_SWIG_FLAGS -dllimport digidoc_csharp -namespace digidoc)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libdigidocpp.git/commitdiff/1785bb97be25aeec4e9d85aaee8251ee5edbc350



More information about the pld-cvs-commit mailing list