- switched build to cmake to get cmake target files (but still keep .pc file) auto/th/bzrtp-4.5.15-1
authorJakub Bogusz <qboosh@pld-linux.org>
Tue, 15 Jun 2021 18:27:18 +0000 (20:27 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Tue, 15 Jun 2021 18:27:18 +0000 (20:27 +0200)
- added static patch (allow both shared/static targets in cmake)

bzrtp-static.patch [new file with mode: 0644]
bzrtp.spec

diff --git a/bzrtp-static.patch b/bzrtp-static.patch
new file mode 100644 (file)
index 0000000..50523e5
--- /dev/null
@@ -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
+       )
index 30491059bd5b42255fa762cdd3de9781da8fb456..64d646eafe7b9e1aeef76ad5d5607637860b1b67 100644 (file)
@@ -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,@prefix@,%{_prefix},' \
+       -e 's,@exec_prefix@,%{_exec_prefix},' \
+       -e 's,@includedir@,%{_includedir},' \
+       -e 's,@PACKAGE_VERSION@,%{version},' \
+       -e 's,@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
This page took 0.156131 seconds and 4 git commands to generate.