This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
536cec7ad58596e1867bc8d708f7aef0f9b8719b
[metaconfig.git] / U / perl / Mksymlinks.U
1 ?RCS:
2 ?RCS: $Id$
3 ?RCS:
4 ?RCS: Copyright (c) 2000, Jarkko Hietaniemi
5 ?RCS:
6 ?X:
7 ?X: This unit produces a bit of shell code that must be dotted in order
8 ?X: to make quick check on whether the current C compiler is working.
9 ?X:
10 ?MAKE:Mksymlinks: lns issymlink src
11 ?MAKE:  -pick add $@ %<
12 ?T: directory filename
13 ?LINT:extern mksymlinks
14 : Make symlinks util
15 case "$mksymlinks" in
16 $define|true|[yY]*)
17         case "$src" in
18         ''|'.') echo "Cannot create symlinks in the original directory." >&4
19                 exit 1
20                 ;;
21         *)      case "$lns:$issymlink" in
22                 *"ln"*" -s:"*"test -"?)
23                         echo "Creating the symbolic links..." >&4
24                         echo "(First creating the subdirectories...)" >&4
25                         cd ..
26                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
27                                 read directory
28                                 test -z "$directory" && break
29                                 mkdir -p $directory
30                         done
31                         # Sanity check 1.
32                         if test ! -d t/base; then
33                                 echo "Failed to create the subdirectories.  Aborting." >&4
34                                 exit 1
35                         fi
36                         echo "(Then creating the symlinks...)" >&4
37                         awk '{print $1}' $src/MANIFEST | while true; do
38                                 read filename
39                                 test -z "$filename" && break
40                                 if test -f $filename; then
41                                         if $issymlink $filename; then
42                                                 rm -f $filename
43                                         fi
44                                 fi
45                                 if test -f $filename; then
46                                         echo "$filename already exists, not symlinking."
47                                 else
48                                         ln -s $src/$filename $filename
49                                 fi
50                         done
51                         # Sanity check 2.
52                         if test ! -f t/base/lex.t; then
53                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
54                                 exit 1
55                         fi
56                         cd UU
57                         ;;
58                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
59                         ;;
60                 esac
61                 ;;
62         esac
63         ;;
64 esac
65