forked from arsv/perl-cross
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·61 lines (48 loc) · 2.04 KB
/
configure
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
#!/bin/sh
earlydie() { echo "$@" >&2; exit 1; }
root=${0%/*}; test -z "$root" && root=. # dirname($0)
test -f "$root/MANIFEST" || earlydie "Can't find MANIFEST, perl-cross is not deployed properly."
abs=`echo "$root" | sed -e 's!^\(.\).*!\1!'`
test "$abs" != '/' && unset abs
if [ -n "$root" -a "$root" != "." -a ! -f "MANIFEST" ]; then
echo "No MANIFEST found. Assuming out-of-source build."
echo "Symlinking source files..."
# perl distribution files are all listed in MANIFEST
cat "$root/MANIFEST" | sed -e 's/\s.*//' | while read i; do
d=${i%/*}; test -z "$d" && d=. # dirname($i)
mkdir -p "$d"
test "$d" != "." && u=`echo "$d" | sed -e 's![^/]\+!..!g' -e 's!$!/!'` || u=''
test -n "$abs" && relroot="$root" || relroot="$u$root"
ln -sf "$relroot/$i" "$i" || earlydie "Symlinking failed."
done
# perl-cross files are not in MANIFEST
for i in TESTPACK.px extlibs statars TestInit.pm.testpack \
make_ext_Makefile.pl miniperl_top Makefile.config.SH \
Makefile configure; do
ln -sf "$root/$i" "./$i" || earlydie "Symlinking failed."
done
for i in x2p/Makefile utils/Makefile; do
test -n "$abs" && relroot="$root" || relroot="../$root"
ln -sf "$relroot/$i" "$i" || earlydie "Symlinking failed."
done
# cnf is a special case because we need cnf/diffs to be
# a proper directory to store locks there
mkdir cnf
for i in "$root/cnf/"*; do
bn=${i##*/}
test -n "$abs" && rel="" || rel="../"
test "$bn" != 'diffs' && ln -s "$rel$i" "cnf/$bn"
done
cp -a "$root/cnf/diffs" cnf/
# Make extra sure MANIFEST gets symlinked
test -f "MANIFEST" || ln -sf "$root/MANIFEST" "./MANIFEST"
# Dereference any files that will be patched with crosspatch.
# A better alternative is patch --follow-symlinks,
# but --follow-symlinks is not widely supported and even when it is,
# man page discourages its use.
sed -ne '/^+++ /{s/^+++ //;s/\s.*//;s@^[^/]\+/@@;p}' cnf/diffs/* | while read i; do
cp -a "$i" "$i.tmp" && rm -f "$i" && cp "$i.tmp" "$i" && rm -f "$i.tmp"
done
echo "Symlinking done, proceeding with configure."
fi
cnf/configure "$@"