summaryrefslogtreecommitdiff
path: root/libffi/merge.sh
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-08-30 14:36:52 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-10-20 05:35:52 -0700
commitd738405e7fe62cc8eb9580948a6ea39005cd7170 (patch)
treece5e9cb12024b7472027a7a77cce2d3bb101ddac /libffi/merge.sh
parent7113f1b54d533526c81459324faea4c100c50497 (diff)
libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
Add scripts for syncing with libffi upstream: 1. Clone libffi repo. 2. Checkout the specific commit. 3. Remove the unused files. 4. Add new files and remove old files if needed. * HOWTO_MERGE: New file. * autogen.sh: Likewise. * merge.sh: Likewise.
Diffstat (limited to 'libffi/merge.sh')
-rwxr-xr-xlibffi/merge.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/libffi/merge.sh b/libffi/merge.sh
new file mode 100755
index 00000000000..b36fbb92185
--- /dev/null
+++ b/libffi/merge.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# FIXME: do we need a license (or whatever else) header here?
+
+# This script merges libffi sources from upstream.
+
+# Default to the tip of master branch.
+commit=${1-master}
+
+fatal() {
+ echo "$1"
+ exit 1;
+}
+
+get_upstream() {
+ rm -rf upstream
+ git clone https://github.com/libffi/libffi.git upstream
+ pushd upstream
+ git checkout $commit || fatal "Failed to checkout $commit"
+ popd
+}
+
+get_current_rev() {
+ cd upstream
+ git rev-parse HEAD
+}
+
+pwd | grep 'libffi$' || \
+ fatal "Run this script from the libffi directory"
+get_upstream
+CUR_REV=$(get_current_rev)
+echo Current upstream revision: $CUR_REV
+
+# Remove the unused files.
+pushd upstream
+rm -rf ChangeLog.old .appveyor* .ci .github .gitignore .travis* \
+ config.guess config.sub libtool-ldflags m4 make_sunver.pl \
+ msvc_build
+rm -rf .git autogen.sh
+cp -a . ..
+popd
+
+rm -rf upstream
+
+# Update the MERGE file.
+cat << EOF > MERGE
+$CUR_REV
+
+The first line of this file holds the git revision number of the
+last merge done from the master library sources.
+EOF