| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# FIXME: do we need a license (or whatever else) header here? |
| 4 |
|
| 5 |
# This script merges libffi sources from upstream. |
| 6 |
|
| 7 |
# Default to the tip of master branch. |
| 8 |
commit=${1-master} |
| 9 |
|
| 10 |
fatal() { |
| 11 |
echo "$1" |
| 12 |
exit 1; |
| 13 |
} |
| 14 |
|
| 15 |
get_upstream() { |
| 16 |
rm -rf upstream |
| 17 |
git clone https://github.com/libffi/libffi.git upstream |
| 18 |
pushd upstream |
| 19 |
git checkout $commit || fatal "Failed to checkout $commit" |
| 20 |
popd |
| 21 |
} |
| 22 |
|
| 23 |
get_current_rev() { |
| 24 |
cd upstream |
| 25 |
git rev-parse HEAD |
| 26 |
} |
| 27 |
|
| 28 |
pwd | grep 'libffi$' || \ |
| 29 |
fatal "Run this script from the libffi directory" |
| 30 |
get_upstream |
| 31 |
CUR_REV=$(get_current_rev) |
| 32 |
echo Current upstream revision: $CUR_REV |
| 33 |
|
| 34 |
# Remove the unused files. |
| 35 |
pushd upstream |
| 36 |
rm -rf ChangeLog.old .appveyor* .ci .github .gitignore .travis* \ |
| 37 |
config.guess config.sub libtool-ldflags m4 make_sunver.pl \ |
| 38 |
msvc_build |
| 39 |
rm -rf .git autogen.sh |
| 40 |
cp -a . .. |
| 41 |
popd |
| 42 |
|
| 43 |
rm -rf upstream |
| 44 |
|
| 45 |
# Update the MERGE file. |
| 46 |
cat << EOF > MERGE |
| 47 |
$CUR_REV |
| 48 |
|
| 49 |
The first line of this file holds the git revision number of the |
| 50 |
last merge done from the master library sources. |
| 51 |
EOF |