This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[metaconfig.git] / U / perl / Mksymlinks.U
CommitLineData
68f55076
JH
1?RCS:
2?RCS: $Id$
3?RCS:
4?RCS: Copyright (c) 2000, Jarkko Hietaniemi
2f125bce
MB
5?RCS:
6?X:
9d14e8db
MB
7?X: This unit tries to create a symlink tree on a -Dmksymlinks request
8?X: to Configure
2f125bce 9?X:
628b34e8 10?MAKE:Mksymlinks: lns issymlink src
68f55076 11?MAKE: -pick add $@ %<
0c7f0563 12?T:dir source file
68f55076 13?LINT:extern mksymlinks
2f125bce 14: Make symlinks util
68f55076
JH
15case "$mksymlinks" in
16$define|true|[yY]*)
17 case "$src" in
18 ''|'.') echo "Cannot create symlinks in the original directory." >&4
19 exit 1
20 ;;
628b34e8 21 *) case "$lns:$issymlink" in
44726213 22 *"ln"*" -s:"*"test -"?)
68f55076 23 echo "Creating the symbolic links..." >&4
68f55076 24 cd ..
0c7f0563
MBT
25 awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
26 awk 'NF == 1 {
27 dir=".";
28 file=$1 "";
29 }
30 NF == 2 {
31 dir=$1 "";
32 file=$2 "";
33 }
34 {
35 print "# dir = ", dir, "file = ", file
36 mf[dir] = mf[dir]" "source"/"dir"/"file;
37 } END {
38 for (d in mf) {
39 if (d != ".") { print("mkdir -p "d) }
40 print("ln -sf "mf[d]" "d);
41 }
42 }' source="$src" > UU/mksymlinks.$$
43 sh UU/mksymlinks.$$
44 rm UU/mksymlinks.$$
68f55076
JH
45 # Sanity check 1.
46 if test ! -d t/base; then
47 echo "Failed to create the subdirectories. Aborting." >&4
48 exit 1
49 fi
68f55076 50 # Sanity check 2.
0aac658d
JH
51 if test ! -f t/base/lex.t; then
52 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
68f55076
JH
53 exit 1
54 fi
0c7f0563
MBT
55 if test ! -f win32/win32.c; then
56 echo "Failed to create the symlinks (win32/win32.c missing). Aborting." >&4
57 exit 1
58 fi
68f55076
JH
59 cd UU
60 ;;
61 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
62 ;;
63 esac
64 ;;
65 esac
66 ;;
67esac
68