From a11ad68d65995771662f84146d6cb1ddde962ac5 Mon Sep 17 00:00:00 2001
From: Jens Petersen <petersen@redhat.com>
Date: Wed, 7 Aug 2019 14:07:56 +0200
Subject: [PATCH] check if doc haddock dir exists

---
 ghc-rpm-macros.spec | 5 ++++-
 macros.ghc          | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index cc5f021..22a93ea 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -10,7 +10,7 @@
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        2.0.1
+Version:        2.0.2
 Release:        1%{?dist}
 Summary:        RPM macros for building Haskell packages for GHC
 
@@ -203,6 +203,9 @@ EOF
 
 
 %changelog
+* Tue Aug  6 2019 Jens Petersen <petersen@redhat.com> - 2.0.2-1
+- check if doc haddock dir exists
+
 * Mon Aug  5 2019 Jens Petersen <petersen@redhat.com> - 2.0.1-1
 - ghc_lib_subpackage: provide static with isa suffix
 
diff --git a/macros.ghc b/macros.ghc
index f25ba09..831460e 100644
--- a/macros.ghc
+++ b/macros.ghc
@@ -92,7 +92,9 @@ touch %{basepkg}-devel.files %{basepkg}-prof.files\
 fi\
 ls %{buildroot}%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf >> %{basepkg}-devel.files\
 %if %{with haddock}\
+if [ -d %{buildroot}%{ghc_html_libraries_dir}/%{pkgnamever} ]; then\
 echo %{ghc_html_libraries_dir}/%{pkgnamever} >> %{basepkg}-doc.files\
+fi\
 %endif\
 for i in %{basepkg}.files %{basepkg}-devel.files %{basepkg}-doc.files %{basepkg}-prof.files; do\
 if [ -f "$i" ]; then\