Browse Source

generate appdata.xml from guile script

audio_region_bpm_change_fix
parent
commit
634f6287a0
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 30
      data/meson.build
  2. 78
      data/org.zrythm.Zrythm.appdata.xml.in
  3. 5
      meson.build
  4. 170
      scripts/gen-appdata-xml.scm
  5. 29
      scripts/guile-utils.scm
  6. 17
      scripts/meson.build

30
data/meson.build

@ -107,20 +107,22 @@ if os_gnu or os_freebsd @@ -107,20 +107,22 @@ if os_gnu or os_freebsd
endif
# appdata
# TODO generate <releases/> based on CHANGELOG.md
appdata_config = configuration_data ({
'HOMEPAGE_URL': 'https://www.zrythm.org/en/index.html',
'DONATION_URL': 'https://www.zrythm.org/en/community.html',
'BUG_REPORT_URL': 'https://todo.sr.ht/~alextee/zrythm-bug',
'USER_MANUAL_URL': 'https://manual.zrythm.org/en/index.html',
'PIANO_ROLL_SCREENSHOT_URL': 'https://www.zrythm.org/static/images/screenshots/Screenshot_20220110_152402.png',
'MIXER_SCREENSHOT_URL': 'https://www.zrythm.org/static/images/screenshots/Screenshot_20220110_152001.png',
'APP_ID': app_id,
})
appdata_file_in = configure_file (
input: '@0@.appdata.xml.in'.format (app_id),
appdata_file_in_unformatted = custom_target (
'appdata-xml-in-tmp',
input: gen_appdata_xml_wrap,
output: '@0@.appdata.xml.in.in'.format (app_id),
command: [
gen_appdata_xml_wrap,
meson_build_root / '@OUTPUT@', app_id,
])
appdata_file_in = custom_target (
'appdata-xml-in',
input: appdata_file_in_unformatted,
output: '@0@.appdata.xml.in'.format (app_id),
configuration: appdata_config)
command: [
xmllint, '--format', '--output', '@OUTPUT@',
'@INPUT@',
])
appdata_file = i18n.merge_file (
input: appdata_file_in,
output: '@0@.appdata.xml'.format (app_id),
@ -129,7 +131,7 @@ if os_gnu or os_freebsd @@ -129,7 +131,7 @@ if os_gnu or os_freebsd
install: true,
install_dir: datadir / 'metainfo',
)
# Validate the appdata file
# Validate the appdata file
appstream_util = find_program (
'appstream-util', required: false)
if appstream_util.found ()

78
data/org.zrythm.Zrythm.appdata.xml.in

@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2022 Alexandros Theodotou -->
<component type="desktop">
<id>org.zrythm.Zrythm</id>
<!--
The tag 'metadata_license' means the licence of
this file, not the whole product
-->
<metadata_license>CC0-1.0</metadata_license>
<project_license>AGPL-3.0-or-later</project_license>
<developer_name>The Zrythm contributors</developer_name>
<name>Zrythm DAW</name>
<summary>A highly automated and intuitive digital audio workstation</summary>
<description>
<p>
Zrythm is a digital audio workstation designed to
be featureful and easy to use. It allows
limitless automation through curves, LFOs and
envelopes, supports multiple plugin formats
including LV2, VST2 and VST3, works with
multiple backends including JACK, RtAudio/RtMidi
and SDL2, assists with chord progressions via a
special Chord Track and chord pads, and can be
used in multiple languages including English,
French, Portuguese, Japanese and German.
</p>
<p>
Zrythm can be extended using GNU Guile.
</p>
</description>
<url type="bugtracker">@BUG_REPORT_URL@</url>
<url type="donation">@DONATION_URL@</url>
<url type="help">@USER_MANUAL_URL@</url>
<url type="homepage">@HOMEPAGE_URL@</url>
<screenshots>
<screenshot type="default">
<image>@PIANO_ROLL_SCREENSHOT_URL@</image>
<caption>Composing MIDI in Zrythm</caption>
</screenshot>
<screenshot type="default">
<image>@MIXER_SCREENSHOT_URL@</image>
<caption>Mixer view</caption>
</screenshot>
</screenshots>
<update_contact>alex_at_zrythm.org</update_contact>
<keywords>
<keyword>Zrythm</keyword>
<keyword>DAW</keyword>
</keywords>
<kudos>
<kudo>HiDpiIcon</kudo>
<kudo>ModernToolkit</kudo>
</kudos>
<project_group>Zrythm</project_group>
<translation type="gettext">zrythm</translation>
<launchable type="desktop-id">@APP_ID@.desktop</launchable>
<provides>
<binary>zrythm_launch</binary>
<id>@APP_ID@</id>
</provides>
<!--
TODO this should be auto-generated from
CHANGELOG.md
-->
<releases>
<release date="2022-01-10" version="1.0.0-alpha.27.0.3" type="development">
<description>
<p>
GTK3 -> GTK4 port.
</p>
</description>
</release>
</releases>
<content_rating type="oars-1.1" />
</component>

5
meson.build

@ -93,6 +93,7 @@ get_vst_path_bin = find_program ( @@ -93,6 +93,7 @@ get_vst_path_bin = find_program (
'tools/get_vst_path.sh')
manpage_completions_run_sh = find_program (
'ext/sh-manpage-completions/run.sh')
xmllint = find_program ('xmllint')
# --- Set common variables ---
@ -478,7 +479,9 @@ endif @@ -478,7 +479,9 @@ endif
# if latest version in changelog is the project's
# version, add the changelog to the config
chlog = fs.read ('CHANGELOG.md').split('\n## [')[1].strip ()
chlog_full = fs.read ('CHANGELOG.md')
chlog_list = chlog_full.split('\n## [')
chlog = chlog_list[1].strip ()
if chlog.contains (meson.project_version () + '] -')
chlog_date = chlog.split (' - ')[1].split ('\n')[0]
chlog = chlog.split (chlog_date + '\n')[1]

170
scripts/gen-appdata-xml.scm

@ -0,0 +1,170 @@ @@ -0,0 +1,170 @@
;;; Copyright (C) 2022 Alexandros Theodotou <alex at zrythm dot org>
;;;
;;; This file is part of Zrythm
;;;
;;; Zrythm is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Affero General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; Zrythm is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public License
;;; along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
;;;
;;; Generate appdata.xml
;;;
;;; Usage: gen-appdata-xml [OUTPUT-FILE]
(add-to-load-path "@SCRIPTS_DIR@")
(define-module (gen-gtk-resources-xml)
#:use-module (guile-utils)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
#:use-module (ice-9 ftw)
#:use-module (sxml simple))
;; Returns a list of the last 4 releases
(define (get-releases)
(let*
((changelog
(file-to-string
(join-path
'("@MESON_SOURCE_ROOT@"
"CHANGELOG.md"))))
(changelog-list
(cdr (string-split-substring changelog "## [")))
(releases-list `()))
(for-each
(lambda (x)
(let*
((ver (car (string-split-substring x "]")))
(str-from-date
(car
(cdr
(string-split-substring x " - "))))
(date (car (string-split-substring str-from-date "\n"))))
(set!
releases-list
(append
releases-list
`((release
(@ (date ,date)
(version ,ver)
(type "development"))
(url
,(string-append
"https://git.sr.ht/~alextee/zrythm/refs/v" ver))))))))
changelog-list)
(list-head releases-list 4)))
#!
Args:
1: output file
2: app ID
!#
(define (main . args)
;; verify number of args
(unless (eq? (length args) 3)
(display "Need 2 arguments")
(newline)
(exit -1))
;; get args
(match args
((this-program output-file app-id)
(with-output-to-file output-file
(lambda ()
;; write XML
(sxml->xml
`(*TOP*
(*PI*
xml
"version=\"1.0\" encoding=\"UTF-8\"")
;; TODO insert: Copyright 2022 Alexandros Theodotou
(component
(id "org.zrythm.Zrythm")
;; The tag 'metadata_license' means
;; the licence of this file, not the
;;whole product
(metadata_license "CC0-1.0")
(project_license "AGPL-3.0-or-later")
(name "Zrythm")
(summary "Digital audio workstation")
(description
(p "Zrythm is a digital audio
workstation designed to
be featureful and easy to use. It allows
limitless automation through curves, LFOs and
envelopes, supports multiple plugin formats
including LV2, VST2 and VST3, works with
multiple backends including JACK, RtAudio/RtMidi
and SDL2, assists with chord progressions via a
special Chord Track and chord pads, and can be
used in multiple languages including English,
French, Portuguese, Japanese and German.")
(p "Zrythm can be extended using GNU Guile."))
(url
(@ (type "homepage"))
"@HOMEPAGE_URL@")
(url
(@ (type "bugtracker"))
"@BUG_REPORT_URL@")
;; TODO faq
(url
(@ (type "help"))
"@USER_MANUAL_URL@")
(url
(@ (type "donation"))
"@DONATION_URL@")
(url
(@ (type "translate"))
"@TRANSLATE_URL@")
(url
(@ (type "contact"))
"@CONTACT_URL@")
(launchable
(@ (type "desktop-id"))
,(string-append app-id
".desktop"))
(screenshots
(screenshot
(@ (type "default"))
(image
"@PIANO_ROLL_SCREENSHOT_URL@")
(caption
"Composing MIDI in Zrythm"))
(screenshot
(@ (type "default"))
(image
"@MIXER_SCREENSHOT_URL@")
(caption "Mixer view")))
(update_contact "alex_at_zrythm.org")
(keywords
(keyword "Zrythm")
(keyword "DAW"))
(kudos
(kudo "HiDpiIcon")
(kudo "ModernToolkit"))
(project_group "Zrythm")
(translation
(@ (type "gettext"))
"zrythm")
(provides
(binary "zrythm_launch")
(id ,app-id))
(releases
,@(get-releases))
(content_rating
(@ (type "oars-1.1")))))))))))
(apply main (program-arguments))

29
scripts/guile-utils.scm

@ -29,7 +29,8 @@ @@ -29,7 +29,8 @@
getenv-or-default
get-cflags-from-pkgconf-name
program-found?
string-replace-substring))
string-replace-substring
string-split-substring))
;; returns if a is an element of list l
(define (elem? a l)
@ -124,3 +125,29 @@ @@ -124,3 +125,29 @@
pieces))
(string-concatenate-reverse (cons (substring s start)
pieces))))))))
;; by vijaymarupudi from #guile
(define (string-split-substring string substr)
(define len (string-length substr))
(define strlen (string-length string))
(let ((substr-indices (let loop ((start-index 0))
(if (>= start-index strlen)
'()
(let ((i (string-contains string substr start-index)))
(if (not i)
'()
(cons i (loop (+ i len)))))))))
(if (null? substr-indices)
(list string)
(let loop ((indices substr-indices)
(start 0))
(cond
((>= start strlen) '())
((null? indices) (list (substring string start)))
(else
(let ((idx (car indices)))
(cons (substring string start idx)
(loop (cdr indices)
(+ idx len))))))))))

17
scripts/meson.build

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
# Copyright (C) 2019-2022 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of Zrythm
#
@ -19,6 +19,14 @@ scripts_conf = { @@ -19,6 +19,14 @@ scripts_conf = {
'SCRIPTS_DIR': meson.current_build_dir (),
'MESON_BUILD_ROOT': meson_build_root,
'MESON_SOURCE_ROOT': meson_src_root,
'HOMEPAGE_URL': 'https://www.zrythm.org/en/index.html',
'DONATION_URL': 'https://www.zrythm.org/en/community.html#donate',
'BUG_REPORT_URL': 'https://todo.sr.ht/~alextee/zrythm-bug',
'USER_MANUAL_URL': 'https://manual.zrythm.org/en/index.html',
'TRANSLATE_URL': 'https://hosted.weblate.org/engage/zrythm/',
'CONTACT_URL': 'https://www.zrythm.org/en/community.html#contact',
'PIANO_ROLL_SCREENSHOT_URL': 'https://www.zrythm.org/static/images/screenshots/Screenshot_20220110_152402.png',
'MIXER_SCREENSHOT_URL': 'https://www.zrythm.org/static/images/screenshots/Screenshot_20220110_152001.png',
}
if os_windows
scripts_conf += { 'GUILE': 'guile' }
@ -96,6 +104,13 @@ gen_gtk_resources_xml_wrap = configure_file ( @@ -96,6 +104,13 @@ gen_gtk_resources_xml_wrap = configure_file (
'SCRIPT_NAME': 'gen-gtk-resources-xml.scm'},
)
gen_appdata_xml_wrap = configure_file (
output: 'gen-appdata-xml.sh',
input: generic_guile_wrap_name,
configuration: scripts_conf + {
'SCRIPT_NAME': 'gen-appdata-xml.scm'},
)
gen_completions_sh = configure_file (
output: 'gen_completions.sh',
input: 'gen_completions.sh',

Loading…
Cancel
Save