SHA256
1
0
forked from pool/c-ares

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
This commit is contained in:
Tomáš Chvátal 2020-09-11 07:42:12 +00:00 committed by Git OBS Bridge
parent a4815457d3
commit dc6b2f9fb6
3 changed files with 41 additions and 11 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>tests</package>
</multibuild>

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Sep 10 01:31:11 UTC 2020 - Atri Bhattacharya <badshah400@gmail.com>
- 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 <elimat@opensuse.org> Wed Jul 8 20:35:17 UTC 2020 - Matthias Eliasson <elimat@opensuse.org>

View File

@ -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 sonum 2
%define libname libcares%{sonum} %define libname libcares%{sonum}
Name: c-ares Name: %{pname}%{?psuffix}
Version: 1.16.1 Version: 1.16.1
Release: 0 Release: 0
Summary: Library for asynchronous name resolves Summary: Library for asynchronous name resolves
License: MIT License: MIT
URL: https://c-ares.haxx.se/ URL: https://c-ares.haxx.se/
Source0: http://c-ares.haxx.se/download/%{name}-%{version}.tar.gz Source0: http://c-ares.haxx.se/download/%{pname}-%{version}.tar.gz
Source1: http://c-ares.haxx.se/download/%{name}-%{version}.tar.gz.asc Source1: http://c-ares.haxx.se/download/%{pname}-%{version}.tar.gz.asc
Source3: %{name}.keyring Source3: %{pname}.keyring
Source4: baselibs.conf Source4: baselibs.conf
Patch0: 0001-Use-RPM-compiler-options.patch Patch0: 0001-Use-RPM-compiler-options.patch
Patch1: disable-live-tests.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. to build packages that depend on c-ares.
%prep %prep
%autosetup -p1 -n %{name}-%{version} %autosetup -p1 -n %{pname}-%{version}
# Remove bogus cflags checking # Remove bogus cflags checking
sed -i -e '/XC_CHECK_BUILD_FLAGS/d' configure.ac 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 %build
%cmake \ %cmake \
-DCARES_STATIC:BOOL=OFF \ -DCARES_STATIC:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} \
-DCARES_SHARED:BOOL=ON \ -DCARES_SHARED:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} \
-DCARES_INSTALL:BOOL=ON \ -DCARES_INSTALL:BOOL=%{?with_tests:OFF}%{!?with_tests:ON} \
-DCARES_BUILD_TESTS:BOOL=ON \ -DCARES_BUILD_TESTS:BOOL=%{?with_tests:ON}%{!?with_tests:OFF} \
-DCARES_BUILD_TOOLS:BOOL=ON -DCARES_BUILD_TOOLS:BOOL=%{?with_tests:OFF}%{!?with_tests:ON}
%make_build %cmake_build
%install %install
%if "%{flavor}" == ""
%cmake_install %cmake_install
install -m 644 -Dt %{buildroot}%{_mandir}/man1/ *.1 install -m 644 -Dt %{buildroot}%{_mandir}/man1/ *.1
install -m 644 -Dt %{buildroot}%{_mandir}/man3/ *.3 install -m 644 -Dt %{buildroot}%{_mandir}/man3/ *.3
# Tests require static lib so lets remove it so it does not get in package # 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 find %{buildroot} -type f \( -name "*.la" -o -name "*.a" \) -delete -print
%endif
%if "%{flavor}" == "tests"
%check %check
pushd build pushd build
%make_build -C test %make_build -C test
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib
./bin/arestest ./bin/arestest
%endif
%post -n %{libname} -p /sbin/ldconfig %post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig
%if "%{flavor}" == ""
%files utils %files utils
%license LICENSE.md %license LICENSE.md
%{_bindir}/acountry %{_bindir}/acountry
@ -131,5 +149,6 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib
%{_mandir}/man3/ares_*.3%{?ext_man} %{_mandir}/man3/ares_*.3%{?ext_man}
%{_libdir}/pkgconfig/libcares.pc %{_libdir}/pkgconfig/libcares.pc
%{_libdir}/cmake/c-ares/ %{_libdir}/cmake/c-ares/
%endif
%changelog %changelog