File create-tarball.sh of Package nodejs-vscode-oniguruma
#!/bin/bash
# dnf install curl fdupes gzip moreutils tar
PKGDIR="$(pwd)"
TMPDIR="$(mktemp --tmpdir -d onig-XXXXXXXX)"
version=1.7.0
oniguruma_commit=08d36110c5670c815ad6d6f969e578049d209080
cd $TMPDIR
curl -L https://github.com/microsoft/vscode-oniguruma/archive/refs/tags/v${version}.tar.gz | tar --gzip -xvvf -
cd vscode-oniguruma-${version}
pushd deps
curl -L https://github.com/kkos/oniguruma/archive/${oniguruma_commit}.tar.gz | tar --gzip -xvvf -
rmdir -v oniguruma
mv -v * oniguruma
popd
npm install --ignore-scripts --verbose
echo ">>>>>> Remove compiled code"
rm -rvf out
echo ">>>>>> Remove non-free binaries"
find . -type f -name "*.jar" -print -delete
find . -type f -name "*.wasm" -print -delete
find . -type f -name "*.pyc" -print -delete
find . -type f -name "*.pyd" -print -delete
find . -type f -name "*.exe" -print -delete
find . -type f -name "*.node" -print -delete
find . -type f -name "*.dll" -print -delete
find . -type f -name "*.dylib" -print -delete
find . -type f -name "*.so" -print -delete
find . -type f -name "*.o" -print -delete
find . -type f -name "*.a" -print -delete
#We use sponge to avoid a race condition between find and rm
find -type f | sponge | xargs -P$(nproc) -- sh -c 'file "$@" | grep -v '\'' .*script'\'' | grep '\'' .*executable'\'' | tee /dev/stderr | sed '\''s/: .*//'\'' | xargs rm -fv'
fdupes -Sr .
export XZ_OPT="-T$(nproc) -e9 -vv"
cd ..
tar -vvcJf ${PKGDIR}/vscode-oniguruma-${version}.tar.xz vscode-oniguruma-${version}
cd /tmp
rm -rf "${TMPDIR}"