Blame glm4/appstream-xml.m4

rpm-build 858c0f
# appstream-xml.m4
rpm-build 858c0f
#
rpm-build 858c0f
# serial 6
rpm-build 858c0f
rpm-build 858c0f
dnl APPSTREAM_XML
rpm-build 858c0f
dnl Installs and validates AppData XML files.
rpm-build 858c0f
dnl
rpm-build 858c0f
dnl Call APPSTREAM_XML in configure.ac to check for the appstream-util tool.
rpm-build 858c0f
dnl Add @APPSTREAM_XML_RULES@ to a Makefile.am to substitute the make rules. Add
rpm-build 858c0f
dnl .appdata.xml files to appstream_XML in Makefile.am and they will be validated
rpm-build 858c0f
dnl at make check time, if appstream-util is installed, as well as installed
rpm-build 858c0f
dnl to the correct location automatically. Add --enable-appstream-util to
rpm-build 858c0f
dnl AM_DISTCHECK_CONFIGURE_FLAGS in Makefile.am to require valid AppData XML when
rpm-build 858c0f
dnl doing a distcheck.
rpm-build 858c0f
dnl
rpm-build 858c0f
dnl Adding files to appstream_XML does not distribute them automatically.
rpm-build 858c0f
rpm-build 858c0f
AC_DEFUN([APPSTREAM_XML],
rpm-build 858c0f
[
rpm-build 858c0f
  m4_pattern_allow([AM_V_GEN])
rpm-build 858c0f
  AC_ARG_ENABLE([appstream-util],
rpm-build 858c0f
                [AS_HELP_STRING([--disable-appstream-util],
rpm-build 858c0f
                                [Disable validating AppData XML files during check phase])])
rpm-build 858c0f
rpm-build 858c0f
  AS_IF([test "x$enable_appstream_validate" != "xno"],
rpm-build 858c0f
        [AC_PATH_PROG([APPSTREAM_UTIL], [appstream-util])
rpm-build 858c0f
         AS_IF([test "x$APPSTREAM_UTIL" = "x"],
rpm-build 858c0f
               [have_appstream_validate=no],
rpm-build 858c0f
               [have_appstream_validate=yes
rpm-build 858c0f
                AC_SUBST([APPSTREAM_UTIL])])],
rpm-build 858c0f
        [have_appstream_validate=no])
rpm-build 858c0f
rpm-build 858c0f
  AS_IF([test "x$have_appstream_validate" != "xno"],
rpm-build 858c0f
        [appstream_validate=yes],
rpm-build 858c0f
        [appstream_validate=no
rpm-build 858c0f
         AS_IF([test "x$enable_appstream_validate" = "xyes"],
rpm-build 858c0f
               [AC_MSG_ERROR([AppData validation was requested but appstream-util was not found])])])
rpm-build 858c0f
rpm-build 858c0f
  AC_SUBST([appstreamxmldir], [${datadir}/metainfo])
rpm-build 858c0f
rpm-build 858c0f
  APPSTREAM_XML_RULES='
rpm-build 858c0f
.PHONY : uninstall-appstream-xml install-appstream-xml clean-appstream-xml
rpm-build 858c0f
rpm-build 858c0f
mostlyclean-am: clean-appstream-xml
rpm-build 858c0f
rpm-build 858c0f
%.appdata.valid: %.appdata.xml
rpm-build 858c0f
	$(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; \
rpm-build 858c0f
		if test -n "$(APPSTREAM_UTIL)"; \
rpm-build 858c0f
			then $(APPSTREAM_UTIL) --nonet validate $${d}$<; fi \
rpm-build 858c0f
		&& touch [$]@
rpm-build 858c0f
rpm-build 858c0f
check-am: $(appstream_XML:.appdata.xml=.appdata.valid)
rpm-build 858c0f
uninstall-am: uninstall-appstream-xml
rpm-build 858c0f
install-data-am: install-appstream-xml
rpm-build 858c0f
rpm-build 858c0f
.SECONDARY: $(appstream_XML)
rpm-build 858c0f
rpm-build 858c0f
install-appstream-xml: $(appstream_XML)
rpm-build 858c0f
	@$(NORMAL_INSTALL)
rpm-build 858c0f
	if test -n "$^"; then \
rpm-build 858c0f
		test -z "$(appstreamxmldir)" || $(MKDIR_P) "$(DESTDIR)$(appstreamxmldir)"; \
rpm-build 858c0f
		$(INSTALL_DATA) $^ "$(DESTDIR)$(appstreamxmldir)"; \
rpm-build 858c0f
	fi
rpm-build 858c0f
rpm-build 858c0f
uninstall-appstream-xml:
rpm-build 858c0f
	@$(NORMAL_UNINSTALL)
rpm-build 858c0f
	@list='\''$(appstream_XML)'\''; test -n "$(appstreamxmldir)" || list=; \
rpm-build 858c0f
	files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
rpm-build 858c0f
	test -n "$$files" || exit 0; \
rpm-build 858c0f
	echo " ( cd '\''$(DESTDIR)$(appstreamxmldir)'\'' && rm -f" $$files ")"; \
rpm-build 858c0f
	cd "$(DESTDIR)$(appstreamxmldir)" && rm -f $$files
rpm-build 858c0f
rpm-build 858c0f
clean-appstream-xml:
rpm-build 858c0f
	rm -f $(appstream_XML:.appdata.xml=.appdata.valid)
rpm-build 858c0f
'
rpm-build 858c0f
  _APPSTREAM_XML_SUBST(APPSTREAM_XML_RULES)
rpm-build 858c0f
])
rpm-build 858c0f
rpm-build 858c0f
dnl _APPSTREAM_XML_SUBST(VARIABLE)
rpm-build 858c0f
dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
rpm-build 858c0f
AC_DEFUN([_APPSTREAM_XML_SUBST],
rpm-build 858c0f
[
rpm-build 858c0f
AC_SUBST([$1])
rpm-build 858c0f
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
rpm-build 858c0f
]
rpm-build 858c0f
)