Avindra Goolcharan
e64bcce8d5
OBS-URL: https://build.opensuse.org/package/show/devel:languages:javascript/deno?expand=0&rev=13
68 lines
1.5 KiB
Bash
68 lines
1.5 KiB
Bash
#!/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
|
|
|
|
# disregard rusty_v8 checks as we inject it directly from source
|
|
echo '{"files":{},"package":""}' > vendor/rusty_v8/.cargo-checksum.json
|
|
|
|
# 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... "
|
|
tar -cf - vendor/ | xz -9 -c - > vendor-merged.tar.xz
|
|
echo "done"
|
|
|
|
ls -lh "$wd/vendor-merged.tar.xz"
|
|
|
|
cd -
|
|
cp "$wd/vendor-merged.tar.xz" ./vendor.tar.xz
|