From 78f29e726e4004bec81301db9108ac841e0f188e Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Mon, 4 Mar 2019 02:32:40 -0500 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 | 8 +++++--- scripts/cargo.sh | 3 ++- scripts/dist-vendor.sh | 9 +++++++++ scripts/release.sh | 32 -------------------------------- 4 files changed, 16 insertions(+), 36 deletions(-) create mode 100755 scripts/dist-vendor.sh delete mode 100755 scripts/release.sh diff --git a/meson.build b/meson.build index 945c895..46fb73e 100644 --- a/meson.build +++ b/meson.build @@ -69,9 +69,11 @@ test_script = find_program('scripts/test.sh') subdir('podcasts-gtk/src') -run_target('release', command: ['scripts/release.sh', - meson.project_name() + '-' + podcasts_version - ]) +meson.add_dist_script( + 'scripts/dist-vendor.sh', + meson.source_root(), + join_paths(meson.build_root(), 'meson-dist', meson.project_name() + '-' + podcasts_version) +) test( 'cargo-test', diff --git a/scripts/cargo.sh b/scripts/cargo.sh index bbe335a..38f4a09 100755 --- a/scripts/cargo.sh +++ b/scripts/cargo.sh @@ -22,4 +22,5 @@ if test -d vendor; then ARGS+=('--frozen') fi -cargo build ${ARGS[@]} -p podcasts-gtk && cp $1/target/${TARGET}/podcasts-gtk $2 +cargo build ${ARGS[@]} --manifest-path="$1"/Cargo.toml -p podcasts-gtk && +cp $1/target/${TARGET}/podcasts-gtk $2 diff --git a/scripts/dist-vendor.sh b/scripts/dist-vendor.sh new file mode 100755 index 0000000..e28f21d --- /dev/null +++ b/scripts/dist-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" diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index c1a7d69..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,32 +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 podcasts-data $DIST -cp -rf podcasts-gtk $DIST -cp -rf podcasts-downloader $DIST -cp Cargo.toml $DIST -cp Cargo.lock $DIST -cp meson.build $DIST -cp meson_options.txt $DIST -cp podcasts.doap $DIST -cp LICENSE $DIST -cp README.md $DIST -cp -rf screenshots $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