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 # ***************************************************************************
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.
39 old_prefix
=@@CONTRIB_PREFIX@@
46 # process [dir] [filemask] [text only]
48 for file in `find $1 \( ! -name \`basename $1\
` -o -type f \) -prune -type f -name "$2"`
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
60 process bin
/ "*" check
62 process lib
/pkgconfig
/ "*.pc"