blob: eccc4a57f2e9d6d75ba7169b5aa9ae81a64544b3 [file] [log] [blame]
Jakub Ružičkad57c8882023-02-17 17:21:17 +01001%if 0%{?rhel} == 8
2%undefine __cmake_in_source_build
3%endif
4
Jakub Ružičkac82b4212021-09-27 15:13:10 +02005Name: libyang
6Version: {{ version }}
7Release: {{ release }}%{?dist}
8Summary: YANG data modeling language library
9Url: https://github.com/CESNET/libyang
Jakub Ružičkaab105882022-04-20 14:22:28 +020010Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Jakub Ružičkac82b4212021-09-27 15:13:10 +020011License: BSD
12
13BuildRequires: cmake
Jakub Ružičkaab105882022-04-20 14:22:28 +020014BuildRequires: doxygen
Jakub Ružičkac82b4212021-09-27 15:13:10 +020015BuildRequires: gcc
Jakub Ružičkaab105882022-04-20 14:22:28 +020016BuildRequires: cmake(cmocka) >= 1.0.1
Jakub Ružičkac82b4212021-09-27 15:13:10 +020017BuildRequires: make
18BuildRequires: pkgconfig(libpcre2-8) >= 10.21
19
20%package devel
21Summary: Development files for libyang
22Requires: %{name}%{?_isa} = %{version}-%{release}
23Requires: pcre2-devel
24
Jakub Ružičkaab105882022-04-20 14:22:28 +020025%package devel-doc
26Summary: Documentation of libyang API
27Requires: %{name}%{?_isa} = %{version}-%{release}
28
Jakub Ružičkac82b4212021-09-27 15:13:10 +020029%package tools
30Summary: YANG validator tools
31Requires: %{name}%{?_isa} = %{version}-%{release}
32# This was not properly split out before
33Conflicts: %{name} < 1.0.225-3
34
35%description devel
36Headers of libyang library.
37
Jakub Ružičkaab105882022-04-20 14:22:28 +020038%description devel-doc
39Documentation of libyang API.
40
Jakub Ružičkac82b4212021-09-27 15:13:10 +020041%description tools
42YANG validator tools.
43
44%description
45Libyang is YANG data modeling language parser and toolkit
46written (and providing API) in C.
47
48%prep
49%autosetup -p1
Jakub Ružičkac82b4212021-09-27 15:13:10 +020050
51%build
Jakub Ružičkaab105882022-04-20 14:22:28 +020052%cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
53%cmake_build
54
55%if "x%{?suse_version}" == "x"
Jakub Ružičkad57c8882023-02-17 17:21:17 +010056cd %{__cmake_builddir}
Jakub Ružičkaab105882022-04-20 14:22:28 +020057%endif
58make doc
59
60%check
61%if "x%{?suse_version}" == "x"
Jakub Ružičkad57c8882023-02-17 17:21:17 +010062cd %{__cmake_builddir}
Jakub Ružičkaab105882022-04-20 14:22:28 +020063%endif
64ctest --output-on-failure -V %{?_smp_mflags}
Jakub Ružičkac82b4212021-09-27 15:13:10 +020065
Jakub Ružičkac82b4212021-09-27 15:13:10 +020066%install
Jakub Ružičkaab105882022-04-20 14:22:28 +020067%cmake_install
68
69mkdir -m0755 -p %{buildroot}/%{_docdir}/libyang
70cp -a doc/html %{buildroot}/%{_docdir}/libyang/html
Jakub Ružičkac82b4212021-09-27 15:13:10 +020071
72%files
73%license LICENSE
74%{_libdir}/libyang.so.2
75%{_libdir}/libyang.so.2.*
Michal Vasko56c9d8d2022-06-09 16:06:43 +020076%{_datadir}/yang/modules/libyang/*.yang
Michal Vasko94947492022-06-08 07:52:10 +020077%dir %{_datadir}/yang/
Michal Vasko9436df32022-06-09 08:04:34 +020078%dir %{_datadir}/yang/modules/
79%dir %{_datadir}/yang/modules/libyang/
Jakub Ružičkac82b4212021-09-27 15:13:10 +020080
81%files tools
82%{_bindir}/yanglint
83%{_bindir}/yangre
84%{_datadir}/man/man1/yanglint.1.gz
Jakub Ružičkab6a86a42021-09-27 15:15:26 +020085%{_datadir}/man/man1/yangre.1.gz
Jakub Ružičkac82b4212021-09-27 15:13:10 +020086
87%files devel
88%{_libdir}/libyang.so
89%{_libdir}/pkgconfig/libyang.pc
90%{_includedir}/libyang/*.h
91%dir %{_includedir}/libyang/
92
Jakub Ružičkaab105882022-04-20 14:22:28 +020093%files devel-doc
94%{_docdir}/libyang
95
Jakub Ružičkac82b4212021-09-27 15:13:10 +020096%changelog
Jakub Ružičkaab105882022-04-20 14:22:28 +020097* {{ now }} Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }}
Jakub Ružičkac82b4212021-09-27 15:13:10 +020098- upstream package