Integrate AppData file with build system

This commit is contained in:
scx 2019-09-08 06:02:02 +02:00 committed by wangqr
parent 4f351b8b4a
commit d252dcf32d
4 changed files with 24 additions and 0 deletions

View file

@ -54,6 +54,7 @@ P_BINDIR = @bindir@
P_DATAROOT = @datarootdir@
P_LOCALE = @localedir@
P_APPDATA = @P_APPDATA@
P_DESKTOP = @P_DESKTOP@
P_ICON = @P_ICON@
P_DATA = $(P_DATAROOT)/aegisub/

View file

@ -54,6 +54,13 @@ AEGISUB_CATALOG="aegisub"
AC_SUBST(AEGISUB_CATALOG)
AC_DEFINE_UNQUOTED([AEGISUB_CATALOG], ["${AEGISUB_CATALOG}"], [Name of the Aegisub gettext catalog])
# Handle location of appdata files: https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#spec-component-location
AC_ARG_WITH(appdata-dir,
AS_HELP_STRING([--with-appdata-dir=PATH],[appdata file locations [PREFIX/share/metainfo]]))
P_APPDATA=${with_appdata_dir:-$datarootdir/metainfo}
AC_SUBST(P_APPDATA)
# Handle location of desktop files: http://freedesktop.org/wiki/Specifications/desktop-entry-spec
AC_ARG_WITH(desktop-dir,
AS_HELP_STRING([--with-desktop-dir=PATH],[desktop file locations [PREFIX/share/applications]]))
@ -563,6 +570,7 @@ DEFAULT_PLAYER_AUDIO=${DEFAULT_PLAYER_AUDIO:-NONE}
# Files that need substitution.
AC_CONFIG_FILES([
packages/desktop/aegisub.desktop.template
packages/desktop/aegisub.appdata.xml.template
src/libresrc/default_config_platform.json
tools/osx-bundle.sed
Makefile.inc

View file

@ -10,15 +10,26 @@ DESKTOP_FILE_INSTALLED = $(DESTDIR)$(P_DESKTOP)/$(notdir $(DESKTOP_FILE))
DISTCLEANFILES += $(DESKTOP_FILE)
APPDATA_FILE := $(d)aegisub.appdata.xml
APPDATA_FILE_PO := $(d)../../po
APPDATA_FILE_INSTALLED = $(DESTDIR)$(P_APPDATA)/$(notdir $(APPDATA_FILE))
DISTCLEANFILES += $(APPDATA_FILE)
%.desktop: %.desktop.template $(DESKTOP_FILE_PO)
intltool-merge --quiet --desktop-style $(DESKTOP_FILE_PO) $< $@
%.appdata.xml: %.appdata.xml.template $(APPDATA_FILE_PO)
intltool-merge --quiet --xml-style $(APPDATA_FILE_PO) $< $@
$(ICONS_INSTALLED)png: $(d)%.png ; $(MKDIR_INSTALL)
$(ICONS_INSTALLED)svg: $(d)%.svg ; $(MKDIR_INSTALL)
$(DESKTOP_FILE_INSTALLED): $(DESKTOP_FILE) ; $(MKDIR_INSTALL)
$(APPDATA_FILE_INSTALLED): $(APPDATA_FILE) ; $(MKDIR_INSTALL)
ifneq (yes, $(BUILD_DARWIN))
install: \
$(APPDATA_FILE_INSTALLED) \
$(DESKTOP_FILE_INSTALLED) \
$(patsubst %.png, $(ICONS_INSTALLED)png, $(patsubst %.svg, $(ICONS_INSTALLED)svg, $(notdir $(ICONS))))
endif

View file

@ -46,6 +46,10 @@ do
| maybe_append
done
for i in 'name' 'summary' 'p' 'li' 'caption'; do
xmlstarlet sel -t -v "//_$i" ../packages/desktop/aegisub.appdata.xml.template.in | jq -R .
done | nl -v0 -w1 -s'|' | sed -re 's/^/aegisub.appdata.xml|/' | maybe_append
grep '^_[A-Za-z0-9]*=.*' ../packages/win_installer/fragment_strings.iss.in | while read line
do
echo "$line" \