#!/bin/sh ## prepare-release.sh ## Prepares a release tarball with crates vendored into subprojects/ for meson. set -e ver="${1}" if [ -z "${ver}" ]; then echo "USAGE: ${0} " exit 1 fi if [ ! -d .git ]; then echo "${0} must be run from the root of the repository." exit 1 fi [ -d "${HOME}/.cache/blahajdots-${ver}" ] && rm -r "${HOME}/.cache/blahajdots-${ver}" mkdir -p "${HOME}/.cache/blahajdots-${ver}" rsync -r --exclude .git . "${HOME}/.cache/blahajdots-${ver}" mkdir "${HOME}/.cache/blahajdots-${ver}/.cargo" cat > "${HOME}/.cache/blahajdots-${ver}/.cargo/config.toml" << EOF [source.crates-io] replace-with = "vendored-sources" [sources.vendored-sources] directory = "subprojects" EOF oldpwd="${PWD}" cd "${HOME}/.cache/blahajdots-${ver}" cargo vendor --versioned-dirs subprojects cd ~/.cache/ tar -cf "blahajdots-${ver}.tar" \ --exclude=demo.gif \ --exclude=scripts \ --exclude=target \ --exclude-vcs \ "blahajdots-${ver}" xz -z -e -9 "blahajdots-${ver}.tar" rm -rf "blahajdots-${ver}" mv "blahajdots-${ver}.tar.xz" "${oldpwd}" echo "Release tarball blahajdots-${ver}.tar.xz successfully created."