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 | |
| 20 | %package devel |
| 21 | Summary: Development files for libyang |
| 22 | Requires: %{name}%{?_isa} = %{version}-%{release} |
| 23 | Requires: pcre2-devel |
| 24 | |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 25 | %package devel-doc |
| 26 | Summary: Documentation of libyang API |
| 27 | Requires: %{name}%{?_isa} = %{version}-%{release} |
| 28 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 29 | %package tools |
| 30 | Summary: YANG validator tools |
| 31 | Requires: %{name}%{?_isa} = %{version}-%{release} |
| 32 | # This was not properly split out before |
| 33 | Conflicts: %{name} < 1.0.225-3 |
| 34 | |
| 35 | %description devel |
| 36 | Headers of libyang library. |
| 37 | |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 38 | %description devel-doc |
| 39 | Documentation of libyang API. |
| 40 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 41 | %description tools |
| 42 | YANG validator tools. |
| 43 | |
| 44 | %description |
| 45 | Libyang is YANG data modeling language parser and toolkit |
| 46 | written (and providing API) in C. |
| 47 | |
| 48 | %prep |
| 49 | %autosetup -p1 |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame^] | 50 | %if 0%{?rhel} && 0%{?rhel} < 8 |
| 51 | mkdir build |
| 52 | %endif |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 53 | |
| 54 | %build |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame^] | 55 | %if 0%{?rhel} && 0%{?rhel} < 8 |
| 56 | cd build |
| 57 | cmake \ |
| 58 | -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \ |
| 59 | -DCMAKE_BUILD_TYPE:String="Release" \ |
| 60 | -DCMAKE_C_FLAGS="${RPM_OPT_FLAGS}" \ |
| 61 | -DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS}" \ |
| 62 | .. |
| 63 | make |
| 64 | %else |
| 65 | %cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO |
| 66 | %cmake_build |
| 67 | %if "x%{?suse_version}" == "x" |
| 68 | cd %{__cmake_builddir} |
| 69 | %endif |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 70 | %endif |
| 71 | make doc |
| 72 | |
| 73 | %check |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame^] | 74 | %if ( 0%{?rhel} == 0 ) || 0%{?rhel} > 7 |
| 75 | %if "x%{?suse_version}" == "x" |
| 76 | cd %{__cmake_builddir} |
| 77 | %endif |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 78 | %endif |
| 79 | ctest --output-on-failure -V %{?_smp_mflags} |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 80 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 81 | %install |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 82 | mkdir -m0755 -p %{buildroot}/%{_docdir}/libyang |
Martin Winter | b6cdfd7 | 2023-06-16 03:20:52 +0200 | [diff] [blame^] | 83 | %if 0%{?rhel} && 0%{?rhel} < 8 |
| 84 | cd build |
| 85 | make DESTDIR=%{buildroot} install |
| 86 | %else |
| 87 | %cmake_install |
| 88 | cp -a doc/html %{buildroot}/%{_docdir}/libyang/html |
| 89 | %endif |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 90 | |
| 91 | %files |
| 92 | %license LICENSE |
| 93 | %{_libdir}/libyang.so.2 |
| 94 | %{_libdir}/libyang.so.2.* |
Michal Vasko | 56c9d8d | 2022-06-09 16:06:43 +0200 | [diff] [blame] | 95 | %{_datadir}/yang/modules/libyang/*.yang |
Michal Vasko | 9494749 | 2022-06-08 07:52:10 +0200 | [diff] [blame] | 96 | %dir %{_datadir}/yang/ |
Michal Vasko | 9436df3 | 2022-06-09 08:04:34 +0200 | [diff] [blame] | 97 | %dir %{_datadir}/yang/modules/ |
| 98 | %dir %{_datadir}/yang/modules/libyang/ |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 99 | |
| 100 | %files tools |
| 101 | %{_bindir}/yanglint |
| 102 | %{_bindir}/yangre |
| 103 | %{_datadir}/man/man1/yanglint.1.gz |
Jakub Ružička | b6a86a4 | 2021-09-27 15:15:26 +0200 | [diff] [blame] | 104 | %{_datadir}/man/man1/yangre.1.gz |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 105 | |
| 106 | %files devel |
| 107 | %{_libdir}/libyang.so |
| 108 | %{_libdir}/pkgconfig/libyang.pc |
| 109 | %{_includedir}/libyang/*.h |
| 110 | %dir %{_includedir}/libyang/ |
| 111 | |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 112 | %files devel-doc |
| 113 | %{_docdir}/libyang |
| 114 | |
Jakub Ružička | c82b421 | 2021-09-27 15:13:10 +0200 | [diff] [blame] | 115 | %changelog |
Jakub Ružička | ab10588 | 2022-04-20 14:22:28 +0200 | [diff] [blame] | 116 | * {{ 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] | 117 | - upstream package |