forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_prefix.sh
executable file
·62 lines (55 loc) · 1.84 KB
/
change_prefix.sh
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
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
# ***************************************************************************
# change_prefix.sh : allow to transfer a contrib dir
# ***************************************************************************
# Copyright © 2012 VideoLAN and its authors
#
# Authors: Rafaël Carré
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
# ***************************************************************************
set -e
LANG=C
export LANG
if test "$1" = "-h" -o "$1" = "--help" -o $# -gt 2; then
echo "Usage: $0 [old prefix] [new prefix]
Without arguments, this script assumes old prefix = @@CONTRIB_PREFIX@@,
and new prefix = current directory.
"
fi
if [ $# != 2 ]
then
old_prefix=@@CONTRIB_PREFIX@@
new_prefix=`pwd`
else
old_prefix=$1
new_prefix=$2
fi
# process [dir] [filemask] [text only]
process() {
for file in `find $1 -maxdepth 1 -type f -name "$2"`
do
if [ -n "$3" ]
then
file $file | sed "s/^.*: //" | grep -q 'text\|shell' || continue
fi
echo "Fixing up $file"
sed -i.orig -e "s,$old_prefix,$new_prefix,g" $file
rm -f $file.orig
done
}
process bin/ "*" check
process lib/ "*.la"
process lib/pkgconfig/ "*.pc"