Modernize C builds with offline dependencies and portable runtime helpers

This commit is contained in:
Max Lv
2026-09-11 00:00:40 +08:00
parent 8fe386b5c2
commit 4455d7f8f3
110 changed files with 4295 additions and 1480 deletions
+11 -41
View File
@@ -1,44 +1,14 @@
#!/usr/bin/env bash
set -e
archive() {
export TARBALL_NAME=$1
export TARBALL_OUTDIR=$2
# archive this repo
cd "$(git rev-parse --show-toplevel)"
git archive HEAD --format=tar --prefix="${TARBALL_NAME}/" \
-o "${TARBALL_OUTDIR}/${TARBALL_NAME}.tar"
# archive submodules
git submodule update --init
git submodule foreach --quiet 'git archive HEAD --format=tar \
--prefix="${TARBALL_NAME}/${path}/" \
-o "${TARBALL_OUTDIR}/${TARBALL_NAME}-submodule-${path}-${sha1}.tar"
tar -n --concatenate --file="${TARBALL_OUTDIR}/${TARBALL_NAME}.tar" \
"${TARBALL_OUTDIR}/${TARBALL_NAME}-submodule-${path}-${sha1}.tar"'
gzip -c "${TARBALL_OUTDIR}/${TARBALL_NAME}.tar" > "${TARBALL_OUTDIR}/${TARBALL_NAME}.tar.gz"
# clean-up
git submodule foreach --quiet 'rm ${TARBALL_OUTDIR}/${TARBALL_NAME}-submodule-${path}-${sha1}.tar'
rm "${TARBALL_OUTDIR}/${TARBALL_NAME}.tar"
}
TARGET_TARBALL_NAME=shadowsocks-libev
TARGET_TARBALL_DIR=$(git rev-parse --show-toplevel)
while getopts "n:o:" opt
do
case ${opt} in
o)
TARGET_TARBALL_DIR=$(readlink -f -- $OPTARG)
;;
n)
TARGET_TARBALL_NAME=$OPTARG
;;
\?)
exit 1
;;
# Backward-compatible maintainer entrypoint for the offline release archive.
set -euo pipefail
root=$(git rev-parse --show-toplevel)
name=shadowsocks-libev
directory=$root
while getopts "n:o:" opt; do
case "$opt" in
n) name=$OPTARG ;;
o) directory=$OPTARG ;;
*) exit 1 ;;
esac
done
archive "${TARGET_TARBALL_NAME}" "${TARGET_TARBALL_DIR}"
exec python3 "$root/scripts/source_archive.py" "$directory/$name.tar.gz" --prefix "$name"