+# Haskell Macros
+# BuildRequires: rpmbuild(macros) >= 1.608
+%ghcdir ghc-%(/usr/bin/ghc --numeric-version 2>/dev/null || echo ERROR)
+
+# update /usr/lib*/ghc-*/package.conf.d/package.cache
+# Requires: ghc
+# BuildRequires: rpmbuild(macros) >= 1.607
+#
+%ghc_pkg_recache() {{ \
+ umask 022; \
+ /usr/bin/ghc-pkg recache; \
+};} \
+%{nil}
+
+
+# pre/post script for -systemd subpackages
+#
+# Author: Bartlomiej Zimon <uzi18@o2.pl>
+#
+# Usage:
+# %systemd_post
+# %systemd_enable service_name.service
+# %systemd_preun service_name.service
+# %systemd_postun service_name.service
+#
+# Sample:
+# %post systemd
+# %systemd_post
+# or if service must be enabled by default:
+# %post systemd
+# %systemd_post
+# %systemd_enable %{name}
+#
+# %preun systemd
+# %systemd_preun %{name}
+#
+# %postun systemd
+# %systemd_postun %{name}
+#
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.622
+# Requires: rc-scripts >= ...
+
+%systemd_enable() \
+ if [ $1 -eq 1 ]; then \
+ /bin/systemctl enable %1 >/dev/null 2>&1 || : \
+ fi
+
+%systemd_post() \
+ if [ $1 -eq 1 ]; then \
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
+ fi
+
+%systemd_preun() \
+ if [ $1 -eq 0 ]; then \
+ /bin/systemctl --no-reload disable %1 > /dev/null 2>&1 || : \
+ /bin/systemctl stop %1 > /dev/null 2>&1 || : \
+ fi
+
+%systemd_postun() \
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
+ if [ $1 -ge 1 ]; then \
+ /bin/systemctl try-restart %1 >/dev/null 2>&1 || : \
+ fi
+
+%systemdunitdir /lib/systemd/system
+