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.
This commit is contained in:
Christopher Davis 2019-04-22 01:40:42 -04:00 committed by Daniel Garcia Moreno
parent 7b1734af95
commit 63528416e7
3 changed files with 14 additions and 34 deletions

View file

@ -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

View file

@ -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

9
scripts/vendor.sh Normal file
View file

@ -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"