For cross-compatibility with autotools, a dist tarball created from
either meson or autotools should have everything needed to build with
either build system. This ensures that all the files which "make dist"
would make available, are available.

In order for this to work, autogen.sh needs to know how to enter the
dist working directory, and fail if it cannot successfully cd or run
autoreconf. (It's fine if patch fails because the patch was already
applied.)

Signed-off-by: Eli Schwartz <eschwa...@archlinux.org>
---
 autogen.sh  | 6 +++++-
 meson.build | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/autogen.sh b/autogen.sh
index 18fa641d..3b0acec6 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,6 +1,10 @@
 #!/bin/sh -x
 
-autoreconf -i
+if [ -n "$MESON_DIST_ROOT" ]; then
+       cd "$MESON_DIST_ROOT" || exit 1
+fi
+
+autoreconf -i || exit 1
 patch -d build-aux -Np0 -i ltmain-asneeded.patch
 
 exit 0
diff --git a/meson.build b/meson.build
index 7be2425c..389a95b7 100644
--- a/meson.build
+++ b/meson.build
@@ -414,6 +414,8 @@ TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', 
join_paths(meson.build_root(), 'scripts/li
 TEST_ENV.set('PMTEST_UTIL_DIR', meson.build_root() + '/')
 TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.build_root(), 'scripts/'))
 
+meson.add_dist_script('./autogen.sh')
+
 subdir('test/pacman')
 subdir('test/scripts')
 subdir('test/util')
-- 
2.22.1

Reply via email to