From 43efffd0049ee05171ac5c2108889b92f6fa064d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Fri, 30 Dec 2016 10:31:22 +0100 Subject: [PATCH] Introduce doc-subpackage Use unified %%_pkgdocdir Updated Patch0 and use on el <= 6, only Rename Patch0 --> Patch 1000 Clean-up indentation --- uthash-2.0.1_fix-asciidoc.patch | 9 +---- uthash.spec | 70 +++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/uthash-2.0.1_fix-asciidoc.patch b/uthash-2.0.1_fix-asciidoc.patch index f2d35f5..59ddfe2 100644 --- a/uthash-2.0.1_fix-asciidoc.patch +++ b/uthash-2.0.1_fix-asciidoc.patch @@ -1,21 +1,14 @@ -From 0190e9e7234b0049a8c61cea536ab6aaeda28194 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= -Date: Thu, 29 Dec 2016 22:59:59 +0100 -Subject: [PATCH] Fix Author-string for older versions of asciidoc - ---- doc/userguide.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/userguide.txt b/doc/userguide.txt -index 7a04d0c..9f96e5a 100644 --- a/doc/userguide.txt +++ b/doc/userguide.txt @@ -1,6 +1,6 @@ uthash User Guide ================= -Troy D. Hanson, Arthur O'Dwyer -+:Author: Troy_D._Hanson,_Arthur_O'Dwyer ++Hanson, O'Dwyer v2.0.1, July 2016 To download uthash, follow this link back to the diff --git a/uthash.spec b/uthash.spec index 90dae9d..ee4b2f4 100644 --- a/uthash.spec +++ b/uthash.spec @@ -1,22 +1,29 @@ %global sover 0 %global git_url https://github.com/troydhanson/%{name} -%global common_desc \ +%global common_desc \ Any C structure can be stored in a hash table using uthash. Just \ add a UT_hash_handle to the structure and choose one or more fields \ in your structure to act as the key. Then use these macros to store, \ retrieve or delete items from the hash table. +# Setup _pkgdocdir if not defined already +%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} + + Name: uthash Version: 2.0.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A hash table for C structures License: BSD URL: http://troydhanson.github.io/uthash Source0: %{git_url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -Patch0: %{git_url}/pull/98.patch#/%{name}-2.0.1_fix-asciidoc.patch +%if (0%{?rhel} && 0%{?rhel} <= 6) +# Downstream patch for asciidoc generation. +Patch1000: %{name}-2.0.1_fix-asciidoc.patch +%endif # (0#{?rhel} && 0#{?rhel} <= 6) BuildRequires: asciidoc BuildRequires: perl @@ -36,6 +43,14 @@ BuildArch: noarch %{common_desc} +%package doc +Summary: Documentation-files for %{name}. +BuildArch: noarch + +%description doc +This package contains the documentation-files for %{name}. + + %package -n libut Summary: Library-implementation of utvector @@ -62,19 +77,28 @@ Development-files for libut. %configure || : export CFLAGS="-fPIC ${CFLAGS}" %make_build -C libut -%{__cc} -shared ${CFLAGS} ${LDFLAGS} \ - -Wl,-soname,libut.so.%{sover} \ +%{__cc} -shared ${CFLAGS} ${LDFLAGS} \ + -Wl,-soname,libut.so.%{sover} \ -o libut/libut.so.%{sover} libut/*.o %make_build -C doc %install -%{__mkdir} -p html %{buildroot}%{_includedir} \ - %{buildroot}%{_libdir} +%{__mkdir} -p html \ + %{buildroot}%{_includedir} \ + %{buildroot}%{_libdir} \ + %{buildroot}%{_pkgdocdir}/{html,libut} %{__install} -pm 0644 src/*.h %{buildroot}%{_includedir} %{__install} -pm 0755 libut/libut.so.0 %{buildroot}%{_libdir} /bin/ln -s %{_libdir}/libut.so.0 %{buildroot}%{_libdir}/libut.so -%{__cp} -a doc/*.html doc/*.css doc/*.png html + +# Install doc. +%{__install} -pm 0644 doc/*.txt %{buildroot}%{_pkgdocdir} +%{__install} -pm 0644 doc/*.html doc/*.css doc/*.png %{buildroot}%{_pkgdocdir}/html +%{__install} -pm 0644 libut/README.md %{buildroot}%{_pkgdocdir}/libut +%if (0%{?rhel} && 0%{?rhel} <= 6) +%{__install} -pm 0644 LICENSE %{buildroot}%{_pkgdocdir} +%endif # (0#{?rhel} && 0#{?rhel} <= 6) %check @@ -89,17 +113,33 @@ export CFLAGS="-fPIC ${CFLAGS}" %files devel +%if !(0%{?rhel} && 0%{?rhel} <= 6) %license LICENSE -%doc doc/*.txt html/ +%else # !(0%{?rhel} && 0%{?rhel} <= 6) +%doc %{_pkgdocdir}/LICENSE +%endif # !(0%{?rhel} && 0%{?rhel} <= 6) +%doc %dir %{_pkgdocdir} %exclude %{_includedir}/utvector.h %{_includedir}/ut*.h +%files doc +%if !(0%{?rhel} && 0%{?rhel} <= 6) +%license %{_datadir}/licenses/%{name}* +%endif # !(0%{?rhel} && 0%{?rhel} <= 6) +%doc %{_pkgdocdir} + %files -n libut -%license LICENSE +%if !(0%{?rhel} && 0%{?rhel} <= 6) +%license %{_datadir}/licenses/%{name}* +%else # !(0%{?rhel} && 0%{?rhel} <= 6) +%doc %{_pkgdocdir}/LICENSE +%endif # !(0%{?rhel} && 0%{?rhel} <= 6) +%doc %dir %{_pkgdocdir} %{_libdir}/libut.so.%{sover} %files -n libut-devel -%doc libut/README.md +%doc %dir %{_pkgdocdir} +%doc %dir %{_pkgdocdir}/libut/README.md %{_includedir}/libut.h %{_includedir}/ringbuf.h %{_includedir}/utvector.h @@ -107,6 +147,14 @@ export CFLAGS="-fPIC ${CFLAGS}" %changelog +* Fri Dec 30 2016 Björn Esser - 2.0.1-5 +- Introduce doc-subpackage +- Use unified %%_pkgdocdir +- Updated Patch0 and use on el <= 6, only +- Rename Patch0 --> Patch 1000 +- Clean-up indentation + + * Thu Dec 29 2016 Björn Esser - 2.0.1-4 - Include plain ascii-docs, too