Commit eb329453 authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

Add mk-snapshot script

parent 139e77eb
#!/bin/bash -e
# Create a snapshot of the libffi repository from github, as a workaround for
# the lack of recent releases of libffi (see
GVERS=3.99999 # see / AC_INIT
# make a temporary directory and perform operations in there.
TMPD=$(mktemp -d)
# clone the repository (shallow is sufficient)
git -C ${TMPD} clone --depth 1
# record the revision and create a copy of only the files
# contained in the repository at libffi-<revision>
GHASH=$(git -C ${REPO} rev-parse --short HEAD)
GDATE=$(git -C ${REPO} log -1 --pretty=format:%cd --date=format:%Y%m%d)
git -C ${REPO} archive --format=tar --prefix="libffi-${SUFFIX}/" HEAD | tar -C ${TMPD} -x
# run and remove autogen, so we don't have to run it on the CI or elsewhere
# and as such incure additional dependencies like libtool.
(cd "${TMPD}/libffi-${SUFFIX}" && ./ && rm
# package it up
(cd "${TMPD}" && tar -czf "${LIB}" "libffi-${SUFFIX}")
mv "$TMPD/$LIB" ./$LIB
# create orphan branch
git checkout --orphan "libffi-${SUFFIX}"
git add $LIB
cat > <<EOF
# libffi snapshot tarball for GHC
This source snapshot was produced from
[libffi]( commit
[${GHASH}](${GHASH}) for GHC. See the
\`master\` branch of this repository for more information about the rationale
and tools for producing these snapshots.
git add
git rm --cached
git commit -m "Snapshot of libffi ${GHASH}"
echo "Created branch libffi-${SUFFIX}"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment