Debian Codegraph @

regen-configure/U/installdirs/inc_version_list.U

raw
1 ?RCS: $Id: inc_version_list.U,v $
2 ?RCS:
3 ?RCS: Copyright (c) 2000 Andy Dougherty
4 ?RCS:
5 ?RCS: You may redistribute only under the terms of the Artistic License,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic License; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
10 ?RCS:
11 ?RCS: $Log: inc_version_list.U,v $
12 ?RCS:
13 ?MAKE:inc_version_list inc_version_list_init d_inc_version_list: cat sed \
14 Getfile perl5 version api_versionstring rm Myread archname \
15 prefix sitelib_stem exe_ext
16 ?MAKE: -pick add $@ %<
17 ?Y:TOP
18 ?S:inc_version_list:
19 ?S: This variable specifies the list of subdirectories in over
20 ?S: which perl.c:incpush() and lib/lib.pm will automatically
21 ?S: search when adding directories to @INC. The elements in
22 ?S: the list are separated by spaces. This is only useful
23 ?S: if you have a perl library directory tree structured like the
24 ?S: default one. See INSTALL for how this works. The versioned
25 ?S: site_perl directory was introduced in 5.005, so that is the
26 ?S: lowest possible value.
27 ?S:
28 ?S: This list includes architecture-dependent directories back to
29 ?S: version $api_versionstring (e.g. 5.5.640) and
30 ?S: architecture-independent directories all the way back to
31 ?S: 5.005.
32 ?S:.
33 ?S:inc_version_list_init:
34 ?S: This variable holds the same list as inc_version_list, but
35 ?S: each item is enclosed in double quotes and separated by commas,
36 ?S: suitable for use in the PERL_INC_VERSION_LIST initialization.
37 ?S:.
38 ?S:d_inc_version_list:
39 ?S: This variable conditionally defines PERL_INC_VERSION_LIST.
40 ?S: It is set to undef when PERL_INC_VERSION_LIST is empty.
41 ?S:.
42 ?C:PERL_INC_VERSION_LIST:
43 ?C: This variable specifies the list of subdirectories in over
44 ?C: which perl.c:incpush() and lib/lib.pm will automatically
45 ?C: search when adding directories to @INC, in a format suitable
46 ?C: for a C initialization string. See the inc_version_list entry
47 ?C: in Porting/Glossary for more details.
48 ?C:.
49 ?H:#$d_inc_version_list PERL_INC_VERSION_LIST $inc_version_list_init /**/
50 ?H:.
51 ?T:stem
52 : Determine list of previous versions to include in @INC
53 $cat > getverlist <<EOPL
54 #!$perl5
55 use strict;
56 use warnings;
57 use File::Basename;
58 my \$api_versionstring = "$api_versionstring";
59 my \$version = "$version";
60 my \$stem = "$sitelib_stem";
61 my \$archname = "$archname";
62 EOPL
63 $cat >> getverlist <<'EOPL'
64 # The list found is stored twice for each entry: the original name, and
65 # the binary broken down version into pack "s>s>s>", so sorting is easy
66 # and unambiguous. This will work for all versions that have a maximum
67 # of three digit per group separate by '.'s or '_'s. Names are extended
68 # with ".0.0" to ensure at least three elements for the pack.
69 # -- H.Merijn Brand (m)'06 23-10-2006
70
71 my @inc_version_list;
72 my @candidates;
73 # XXX Redo to do opendir/readdir?
74 if (-d $stem) {
75 chdir($stem);
76 ;@candidates = map {
77 [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
78 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
79 }
80 else {
81 ;@candidates = ();
82 }
83
84 my ($pversion, $aversion, $vsn5005) = map {
85 pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
86 foreach my $d (@candidates) {
87 if ($d->[1] lt $pversion) {
88 if ($d->[1] ge $aversion) {
89 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
90 }
91 elsif ($d->[1] ge $vsn5005) {
92 unshift(@inc_version_list, grep { -d } $d->[0]);
93 }
94 }
95 else {
96 # Skip newer version. I.e. don't look in
97 # 5.7.0 if we're installing 5.6.1.
98 }
99 }
100
101 if (@inc_version_list) {
102 print join(' ', @inc_version_list);
103 }
104 else {
105 # Blank space to preserve value for next Configure run.
106 print " ";
107 }
108 EOPL
109 chmod +x getverlist
110 case "$inc_version_list" in
111 '') if test -x "$perl5$exe_ext"; then
112 dflt=`$perl5 getverlist`
113 else
114 dflt='none'
115 fi
116 ;;
117 $undef) dflt='none' ;;
118 ?X: Configure -Dinc_version_list='5.6.0/$archname 5.6.0' ...
119 *) eval dflt=\"$inc_version_list\" ;;
120 esac
121 case "$dflt" in
122 ''|' ') dflt=none ;;
123 esac
124 case "$dflt" in
125 5.005) dflt=none ;;
126 esac
127 $cat <<EOM
128
129 In order to ease the process of upgrading, this version of perl
130 can be configured to use modules built and installed with earlier
131 versions of perl that were installed under $prefix. Specify here
132 the list of earlier versions that this version of perl should check.
133 If Configure detected no earlier versions of perl installed under
134 $prefix, then the list will be empty. Answer 'none' to tell perl
135 to not search earlier versions.
136
137 The default should almost always be sensible, so if you're not sure,
138 just accept the default.
139 EOM
140
141 rp='List of earlier versions to include in @INC?'
142 . ./myread
143 case "$ans" in
144 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
145 *) inc_version_list="$ans" ;;
146 esac
147 case "$inc_version_list" in
148 ''|' ')
149 inc_version_list_init='0'
150 d_inc_version_list="$undef"
151 ;;
152 *) inc_version_list_init=`echo $inc_version_list |
153 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
154 d_inc_version_list="$define"
155 ;;
156 esac
157 $rm -f getverlist
158