From dc6b2f9fb61395d453f0fd1604ab93c38d58e9d51aa04da85bbfe9d28dc307cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 11 Sep 2020 07:42:12 +0000 Subject: [PATCH 1/3] Accepting request 833524 from home:badshah400:branches:devel:libraries:c_c++ - Implement multibuild specfile to split out tests into its own flavor; this way we can build and run tests, which require static lib, as well as avoid packaging the latter without issues with the installed cmake file.. OBS-URL: https://build.opensuse.org/request/show/833524 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/c-ares?expand=0&rev=20 --- _multibuild | 3 +++ c-ares.changes | 8 ++++++++ c-ares.spec | 41 ++++++++++++++++++++++++++++++----------- 3 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 _multibuild diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..0bc293a --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + tests + diff --git a/c-ares.changes b/c-ares.changes index 0827c06..b50b1c0 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Sep 10 01:31:11 UTC 2020 - Atri Bhattacharya + +- Implement multibuild specfile to split out tests into its own + flavor; this way we can build and run tests, which require + static lib, as well as avoid packaging the latter without issues + with the installed cmake file.. + ------------------------------------------------------------------- Wed Jul 8 20:35:17 UTC 2020 - Matthias Eliasson diff --git a/c-ares.spec b/c-ares.spec index f677457..9911dc0 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -16,17 +16,30 @@ # +%global flavor @BUILD_FLAVOR@%{nil} + +%if "%{flavor}" == "tests" +%bcond_without tests +%define psuffix -tests +%endif + +%if "%{flavor}" == "" +%bcond_with tests +%endif + +%define pname c-ares + %define sonum 2 %define libname libcares%{sonum} -Name: c-ares +Name: %{pname}%{?psuffix} Version: 1.16.1 Release: 0 Summary: Library for asynchronous name resolves License: MIT URL: https://c-ares.haxx.se/ -Source0: http://c-ares.haxx.se/download/%{name}-%{version}.tar.gz -Source1: http://c-ares.haxx.se/download/%{name}-%{version}.tar.gz.asc -Source3: %{name}.keyring +Source0: http://c-ares.haxx.se/download/%{pname}-%{version}.tar.gz +Source1: http://c-ares.haxx.se/download/%{pname}-%{version}.tar.gz.asc +Source3: %{pname}.keyring Source4: baselibs.conf Patch0: 0001-Use-RPM-compiler-options.patch Patch1: disable-live-tests.patch @@ -80,7 +93,7 @@ This package provides the development libraries and headers needed to build packages that depend on c-ares. %prep -%autosetup -p1 -n %{name}-%{version} +%autosetup -p1 -n %{pname}-%{version} # Remove bogus cflags checking sed -i -e '/XC_CHECK_BUILD_FLAGS/d' configure.ac @@ -88,29 +101,34 @@ sed -i -e '/XC_CHECK_USER_FLAGS/d' m4/xc-cc-check.m4 %build %cmake \ - -DCARES_STATIC:BOOL=OFF \ - -DCARES_SHARED:BOOL=ON \ - -DCARES_INSTALL:BOOL=ON \ - -DCARES_BUILD_TESTS:BOOL=ON \ - -DCARES_BUILD_TOOLS:BOOL=ON -%make_build + -DCARES_STATIC:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} \ + -DCARES_SHARED:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} \ + -DCARES_INSTALL:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} \ + -DCARES_BUILD_TESTS:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} \ + -DCARES_BUILD_TOOLS:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} +%cmake_build %install +%if "%{flavor}" == "" %cmake_install install -m 644 -Dt %{buildroot}%{_mandir}/man1/ *.1 install -m 644 -Dt %{buildroot}%{_mandir}/man3/ *.3 # Tests require static lib so lets remove it so it does not get in package find %{buildroot} -type f \( -name "*.la" -o -name "*.a" \) -delete -print +%endif +%if "%{flavor}" == "tests" %check pushd build %make_build -C test export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib ./bin/arestest +%endif %post -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig +%if "%{flavor}" == "" %files utils %license LICENSE.md %{_bindir}/acountry @@ -131,5 +149,6 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib %{_mandir}/man3/ares_*.3%{?ext_man} %{_libdir}/pkgconfig/libcares.pc %{_libdir}/cmake/c-ares/ +%endif %changelog From a3c9a16c8242f93b11fe56fcbad80ce72855ae3ee73e0eb4c3169a050f0de278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 11 Sep 2020 07:54:43 +0000 Subject: [PATCH 2/3] - simplify conditions bit to make it tad more readable OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/c-ares?expand=0&rev=21 --- c-ares.changes | 5 +++++ c-ares.spec | 31 +++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/c-ares.changes b/c-ares.changes index b50b1c0..5dae4de 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Sep 11 07:54:10 UTC 2020 - Tomáš Chvátal + +- simplify conditions bit to make it tad more readable + ------------------------------------------------------------------- Thu Sep 10 01:31:11 UTC 2020 - Atri Bhattacharya diff --git a/c-ares.spec b/c-ares.spec index 9911dc0..f674c81 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -1,5 +1,5 @@ # -# spec file for package c-ares +# spec file for package c # # Copyright (c) 2020 SUSE LLC # @@ -17,18 +17,13 @@ %global flavor @BUILD_FLAVOR@%{nil} - %if "%{flavor}" == "tests" -%bcond_without tests %define psuffix -tests -%endif - -%if "%{flavor}" == "" +%bcond_without tests +%else %bcond_with tests %endif - %define pname c-ares - %define sonum 2 %define libname libcares%{sonum} Name: %{pname}%{?psuffix} @@ -101,15 +96,19 @@ sed -i -e '/XC_CHECK_USER_FLAGS/d' m4/xc-cc-check.m4 %build %cmake \ - -DCARES_STATIC:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} \ - -DCARES_SHARED:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} \ - -DCARES_INSTALL:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} \ - -DCARES_BUILD_TESTS:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} \ - -DCARES_BUILD_TOOLS:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} + -DCARES_STATIC:BOOL=OFF \ + -DCARES_SHARED:BOOL=ON \ + -DCARES_INSTALL:BOOL=ON \ + -DCARES_BUILD_TOOLS:BOOL=ON \ +%if %{with tests} + -DCARES_STATIC:BOOL=ON \ + -DCARES_BUILD_TESTS:BOOL=ON \ +%endif + %{nil} %cmake_build %install -%if "%{flavor}" == "" +%if !%{with tests} %cmake_install install -m 644 -Dt %{buildroot}%{_mandir}/man1/ *.1 install -m 644 -Dt %{buildroot}%{_mandir}/man3/ *.3 @@ -117,7 +116,7 @@ install -m 644 -Dt %{buildroot}%{_mandir}/man3/ *.3 find %{buildroot} -type f \( -name "*.la" -o -name "*.a" \) -delete -print %endif -%if "%{flavor}" == "tests" +%if %{with tests} %check pushd build %make_build -C test @@ -125,10 +124,10 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib ./bin/arestest %endif +%if !%{with tests} %post -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig -%if "%{flavor}" == "" %files utils %license LICENSE.md %{_bindir}/acountry From 958dddd2dabe28fe53455b521591e45a4f816e39a7fbfdb90e9f39b257e2f2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 11 Sep 2020 07:55:11 +0000 Subject: [PATCH 3/3] OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/c-ares?expand=0&rev=22 --- c-ares.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-ares.spec b/c-ares.spec index f674c81..7421d41 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -1,5 +1,5 @@ # -# spec file for package c +# spec file for package c-ares # # Copyright (c) 2020 SUSE LLC #