From 63528416e7b74b231f1e5b001eecfae6da30573c Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Mon, 22 Apr 2019 01:40:42 -0400 Subject: [PATCH] build: use add_dist_script for vendoring Our workaround for getting meson and cargo working together included a separate 'release' target that replaced 'ninja dist' so that we could vendor dependencies. Now we use meson's add_dist_script to vendor the dependencies as part of 'ninja dist', so we no longer need the 'release' target. --- meson.build | 9 +++++---- scripts/release.sh | 30 ------------------------------ scripts/vendor.sh | 9 +++++++++ 3 files changed, 14 insertions(+), 34 deletions(-) delete mode 100755 scripts/release.sh create mode 100644 scripts/vendor.sh diff --git a/meson.build b/meson.build index ebd27089..27c21231 100644 --- a/meson.build +++ b/meson.build @@ -72,13 +72,14 @@ gresource = find_program('glib-compile-resources', required: false) cargo_vendor = find_program('cargo-vendor', required: false) cargo_script = find_program('scripts/cargo.sh') grabber = find_program('scripts/grabber.sh') -cargo_release = find_program('scripts/release.sh') subdir('fractal-gtk/src') -run_target('release', command: ['scripts/release.sh', - meson.project_name() + '-' + fractal_version - ]) +meson.add_dist_script( + 'scripts/vendor.sh', + meson.source_root(), + join_paths(meson.build_root(), 'meson-dist', meson.project_name() + '-' + fractal_version) +) if get_option('profile') == 'development' # Setup pre-commit hook for ensuring coding style is always consistent diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index 07eb4997..00000000 --- a/scripts/release.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -VERSION=$1 -DEST=${MESON_BUILD_ROOT} -DIST=$DEST/dist/$VERSION - - -cd "${MESON_SOURCE_ROOT}" -mkdir -p $DIST - -# copying files -cp -rf fractal-gtk $DIST -cp -rf fractal-matrix-api $DIST -cp Cargo.toml $DIST -cp Cargo.lock $DIST -cp meson.build $DIST -cp meson_options.txt $DIST -cp fractal.doap $DIST -cp LICENSE.txt $DIST -cp README.md $DIST -cp -rf scripts $DIST - -# cargo vendor -mkdir $DIST/.cargo -cargo vendor | sed 's/^directory = ".*"/directory = "vendor"/g' > $DIST/.cargo/config -cp -rf vendor $DIST/ - -# packaging -cd $DEST/dist -tar -cJvf $VERSION.tar.xz $VERSION diff --git a/scripts/vendor.sh b/scripts/vendor.sh new file mode 100644 index 00000000..e28f21db --- /dev/null +++ b/scripts/vendor.sh @@ -0,0 +1,9 @@ +#!/bin/sh +export SOURCE_ROOT="$1" +export DIST="$2" + +cd "$SOURCE_ROOT" +mkdir "$DIST"/.cargo +cargo vendor | sed 's/^directory = ".*"/directory = "vendor"/g' > $DIST/.cargo/config +# Move vendor into dist tarball directory +mv vendor "$DIST"