Skip to content

Commit 4bc4552

Browse files
committed
distro UPDATE use cmake abstraction for build commands in RPM
1 parent 0c98eb5 commit 4bc4552

1 file changed

Lines changed: 9 additions & 19 deletions

File tree

distro/pkg/rpm/libyang.spec

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
%if 0%{?rhel} == 8
2-
%undefine __cmake_in_source_build
3-
%endif
4-
51
Name: libyang
62
Version: {{ version }}
73
Release: {{ release }}%{?dist}
@@ -14,7 +10,6 @@ BuildRequires: cmake
1410
BuildRequires: doxygen
1511
BuildRequires: gcc
1612
BuildRequires: cmake(cmocka) >= 1.0.1
17-
BuildRequires: make
1813
BuildRequires: pkgconfig(libpcre2-8) >= 10.21
1914

2015
%package modules
@@ -53,39 +48,34 @@ written (and providing API) in C.
5348

5449
%prep
5550
%autosetup -p1
56-
%if 0%{?rhel} && 0%{?rhel} < 8
57-
mkdir build
58-
%endif
5951

6052
%build
6153
%if 0%{?rhel} && 0%{?rhel} < 8
62-
cd build
6354
cmake \
6455
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
6556
-DCMAKE_BUILD_TYPE:String="Release" \
6657
-DCMAKE_C_FLAGS="${RPM_OPT_FLAGS}" \
6758
-DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS}" \
68-
..
69-
make
59+
${__cmake_builddir}
60+
cmake --build ${__cmake_builddir} -j4
61+
cmake --build ${__cmake_builddir} --target doc
7062
%else
7163
%cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
7264
%cmake_build
65+
%cmake_build doc
7366
%endif
74-
%cmake_build --target doc
7567

7668
%check
77-
%if ( 0%{?rhel} == 0 ) || 0%{?rhel} > 7
78-
%if "x%{?suse_version}" == "x"
79-
cd %{__cmake_builddir}
80-
%endif
69+
%if 0%{?rhel} && 0%{?rhel} < 8
70+
ctest --output-on-failure --test-dir ${__cmake_builddir} -V %{?_smp_mflags}
71+
%else
72+
%ctest --output-on-failure
8173
%endif
82-
ctest --output-on-failure -V %{?_smp_mflags}
8374

8475
%install
8576
mkdir -m0755 -p %{buildroot}/%{_docdir}/libyang
8677
%if 0%{?rhel} && 0%{?rhel} < 8
87-
cd build
88-
make DESTDIR=%{buildroot} install
78+
DESTDIR=%{buildroot} cmake --build ${__cmake_builddir} --target install
8979
%else
9080
%cmake_install
9181
cp -a doc/html %{buildroot}/%{_docdir}/libyang/html

0 commit comments

Comments
 (0)