summaryrefslogtreecommitdiff
path: root/libffi/merge.sh
blob: b36fbb92185b48c069ce7becce025cc6298b965b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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