[commit: libffi-tarballs] master: Add mk-snapshot script (eb32945)

git at git.haskell.org git at git.haskell.org
Sat Sep 30 14:22:00 UTC 2017


Repository : ssh://git@git.haskell.org/libffi-tarballs

On branch  : master
Link       : http://git.haskell.org/libffi-tarballs.git/commitdiff/eb32945377fd94f0d67eaceead07827766817b7c

>---------------------------------------------------------------

commit eb32945377fd94f0d67eaceead07827766817b7c
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sat Sep 30 10:07:01 2017 -0400

    Add mk-snapshot script


>---------------------------------------------------------------

eb32945377fd94f0d67eaceead07827766817b7c
 mk-snapshot.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/mk-snapshot.sh b/mk-snapshot.sh
new file mode 100755
index 0000000..52f33e4
--- /dev/null
+++ b/mk-snapshot.sh
@@ -0,0 +1,48 @@
+#!/bin/bash -e
+
+# Create a snapshot of the libffi repository from github, as a workaround for
+# the lack of recent releases of libffi (see https://github.com/libffi/libffi/issues/296)
+
+GVERS=3.99999 # see configure.ac / AC_INIT
+
+# make a temporary directory and perform operations in there.
+TMPD=$(mktemp -d)
+TDIR=$(pwd)
+
+# clone the repository (shallow is sufficient)
+git -C ${TMPD} clone --depth 1 https://github.com/libffi/libffi.git
+REPO="${TMPD}/libffi"
+
+# 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)
+SUFFIX="${GVERS}+git${GDATE}+${GHASH}"
+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}" && ./autogen.sh && rm autogen.sh)
+
+# package it up
+LIB="libffi-${SUFFIX}.tar.gz"
+(cd "${TMPD}" && tar -czf "${LIB}" "libffi-${SUFFIX}")
+mv "$TMPD/$LIB" ./$LIB
+
+# create orphan branch
+git checkout --orphan "libffi-${SUFFIX}"
+git add $LIB
+cat >README.md <<EOF
+# libffi snapshot tarball for GHC
+
+This source snapshot was produced from
+[libffi](https://github.com/libffi/libffi) commit
+[${GHASH}](https://github.com/libffi/libffi/commit/${GHASH}) for GHC. See the
+\`master\` branch of this repository for more information about the rationale
+and tools for producing these snapshots.
+EOF
+git add README.md
+git rm --cached mk-snapshot.sh
+git commit -m "Snapshot of libffi ${GHASH}"
+
+echo "Created branch libffi-${SUFFIX}"



More information about the ghc-commits mailing list