[gnome-builder] meson-build: Add builder-dist target



commit 297054a5113e09141396cb5030a00710224baec5
Author: Patrick Griffis <tingping tingping se>
Date:   Tue Apr 25 04:08:25 2017 -0400

    meson-build: Add builder-dist target
    
    Meson will have a built-in dist in the near future but this should
    be usable now and can be expanded for our needs (eventually improved
    upstream of course)

 build/meson/meson_dist.sh |   46 +++++++++++++++++++++++++++++++++++++++++++++
 meson.build               |    9 ++++++++
 2 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/build/meson/meson_dist.sh b/build/meson/meson_dist.sh
new file mode 100755
index 0000000..d0c2a4e
--- /dev/null
+++ b/build/meson/meson_dist.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+set -euf -o pipefail
+
+version=$1
+name=$2
+archive_file=$name-$version.tar.xz
+prefix=$name-$version/
+
+pushd $MESON_SOURCE_ROOT
+
+if ! git config tar.tar.xz.command > /dev/null; then
+  echo "Setting git archive format for tar.xz"
+  git config tar.tar.xz.command "xz -c"
+fi
+
+# TODO: Rely on tag existing?
+echo "Creating tarball $archive_file of HEAD" 
+git archive --format=tar.xz --output=$archive_file --prefix=$prefix HEAD
+
+temp=$(mktemp -d)
+srcdir=$temp/source
+blddir=$temp/build
+instdir=$temp/install
+
+mkdir $srcdir
+tar -xf $archive_file -C $srcdir
+
+# Test read-only source dir
+chmod 500 $srcdir
+
+pushd $srcdir/$prefix
+meson $blddir
+pushd $blddir
+
+# FIXME: Tests currently fail on both autotools and meson
+#ninja test
+env DESTDIR=$instdir ninja install
+
+popd
+popd
+popd
+
+chmod 700 $srcdir
+rm -rf $temp
+echo "Everything succeeded!"
\ No newline at end of file
diff --git a/meson.build b/meson.build
index 511da29..2a7efc5 100644
--- a/meson.build
+++ b/meson.build
@@ -226,3 +226,12 @@ executable('gnome-builder-worker', 'src/main.c',
 )
 
 meson.add_install_script('build/meson/meson_post_install.py')
+
+# 'dist' will be used by meson, avoid conflicting
+run_target('builder-dist',
+  command: [
+    find_program('build/meson/meson_dist.sh'),
+    meson.project_version(),
+    meson.project_name(),
+  ]
+)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]