From: Eli Schwartz Date: Thu, 20 Oct 2022 20:21:13 +0000 (-0400) Subject: meson: distribute changelog when running `meson dist`, and install it X-Git-Tag: v2.1~128 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=4ae356736ef7e676c40bad14163e5de3e688a899 meson: distribute changelog when running `meson dist`, and install it Installing without a changelog is still supported, if building without git *and* without an official dist tarball. Fixes #1044 --- diff --git a/gen_changelog.sh b/gen_changelog.sh index 23d064c3..3b8bb372 100755 --- a/gen_changelog.sh +++ b/gen_changelog.sh @@ -38,4 +38,14 @@ echo "" >> "$builddir/ChangeLog.$$.new.html" rm "$builddir/ChangeLog.$$.old.html" mv -f "$builddir/ChangeLog.$$.new.html" "$builddir/ChangeLog.html" +# Meson: distribute in tarballs. The first variable is more reliable, but requires Meson 0.58. +# Fallback to the older one if necessary +for distdir in "$MESON_PROJECT_DIST_ROOT" "$MESON_DIST_ROOT"; do + if [ -n "$distdir" ]; then + cp -f "$builddir/ChangeLog.html" "$distdir/ChangeLog.html" + cp -f "$builddir/ChangeLog" "$distdir/ChangeLog" + break + fi +done + exit 0 diff --git a/meson.build b/meson.build index b45eb2f2..fb81d0b3 100644 --- a/meson.build +++ b/meson.build @@ -493,14 +493,19 @@ subdir('doc') # Install other project files if running_from_git + cmd = [find_program('gen_changelog.sh'), meson.current_source_dir(), meson.current_build_dir()] custom_target( 'ChangeLog', input: 'ChangeLog.gqview', output: ['ChangeLog', 'ChangeLog.html'], - command: [find_program('gen_changelog.sh'), meson.current_source_dir(), meson.current_build_dir()], + command: cmd, install: true, install_dir: helpdir) + meson.add_dist_script(cmd) summary({'ChangeLog' : ['ChangeLog, ChangeLog.html created:', true]}, section : 'Documentation', bool_yn : true) +elif fs.exists('ChangeLog.html') + install_data('ChangeLog', 'ChangeLog.html', install_dir: helpdir) + summary({'ChangeLog' : ['ChangeLog, ChangeLog.html installed from dist:', true]}, section : 'Documentation', bool_yn : true) else summary({'ChangeLog' : ['ChangeLog, ChangeLog.html created:', false]}, section : 'Documentation', bool_yn : true) endif