[packages/ktoblzcheck] - updated to 1.53 (uses cmake now); added python3- package

qboosh qboosh at pld-linux.org
Sat Oct 28 14:43:30 CEST 2023


commit 7c8fff8dd1a41831f2a18aef23e9f71f78df1f1d
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Oct 28 12:54:03 2023 +0200

    - updated to 1.53 (uses cmake now); added python3- package

 ktoblzcheck-python.patch |  28 ++++++++++++
 ktoblzcheck-static.patch |  27 +++++++++++
 ktoblzcheck.spec         | 115 ++++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 154 insertions(+), 16 deletions(-)
---
diff --git a/ktoblzcheck.spec b/ktoblzcheck.spec
index ca9cded..b52c304 100644
--- a/ktoblzcheck.spec
+++ b/ktoblzcheck.spec
@@ -1,20 +1,28 @@
 #
 # Conditional build:
 %bcond_without	static_libs	# static library
+%bcond_without	python2		# CPython 2.x module
 #
 Summary:	A library to check account numbers and bank codes of German banks
 Summary(pl.UTF-8):	Biblioteka do sprawdzania numerów kont i kodów bankowych niemieckich banków
 Name:		ktoblzcheck
-Version:	1.48
+Version:	1.53
 Release:	1
 License:	LGPL v2+
 Group:		Libraries
-Source0:	http://downloads.sourceforge.net/ktoblzcheck/%{name}-%{version}.tar.gz
-# Source0-md5:	6f56c83a649cbdaf1aad3e04a7b7a8ce
-URL:		http://ktoblzcheck.sourceforge.net/
+Source0:	https://downloads.sourceforge.net/ktoblzcheck/%{name}-%{version}.tar.gz
+# Source0-md5:	5cedb258370acd22ec3d0c90e0e66fec
+Patch0:		%{name}-static.patch
+Patch1:		%{name}-python.patch
+URL:		https://ktoblzcheck.sourceforge.net/
+BuildRequires:	cmake >= 3.0
+BuildRequires:	doxygen
 BuildRequires:	libstdc++-devel
-BuildRequires:	python-devel >= 1:2.5
+%{?with_python2:BuildRequires:	python-modules >= 1:2.6}
+BuildRequires:	python3-devel >= 1:3.2
+BuildRequires:	rpm-build >= 4.6
 BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -60,12 +68,24 @@ Static KtoBLZCheck library.
 %description static -l pl.UTF-8
 Statyczna biblioteka KtoBLZCheck.
 
+%package apidocs
+Summary:	API documentation for KtoBLZCheck library
+Summary(pl.UTF-8):	Dokumentacja API biblioteki KtoBLZCheck
+Group:		Documentation
+BuildArch:	noarch
+
+%description apidocs
+API documentation for KtoBLZCheck library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki KtoBLZCheck.
+
 %package -n python-ktoblzcheck
-Summary:	Python binding for KtoBLZCheck library
-Summary(pl.UTF-8):	Wiązanie Pythona dla biblioteki KtoBLZCheck
+Summary:	Python 2 binding for KtoBLZCheck library
+Summary(pl.UTF-8):	Wiązanie Pythona 2 dla biblioteki KtoBLZCheck
 Group:		Development/Languages/Python
 Requires:	%{name} = %{version}-%{release}
-Requires:	python-modules >= 1:2.5
+Requires:	python-modules >= 1:2.6
 
 %description -n python-ktoblzcheck
 Python binding for KtoBLZCheck library.
@@ -73,25 +93,75 @@ Python binding for KtoBLZCheck library.
 %description -n python-ktoblzcheck -l pl.UTF-8
 Wiązanie Pythona dla biblioteki KtoBLZCheck.
 
+%package -n python3-ktoblzcheck
+Summary:	Python 3 binding for KtoBLZCheck library
+Summary(pl.UTF-8):	Wiązanie Pythona 3 dla biblioteki KtoBLZCheck
+Group:		Development/Languages/Python
+Requires:	%{name} = %{version}-%{release}
+Requires:	python3-modules >= 1:3.2
+
+%description -n python3-ktoblzcheck
+Python binding for KtoBLZCheck library.
+
+%description -n python3-ktoblzcheck -l pl.UTF-8
+Wiązanie Pythona dla biblioteki KtoBLZCheck.
+
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+
+# drop pythondir, wrongly joined
+%{__sed} -i -e '/^pythondir=/d' ktoblzcheck.pc.in
 
 %build
-%configure \
-	--enable-python \
-	%{?with_static_libs:--enable-static}
+%if %{with static_libs}
+install -d build-static
+cd build-static
+%cmake .. \
+	-DBUILD_STATIC=ON \
+	-DENABLE_BANKDATA_DOWNLOAD=OFF
+
+%{__make}
+cd ..
+%endif
+
+install -d build
+cd build
+%cmake .. \
+	-DCMAKE_INSTALL_BINDIR=bin \
+	-DCMAKE_INSTALL_DATADIR=share \
+	-DCMAKE_INSTALL_INCLUDEDIR=include \
+	-DCMAKE_INSTALL_LIBDIR=%{_lib} \
+	-DENABLE_BANKDATA_DOWNLOAD=OFF
+
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
-%{__make} install \
+%if %{with static_libs}
+%{__make} -C build-static install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+# use the one from shared build
+%{__rm} $RPM_BUILD_ROOT%{_pkgconfigdir}/ktoblzcheck.pc
+%endif
+
+%{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-# obsoleted by pkg-config
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/libktoblzcheck.la
+%py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir}
+%py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir}
 
+%if %{with python2}
+# module supports CPython 2.6+, but cmake prefers python3, in such case python2 module must be installed manually
+install -d $RPM_BUILD_ROOT%{py_sitescriptdir}
+cp -p src/python/ktoblzcheck.py $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
 %py_postclean
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -101,13 +171,14 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS ChangeLog NEWS README
+%doc AUTHORS ChangeLog NEWS README.md
+%attr(755,root,root) %{_bindir}/ibanchk
 %attr(755,root,root) %{_bindir}/ktoblzcheck
 %attr(755,root,root) %{_libdir}/libktoblzcheck.so.*.*.*
 %attr(755,root,root) %ghost %{_libdir}/libktoblzcheck.so.1
 %dir %{_datadir}/%{name}
 %{_datadir}/%{name}/*.txt
-%attr(755,root,root) %{_datadir}/%{name}/*.pl
+%{_mandir}/man1/ibanchk.1*
 %{_mandir}/man1/ktoblzcheck.1*
 
 %files devel
@@ -115,6 +186,7 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_libdir}/libktoblzcheck.so
 %{_includedir}/iban.h
 %{_includedir}/ktoblzcheck.h
+%{_libdir}/cmake/KtoBlzCheck
 %{_pkgconfigdir}/ktoblzcheck.pc
 
 %if %{with static_libs}
@@ -123,6 +195,17 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libktoblzcheck.a
 %endif
 
+%files apidocs
+%defattr(644,root,root,755)
+%{_docdir}/ktoblzcheck
+
+%if %{with python2}
 %files -n python-ktoblzcheck
 %defattr(644,root,root,755)
 %{py_sitescriptdir}/ktoblzcheck.py[co]
+%endif
+
+%files -n python3-ktoblzcheck
+%defattr(644,root,root,755)
+%{py3_sitescriptdir}/ktoblzcheck.py
+%{py3_sitescriptdir}/__pycache__/ktoblzcheck.cpython-*.py[co]
diff --git a/ktoblzcheck-python.patch b/ktoblzcheck-python.patch
new file mode 100644
index 0000000..2aa14c6
--- /dev/null
+++ b/ktoblzcheck-python.patch
@@ -0,0 +1,28 @@
+--- ktoblzcheck-1.53/CMakeLists.txt.orig	2023-10-28 10:56:58.032206936 +0200
++++ ktoblzcheck-1.53/CMakeLists.txt	2023-10-28 11:01:35.357371203 +0200
+@@ -82,7 +82,7 @@ find_package (Python3 COMPONENTS Interpr
+ if(Python3_FOUND)
+     set(Python_EXECUTABLE ${Python3_EXECUTABLE})
+     string(REGEX REPLACE "^([0-9]+.[0-9]+).*" "\\1" Python_VERSION_MAJOR_MINOR ${Python3_VERSION})
+-    set(Python_SITEARCH "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR_MINOR}/site-packages")
++    set(Python_SITEARCH "${CMAKE_INSTALL_DATADIR}/python${Python_VERSION_MAJOR_MINOR}/site-packages")
+     set(Python_Interpreter_FOUND TRUE)
+     set(Python_Development_FOUND TRUE)
+ else()
+@@ -98,14 +98,14 @@ else()
+     endif()
+     if(Python2_Development_FOUND)
+         string(REGEX REPLACE "^([0-9]+.[0-9]+).*" "\\1" Python_VERSION_MAJOR_MINOR ${Python2_VERSION})
+-        set(Python_SITEARCH "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR_MINOR}/site-packages")
++	set(Python_SITEARCH "${CMAKE_INSTALL_DATADIR}/python${Python_VERSION_MAJOR_MINOR}/site-packages")
+         set(Python_Development_FOUND TRUE)
+     else()
+         find_package(PythonLibs 2.6 REQUIRED)
+         set(Python_Development_FOUND TRUE)
+         set(Python2_VERSION ${PYTHONLIBS_VERSION_STRING})
+         string(REGEX REPLACE "^([0-9]+.[0-9]+).*" "\\1" Python_VERSION_MAJOR_MINOR ${Python2_VERSION})
+-        set(Python_SITEARCH "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR_MINOR}/site-packages")
++	set(Python_SITEARCH "${CMAKE_INSTALL_DATADIR}/python${Python_VERSION_MAJOR_MINOR}/site-packages")
+     endif()
+ endif()
+ ########### configure checks ###############
diff --git a/ktoblzcheck-static.patch b/ktoblzcheck-static.patch
new file mode 100644
index 0000000..b714bf7
--- /dev/null
+++ b/ktoblzcheck-static.patch
@@ -0,0 +1,27 @@
+Let BUILD_STATIC enable just static libktoblzcheck library
+--- ktoblzcheck-1.53/CMakeLists.txt.orig	2020-04-20 14:58:13.000000000 +0200
++++ ktoblzcheck-1.53/CMakeLists.txt	2023-10-28 10:50:05.477775268 +0200
+@@ -17,10 +17,6 @@ set(BANK_WEBSITE_PATH /de/aufgaben/unbar
+ 
+ option(INSTALL_SEPA_BANKDATA_FILE "Install sepa provider data file in csv format" OFF)
+ option(BUILD_STATIC "build static library and executables" OFF)
+-if(BUILD_STATIC)
+-    set(LIBS -static -static-libgcc -static-libstdc++)
+-    set(CMAKE_BUILD_TYPE Release)
+-endif()
+ 
+ # provide gnu compatible install dirs
+ include(GNUInstallDirs)
+--- ktoblzcheck-1.53/src/bin/CMakeLists.txt.orig	2020-04-20 14:57:36.000000000 +0200
++++ ktoblzcheck-1.53/src/bin/CMakeLists.txt	2023-10-28 10:50:13.601064594 +0200
+@@ -5,10 +5,6 @@ set(ktoblzcheck_bin_SRCS ktoblzcheck.cc)
+ add_executable(ktoblzcheck-bin ${ktoblzcheck_bin_SRCS})
+ target_link_libraries(ktoblzcheck-bin ktoblzcheck)
+ set_target_properties(ktoblzcheck-bin PROPERTIES OUTPUT_NAME ktoblzcheck)
+-if(BUILD_STATIC)
+-    # strip executables
+-    set(CMAKE_EXE_LINKER_FLAGS_RELEASE -s)
+-endif()
+ 
+ install(TARGETS ktoblzcheck-bin DESTINATION bin)
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ktoblzcheck.git/commitdiff/7c8fff8dd1a41831f2a18aef23e9f71f78df1f1d



More information about the pld-cvs-commit mailing list