libass: fix compilation with older versions of libass
[vlc.git] / contrib / src / change_prefix.sh
blobe3809bb19cb30c3039435e5fd67eae9ed318b00b
1 #!/bin/sh
2 # ***************************************************************************
3 # change_prefix.sh : allow to transfer a contrib dir
4 # ***************************************************************************
5 # Copyright © 2012 VideoLAN and its authors
7 # Authors: Rafaël Carré
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 # ***************************************************************************
24 set -e
26 LANG=C
27 export LANG
29 if test "$1" = "-h" -o "$1" = "--help" -o $# -gt 2; then
30 echo "Usage: $0 [old prefix] [new prefix]
32 Without arguments, this script assumes old prefix = @@CONTRIB_PREFIX@@,
33 and new prefix = current directory.
37 if [ $# != 2 ]
38 then
39 old_prefix=@@CONTRIB_PREFIX@@
40 new_prefix=`pwd`
41 else
42 old_prefix=$1
43 new_prefix=$2
46 # process [dir] [filemask] [text only]
47 process() {
48 for file in `find $1 \( ! -name \`basename $1\` -o -type f \) -prune -type f -name "$2"`
50 if [ -n "$3" ]
51 then
52 file $file | sed "s/^.*: //" | grep -q 'text\|shell' || continue
54 echo "Fixing up $file"
55 sed -i.orig -e "s,$old_prefix,$new_prefix,g" $file
56 rm -f $file.orig
57 done
60 process bin/ "*" check
61 process lib/ "*.la"
62 process lib/pkgconfig/ "*.pc"