Jakub Ružička | d57c888 | 2023-02-17 17:21:17 +0100 | [diff] [blame] | 1 | %if 0%{?rhel} == 8 |
| 2 | %undefine __cmake_in_source_build |
| 3 | %endif |
| 4 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 5 | Name: libyang |
| 6 | Version: {{ version }} |
| 7 | Release: {{ release }}%{?dist} |
| 8 | Summary: YANG data modeling language library |
| 9 | Url: https://github.com/CESNET/libyang |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 10 | Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 11 | License: BSD |
| 12 | |
| 13 | BuildRequires: cmake |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 14 | BuildRequires: doxygen |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 15 | BuildRequires: gcc |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 16 | BuildRequires: cmake(cmocka) >= 1.0.1 |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 17 | BuildRequires: make |
| 18 | BuildRequires: pkgconfig(libpcre2-8) >= 10.21 |
| 19 | |
Igor Ryzhov | b050075 | 2024-03-27 18:40:06 +0200 | [diff] [blame] | 20 | %package modules |
| 21 | Summary: YANG modules for libyang |
| 22 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 23 | %package devel |
| 24 | Summary: Development files for libyang |
| 25 | Requires: %{name}%{?_isa} = %{version}-%{release} |
| 26 | Requires: pcre2-devel |
| 27 | |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 28 | %package devel-doc |
| 29 | Summary: Documentation of libyang API |
| 30 | Requires: %{name}%{?_isa} = %{version}-%{release} |
| 31 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 32 | %package tools |
| 33 | Summary: YANG validator tools |
| 34 | Requires: %{name}%{?_isa} = %{version}-%{release} |
| 35 | # This was not properly split out before |
| 36 | Conflicts: %{name} < 1.0.225-3 |
| 37 | |
Igor Ryzhov | b050075 | 2024-03-27 18:40:06 +0200 | [diff] [blame] | 38 | %description modules |
| 39 | YANG modules for libyang. |
| 40 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 41 | %description devel |
| 42 | Headers of libyang library. |
| 43 | |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 44 | %description devel-doc |
| 45 | Documentation of libyang API. |
| 46 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 47 | %description tools |
| 48 | YANG validator tools. |
| 49 | |
| 50 | %description |
| 51 | Libyang is YANG data modeling language parser and toolkit |
| 52 | written (and providing API) in C. |
| 53 | |
| 54 | %prep |
| 55 | %autosetup -p1 |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame] | 56 | %if 0%{?rhel} && 0%{?rhel} < 8 |
| 57 | mkdir build |
| 58 | %endif |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 59 | |
| 60 | %build |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame] | 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 |
| 70 | %else |
| 71 | %cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO |
| 72 | %cmake_build |
| 73 | %if "x%{?suse_version}" == "x" |
| 74 | cd %{__cmake_builddir} |
| 75 | %endif |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 76 | %endif |
| 77 | make doc |
| 78 | |
| 79 | %check |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame] | 80 | %if ( 0%{?rhel} == 0 ) || 0%{?rhel} > 7 |
| 81 | %if "x%{?suse_version}" == "x" |
| 82 | cd %{__cmake_builddir} |
| 83 | %endif |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 84 | %endif |
| 85 | ctest --output-on-failure -V %{?_smp_mflags} |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 86 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 87 | %install |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 88 | mkdir -m0755 -p %{buildroot}/%{_docdir}/libyang |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame] | 89 | %if 0%{?rhel} && 0%{?rhel} < 8 |
| 90 | cd build |
| 91 | make DESTDIR=%{buildroot} install |
| 92 | %else |
| 93 | %cmake_install |
| 94 | cp -a doc/html %{buildroot}/%{_docdir}/libyang/html |
| 95 | %endif |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 96 | |
| 97 | %files |
| 98 | %license LICENSE |
Michal Vasko | 71d0ca9 | 2024-02-26 15:14:52 +0100 | [diff] [blame] | 99 | %{_libdir}/libyang.so.3 |
| 100 | %{_libdir}/libyang.so.3.* |
Igor Ryzhov | b050075 | 2024-03-27 18:40:06 +0200 | [diff] [blame] | 101 | |
| 102 | %files modules |
Michal Vasko | 56c9d8d | 2022-06-09 16:06:43 +0200 | [diff] [blame] | 103 | %{_datadir}/yang/modules/libyang/*.yang |
Michal Vasko | 9494749 | 2022-06-08 07:52:10 +0200 | [diff] [blame] | 104 | %dir %{_datadir}/yang/ |
Michal Vasko | 9436df3 | 2022-06-09 08:04:34 +0200 | [diff] [blame] | 105 | %dir %{_datadir}/yang/modules/ |
| 106 | %dir %{_datadir}/yang/modules/libyang/ |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 107 | |
| 108 | %files tools |
| 109 | %{_bindir}/yanglint |
| 110 | %{_bindir}/yangre |
| 111 | %{_datadir}/man/man1/yanglint.1.gz |
Jakub Ružička | b6a86a4 | 2021-09-27 15:15:26 +0200 | [diff] [blame] | 112 | %{_datadir}/man/man1/yangre.1.gz |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 113 | |
| 114 | %files devel |
| 115 | %{_libdir}/libyang.so |
| 116 | %{_libdir}/pkgconfig/libyang.pc |
| 117 | %{_includedir}/libyang/*.h |
| 118 | %dir %{_includedir}/libyang/ |
| 119 | |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 120 | %files devel-doc |
| 121 | %{_docdir}/libyang |
| 122 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 123 | %changelog |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 124 | * {{ now }} Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }} |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 125 | - upstream package |