[packages/bzrtp] - switched build to cmake to get cmake target files (but still keep .pc file) - added static patch (

qboosh qboosh at pld-linux.org
Tue Jun 15 20:24:25 CEST 2021


commit 0232972c6c419f447008c62baf259a3569721bf3
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Jun 15 20:27:18 2021 +0200

    - switched build to cmake to get cmake target files (but still keep .pc file)
    - added static patch (allow both shared/static targets in cmake)

 bzrtp-static.patch | 21 +++++++++++++++++++++
 bzrtp.spec         | 41 ++++++++++++++++++++++-------------------
 2 files changed, 43 insertions(+), 19 deletions(-)
---
diff --git a/bzrtp.spec b/bzrtp.spec
index 3049105..64d646e 100644
--- a/bzrtp.spec
+++ b/bzrtp.spec
@@ -12,12 +12,11 @@ Group:		Libraries
 #Source0Download: https://gitlab.linphone.org/BC/public/bzrtp/tags
 Source0:	https://gitlab.linphone.org/BC/public/bzrtp/-/archive/%{version}/%{name}-%{version}.tar.bz2
 # Source0-md5:	67af666eeef27ec7ff6717eb7d0f02c7
+Patch0:		%{name}-static.patch
 URL:		http://www.linphone.org/
 BuildRequires:	CUnit
-BuildRequires:	autoconf >= 2.63
-BuildRequires:	automake
 BuildRequires:	bctoolbox-devel >= 4.4.0
-BuildRequires:	libtool >= 2:2
+BuildRequires:	cmake >= 3.1
 BuildRequires:	libxml2-devel >= 2.0
 BuildRequires:	pkgconfig
 BuildRequires:	rpmbuild(macros) >= 1.748
@@ -62,30 +61,33 @@ Statyczna biblioteka bzrtp.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
-# rebuild ac/am/lt for as-needed to work
-%{__libtoolize}
-%{__aclocal} -I m4
-%{__autoconf}
-%{__automake}
-%if %{_ver_ge "%{cc_version}" "8.0"}
-CPPFLAGS="%{rpmcppflags} -Wno-error=cast-function-type"
-%endif
-%configure \
-	--disable-silent-rules \
-	%{?with_static_libs:--enable-static}
+install -d build
+cd build
+%cmake .. \
+	%{!?with_static_libs:-DENABLE_STATIC=OFF}
 
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
-%{__make} install \
+%{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-# obsoleted by pkg-config
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/libbzrtp.la
+# disable completeness check incompatible with split packaging
+%{__sed} -i -e '/^foreach(target .*IMPORT_CHECK_TARGETS/,/^endforeach/d; /^unset(_IMPORT_CHECK_TARGETS)/d' $RPM_BUILD_ROOT%{_datadir}/bzrtp/cmake/bzrtpTargets.cmake
+
+# missing from cmake
+test ! -f $RPM_BUILD_ROOT%{_pkgconfigdir}/libbzrtp.pc
+install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
+%{__sed} -e 's, at prefix@,%{_prefix},' \
+	-e 's, at exec_prefix@,%{_exec_prefix},' \
+	-e 's, at includedir@,%{_includedir},' \
+	-e 's, at PACKAGE_VERSION@,%{version},' \
+	-e 's, at libdir@,%{_libdir},' libbzrtp.pc.in >$RPM_BUILD_ROOT%{_pkgconfigdir}/libbzrtp.pc
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -96,14 +98,15 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG.md README.md
-%attr(755,root,root) %{_libdir}/libbzrtp.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libbzrtp.so.0
+%attr(755,root,root) %{_libdir}/libbzrtp.so.0
 
 %files devel
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/libbzrtp.so
 %{_includedir}/bzrtp
 %{_pkgconfigdir}/libbzrtp.pc
+%dir %{_datadir}/bzrtp
+%{_datadir}/bzrtp/cmake
 
 %if %{with static_libs}
 %files static
diff --git a/bzrtp-static.patch b/bzrtp-static.patch
new file mode 100644
index 0000000..50523e5
--- /dev/null
+++ b/bzrtp-static.patch
@@ -0,0 +1,21 @@
+--- bzrtp-4.5.15/src/CMakeLists.txt.orig	2021-01-07 21:55:30.000000000 +0100
++++ bzrtp-4.5.15/src/CMakeLists.txt	2021-06-15 20:01:07.586594468 +0200
+@@ -55,13 +55,13 @@
+ endif()
+ 
+ if(ENABLE_STATIC)
+-	add_library(bzrtp STATIC ${SOURCE_FILES})
+-	set_target_properties(bzrtp PROPERTIES OUTPUT_NAME bzrtp)
+-	target_include_directories(bzrtp INTERFACE
++	add_library(bzrtp-static STATIC ${SOURCE_FILES})
++	set_target_properties(bzrtp-static PROPERTIES OUTPUT_NAME bzrtp)
++	target_include_directories(bzrtp-static INTERFACE
+ 		$<INSTALL_INTERFACE:include>
+ 		PRIVATE ${INCLUDE_DIRS})
+-	target_link_libraries(bzrtp PUBLIC bctoolbox ${LIBS})
+-	install(TARGETS bzrtp EXPORT ${EXPORT_TARGETS_NAME}Targets
++	target_link_libraries(bzrtp-static PUBLIC bctoolbox ${LIBS})
++	install(TARGETS bzrtp-static EXPORT ${EXPORT_TARGETS_NAME}Targets
+ 		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ 		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ 	)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/bzrtp.git/commitdiff/0232972c6c419f447008c62baf259a3569721bf3



More information about the pld-cvs-commit mailing list