summaryrefslogtreecommitdiff
path: root/testsuite/external/Patcher.sh
blob: 57597d08113ded01cd73b2e269699f709fcf6de1 (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
#!/bin/sh

#########################################################################
#                                                                       #
#                                 OCaml                                 #
#                                                                       #
#           Damien Doligez, projet Gallium, INRIA Rocquencourt          #
#                                                                       #
#   Copyright 2012 Institut National de Recherche en Informatique et    #
#   en Automatique.  All rights reserved.  This file is distributed     #
#   under the terms of the Q Public License version 1.0.                #
#                                                                       #
#########################################################################

# usage:
# Patcher.sh <directory> [<patchfile>]

if [ -f "$1.patch" ]; then
  echo "patch -d $1 -p1 < $1.patch"
  patch -d $1 -p1 < "$1.patch"
fi

if [ -f "$1-$VERSION.patch" ]; then
  echo "patch -d $1 -p1 < $1-$VERSION.patch"
  patch -d $1 -p1 < "$1-$VERSION.patch"
fi

if [ -f "$2" ]; then
  echo "patch -d $1 -l -p0 < $2"
  patch -d $1 -l -p0 < "$2" || exit 0
fi