-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfix-configure.sh
executable file
·82 lines (71 loc) · 2.37 KB
/
fix-configure.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash
# This script fixes *.pc files. It removes extra fodder from Libs
# and Libs.private. It is needed because some configure scripts
# cannot handle the extra options in pkg config files. For example,
# Zile fails to find Ncurses because Ncurses uses the following in
# its *.pc file:
# Libs: -L<path> -Wl,-rpath,<path> -lncurses
# Zile can find the libraries when using:
# Libs: -L<path> -lncurses
echo ""
echo "************************"
echo "Fixing configure scripts"
echo "************************"
if [[ -n "$1" ]]; then
PROG_PATH="$1"
else
PROG_PATH="${INSTX_TOPDIR}/programs"
fi
CXX="${CXX:-CC}"
if ! "${CXX}" "$PROG_PATH/fix-configure.cpp" -o fix-configure.exe 2>/dev/null;
then
if ! g++ "$PROG_PATH/fix-configure.cpp" -o fix-configure.exe 2>/dev/null;
then
if ! clang++ "$PROG_PATH/fix-configure.cpp" -o fix-configure.exe 2>/dev/null;
then
echo "Failed to build fix-configure"
exit 1
fi
fi
fi
IFS= find "./" -name 'configure.ac' -print | while read -r file
do
# Display filename, strip leading "./"
this_file=$(echo "$file" | tr -s '/' | cut -c 3-)
echo "patching ${this_file}..."
touch -a -m -r "$file" "$file.timestamp"
chmod a+w "$file"; chmod a+x "$file"
./fix-configure.exe "$file" > "$file.fixed"
mv "$file.fixed" "$file";
chmod a+x "$file"; chmod go-w "$file"
touch -a -m -r "$file.timestamp" "$file"
rm "$file.timestamp"
done
IFS= find "./" -name 'configure' -print | while read -r file
do
# Display filename, strip leading "./"
this_file=$(echo "$file" | tr -s '/' | cut -c 3-)
echo "patching ${this_file}..."
touch -a -m -r "$file" "$file.timestamp"
chmod a+w "$file"; chmod a+x "$file"
./fix-configure.exe "$file" > "$file.fixed"
mv "$file.fixed" "$file";
chmod a+x "$file"; chmod go-w "$file"
touch -a -m -r "$file.timestamp" "$file"
rm "$file.timestamp"
done
echo "patching config.sub..."
IFS= find "./" -name 'config.sub' -print | while read -r file
do
chmod a+w "$file"; chmod a+x "$file"
cp -p "$PROG_PATH/config.sub" "$file"
chmod a+x "$file"; chmod go-w "$file"
done
echo "patching config.guess..."
IFS= find "./" -name 'config.guess' -print | while read -r file
do
chmod a+w "$file"; chmod a+x "$file"
cp -p "$PROG_PATH/config.guess" "$file"
chmod a+x "$file"; chmod go-w "$file"
done
exit 0