Skip to content

Commit 13143a1

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

1 file changed

Lines changed: 8 additions & 33 deletions

File tree

distro/pkg/rpm/libyang.spec

Lines changed: 8 additions & 33 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,43 +48,23 @@ 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
61-
%if 0%{?rhel} && 0%{?rhel} < 8
62-
cd build
63-
cmake \
64-
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
65-
-DCMAKE_BUILD_TYPE:String="Release" \
66-
-DCMAKE_C_FLAGS="${RPM_OPT_FLAGS}" \
67-
-DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS}" \
68-
..
69-
make
53+
%cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
54+
%cmake_build
55+
%if 0%{?suse_version}
56+
%cmake_build doc
7057
%else
71-
%cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
72-
%cmake_build
58+
%cmake_build --target doc
7359
%endif
74-
%cmake_build --target doc
7560

7661
%check
77-
%if ( 0%{?rhel} == 0 ) || 0%{?rhel} > 7
78-
%if "x%{?suse_version}" == "x"
79-
cd %{__cmake_builddir}
80-
%endif
81-
%endif
82-
ctest --output-on-failure -V %{?_smp_mflags}
62+
%ctest --output-on-failure
8363

8464
%install
8565
mkdir -m0755 -p %{buildroot}/%{_docdir}/libyang
86-
%if 0%{?rhel} && 0%{?rhel} < 8
87-
cd build
88-
make DESTDIR=%{buildroot} install
89-
%else
90-
%cmake_install
91-
cp -a doc/html %{buildroot}/%{_docdir}/libyang/html
92-
%endif
66+
%cmake_install
67+
cp -a doc/html %{buildroot}/%{_docdir}/libyang/html
9368

9469
%files
9570
%license LICENSE

0 commit comments

Comments
 (0)