2021-01-26 17:32:04 +01:00
|
|
|
#!/bin/sh
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# packaging helper to workaround:
|
|
|
|
# https://github.com/rust-lang/cargo/issues/9054
|
|
|
|
# https://github.com/rust-lang/cargo/issues/7058#issuecomment-751589229
|
|
|
|
|
|
|
|
# This script merges rusty_v8 into place from source,
|
|
|
|
# and nukes superfluous source objects.
|
|
|
|
#
|
|
|
|
# output is a single, merged vendor tarball
|
|
|
|
|
|
|
|
wd="$(mktemp -d /tmp/revendor.XXXXX)"
|
|
|
|
|
|
|
|
# take what we need into the build
|
|
|
|
cp rusty_v8*xz $wd
|
|
|
|
cp vendor*xz $wd
|
|
|
|
|
|
|
|
cd $wd
|
|
|
|
|
|
|
|
echo -n "Extracting vendor..."
|
|
|
|
tar xf vendor*xz
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
echo -n "Extracting rusty_v8..."
|
|
|
|
tar xf rusty*xz \
|
|
|
|
--exclude="Cargo.toml" \
|
|
|
|
--exclude="Cargo.lock"
|
|
|
|
echo " done"
|
|
|
|
|
|
|
|
# take vendored Cargo toml and lock which
|
|
|
|
# can still be used
|
|
|
|
cp vendor/rusty_v8/{Cargo.*,.cargo*} .
|
|
|
|
|
|
|
|
# get rid of everything else
|
|
|
|
rm -fr vendor/rusty_v8
|
|
|
|
|
|
|
|
# drop version prefix
|
|
|
|
target=$(find . -name "rusty_v8-*" -type d)
|
|
|
|
mv $target rusty_v8
|
|
|
|
|
|
|
|
# insert proper files
|
|
|
|
mv Cargo.* .cargo* rusty_v8
|
|
|
|
echo "Check final rusty_v8 root:"
|
|
|
|
ls -la rusty_v8
|
|
|
|
mv rusty_v8 vendor
|
|
|
|
|
2021-02-05 23:00:49 +01:00
|
|
|
# disregard rusty_v8 checks as we inject it directly from source
|
|
|
|
echo '{"files":{},"package":""}' > vendor/rusty_v8/.cargo-checksum.json
|
|
|
|
|
2021-01-26 17:32:04 +01:00
|
|
|
# extra: workaround winapi bloat
|
|
|
|
# by ejecting it from the build
|
|
|
|
#
|
|
|
|
# https://github.com/rust-lang/cargo/issues/7058
|
|
|
|
echo -n "Pruning winapi bloat... "
|
|
|
|
rm -fr vendor/winapi*gnu*/lib/*.a
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
# remake tarball
|
|
|
|
echo -n "Compressing archive... "
|
2021-01-29 22:33:30 +01:00
|
|
|
tar -cf - vendor/ | xz -9 -c - > vendor-merged.tar.xz
|
2021-01-26 17:32:04 +01:00
|
|
|
echo "done"
|
|
|
|
|
|
|
|
echo "Inspect the tarball and replace the"
|
2021-03-03 01:07:15 +01:00
|
|
|
echo "existing one if it's ok. Should be ~50MB."
|
2021-01-26 17:32:04 +01:00
|
|
|
ls -lh "$wd/vendor-merged.tar.xz"
|