xref: /llvm-project/polly/lib/External/update-isl.sh (revision 658eb9e14264d48888ade0e3daf0b648f76c3f0e)
1#! /bin/sh
2set -e
3
4# Replace the content of the isl directory with a fresh clone from
5# http://repo.or.cz/isl.git
6
7SCRIPTPATH=`realpath --no-symlinks $(dirname $0)`
8ISL_SOURCE_DIR="${SCRIPTPATH}/isl"
9GITDIR=`mktemp -d --tmpdir isl-XXX`
10
11# Checkout isl source code
12git clone --recursive http://repo.or.cz/isl.git $GITDIR
13if [ -n "$1" ]; then
14  (cd $GITDIR && git checkout --detach $1)
15  (cd $GITDIR && git submodule update --recursive)
16fi
17
18# Customize the source directory for Polly:
19# - Remove the autotools build system to avoid including GPL source into
20#   the LLVM repository, even if covered by the autotools exception
21# - Create files that the autotools would have created
22# - Save the custom isl C++ binding
23# - Strip git source versioning
24(cd $GITDIR && rm -rf m4 autogen.sh configure.ac)
25(cd $GITDIR && find -name "Makefile.am" -execdir rm -f '{}' \;)
26(cd $GITDIR && git describe > $GITDIR/GIT_HEAD_ID)
27cp $ISL_SOURCE_DIR/include/isl/isl-noexceptions.h $GITDIR/include/isl/isl-noexceptions.h
28rm -rf $GITDIR/.git
29rm -rf $GITDIR/imath/.git
30
31# Replace the current isl source
32# IMPORTANT: Remember to `git add` any new files in LLVM's versioning
33#            and add them to its CMakeLists.txt if necessary.
34rm -rf $ISL_SOURCE_DIR
35mv -T $GITDIR $ISL_SOURCE_DIR
36
37# Cleanup script temporaries
38rm -rf $TMPDIR
39