This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Module-CoreList/Changes for 5.20170622
[perl5.git] / Policy_sh.SH
CommitLineData
1f00b0d6
S
1#!/bin/sh
2
a02608de 3case $PERL_CONFIG_SH in
85364e4e
MB
4'') . ./config.sh ;;
5esac
6echo "Extracting Policy.sh (with variable substitutions)"
7$spitshell <<!GROK!THIS! >Policy.sh
8$startsh
9#
10# This file was produced by running the Policy_sh.SH script, which
11# gets its values from config.sh, which is generally produced by
c9166e37 12# running Configure.
85364e4e
MB
13#
14# The idea here is to distill in one place the common site-wide
15# "policy" answers (such as installation directories) that are
dc45a647 16# to be "sticky". If you keep the file Policy.sh around in
85364e4e
MB
17# the same directory as you are building Perl, then Configure will
18# (by default) load up the Policy.sh file just before the
c9166e37
AD
19# platform-specific hints file and rewrite it at the end.
20#
21# The sequence of events is as follows:
22# A: If you are NOT re-using an old config.sh:
23# 1. At start-up, Configure loads up the defaults from the
24# os-specific hints/osname_osvers.sh file and any previous
25# Policy.sh file.
26# 2. At the end, Configure runs Policy_sh.SH, which creates
27# Policy.sh, overwriting a previous Policy.sh if necessary.
28#
29# B: If you are re-using an old config.sh:
30# 1. At start-up, Configure loads up the defaults from config.sh,
31# ignoring any previous Policy.sh file.
32# 2. At the end, Configure runs Policy_sh.SH, which creates
33# Policy.sh, overwriting a previous Policy.sh if necessary.
34#
35# Thus the Policy.sh file gets overwritten each time
36# Configure is run. Any variables you add to Policy.sh will be lost
37# unless you copy Policy.sh somewhere else before running Configure.
dc45a647 38#
dc45a647
MB
39# Allow Configure command-line overrides; usually these won't be
40# needed, but something like -Dprefix=/test/location can be quite
41# useful for testing out new versions.
85364e4e 42
dc45a647 43#Site-specific values:
85364e4e 44
dc45a647
MB
45case "\$perladmin" in
46'') perladmin='$perladmin' ;;
47esac
48
5f578af9 49# Installation prefixes. Allow a Configure -D override. You
dc45a647
MB
50# may wish to reinstall perl under a different prefix, perhaps
51# in order to test a different configuration.
9e80d8f4
JH
52# For an explanation of the installation directories, see the
53# INSTALL file section on "Installation Directories".
dc45a647
MB
54case "\$prefix" in
55'') prefix='$prefix' ;;
56esac
c9166e37
AD
57
58# By default, the next three are the same as \$prefix.
59# If the user changes \$prefix, and previously \$siteprefix was the
60# same as \$prefix, then change \$siteprefix as well.
61# Use similar logic for \$vendorprefix and \$installprefix.
62
5f578af9 63case "\$siteprefix" in
c9166e37
AD
64'') if test "$siteprefix" = "$prefix"; then
65 siteprefix="\$prefix"
66 else
67 siteprefix='$siteprefix'
68 fi
69 ;;
5f578af9
AD
70esac
71case "\$vendorprefix" in
c9166e37
AD
72'') if test "$vendorprefix" = "$prefix"; then
73 vendorprefix="\$prefix"
74 else
75 vendorprefix='$vendorprefix'
76 fi
77 ;;
5f578af9
AD
78esac
79
80# Where installperl puts things.
81case "\$installprefix" in
c9166e37
AD
82'') if test "$installprefix" = "$prefix"; then
83 installprefix="\$prefix"
84 else
85 installprefix='$installprefix'
86 fi
87 ;;
5f578af9 88esac
85364e4e
MB
89
90# Installation directives. Note that each one comes in three flavors.
91# For example, we have privlib, privlibexp, and installprivlib.
92# privlib is for private (to perl) library files.
c4f23d77 93# privlibexp is the same, except any '~' the user gave to Configure
85364e4e 94# is expanded to the user's home directory. This is figured
dc45a647 95# out automatically by Configure, so you don't have to include it here.
85364e4e
MB
96# installprivlib is for systems (such as those running AFS) that
97# need to distinguish between the place where things
5f578af9
AD
98# get installed and where they finally will reside. As of 5.005_6x,
99# this too is handled automatically by Configure based on
100# $installprefix, so it isn't included here either.
101#
9e80d8f4
JH
102# Note also that there are three broad hierarchies of installation
103# directories, as discussed in the INSTALL file under
104# "Installation Directories":
105#
106# =item Directories for the perl distribution
107#
108# =item Directories for site-specific add-on files
109#
110# =item Directories for vendor-supplied add-on files
111#
5f578af9 112# See Porting/Glossary for the definitions of these names, and see the
9e80d8f4 113# INSTALL file for further explanation and some examples.
dc45a647
MB
114#
115# In each case, if your previous value was the default, leave it commented
116# out. That way, if you override prefix, all of these will be
117# automatically adjusted.
693762b4 118#
3a6175e1 119# WARNING: Be especially careful about architecture-dependent and
dc45a647
MB
120# version-dependent names, particularly if you reuse this file for
121# different versions of perl.
693762b4
AD
122
123!GROK!THIS!
124
6e1038e0
MB
125# Set the following variables. Mention them here so metaconfig
126# includes the appropriate code in Configure
127# $bin $scriptdir $privlib $archlib
128# $man1dir $man3dir $html1dir $html3dir
129# $sitebin $sitescript $sitelib $sitearch
8d2cbf27 130# $siteman1dir $siteman3dir $sitehtml1dir $sitehtml3dir
6e1038e0 131# $vendorbin $vendorscript $vendorlib $vendorarch
8d2cbf27 132# $vendorman1dir $vendorman3dir $vendorhtml1dir $vendorhtml3dir
6e1038e0 133
5f578af9 134for var in \
c1bd2363
MB
135 bin scriptdir privlib archlib man1dir man3dir man1ext man3ext \
136 html1dir html3dir \
49c10eea 137 sitebin sitescript sitelib sitearch \
8d2cbf27 138 siteman1dir siteman3dir sitehtml1dir sitehtml3dir \
5f578af9 139 vendorbin vendorscript vendorlib vendorarch \
8d2cbf27 140 vendorman1dir vendorman3dir vendorhtml1dir vendorhtml3dir
5f578af9 141do
dc45a647
MB
142
143 case "$var" in
5f578af9
AD
144
145 # Directories for the core perl components
dc45a647
MB
146 bin) dflt=$prefix/bin ;;
147 # The scriptdir test is more complex, but this is probably usually ok.
c4f23d77
AD
148 scriptdir)
149 if $test -d $prefix/script; then
150 dflt=$prefix/script
151 else
152 dflt=$bin
153 fi
154 ;;
dc45a647
MB
155 privlib)
156 case "$prefix" in
3a6175e1
AD
157 *perl*) dflt=$prefix/lib/$version ;;
158 *) dflt=$prefix/lib/$package/$version ;;
bfb7748a
AD
159 esac
160 ;;
5f578af9
AD
161 archlib) dflt="$privlib/$archname" ;;
162
163 man1dir) dflt="$prefix/man/man1" ;;
164 man3dir) dflt="$prefix/man/man3" ;;
165 # Can we assume all sed's have greedy matching?
166 man1ext) dflt=`echo $man1dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
167 man3ext) dflt=`echo $man3dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
168
169 # We don't know what to do with these yet.
170 html1dir) dflt='' ;;
c1bd2363 171 html3dir) dflt='' ;;
5f578af9 172
9e80d8f4 173 # Directories for site-specific add-on files
5f578af9 174 sitebin) dflt=$siteprefix/bin ;;
49c10eea 175 sitescript)
5f578af9
AD
176 if $test -d $siteprefix/script; then
177 dflt=$siteprefix/script
178 else
179 dflt=$sitebin
180 fi
bfb7748a
AD
181 ;;
182 sitelib)
5f578af9 183 case "$siteprefix" in
ba04bae9
JH
184 *perl*) dflt=$prefix/lib/site_perl/$version ;;
185 *) dflt=$prefix/lib/$package/site_perl/$version ;;
dc45a647
MB
186 esac
187 ;;
ba04bae9 188 sitearch) dflt="$sitelib/$archname" ;;
dc45a647 189
c1bd2363
MB
190 siteman1dir) dflt="$siteprefix/man/man1" ;;
191 siteman3dir) dflt="$siteprefix/man/man3" ;;
5f578af9 192 # We don't know what to do with these yet.
c1bd2363
MB
193 sitehtml1dir) dflt='' ;;
194 sitehtml3dir) dflt='' ;;
5f578af9 195
9e80d8f4
JH
196 # Directories for vendor-supplied add-on files
197 # These are all usually empty.
5f578af9
AD
198 vendor*)
199 if test X"$vendorprefix" = X""; then
200 dflt=''
201 else
202 case "$var" in
203 vendorbin) dflt=$vendorprefix/bin ;;
49c10eea 204 vendorscript)
5f578af9
AD
205 if $test -d $vendorprefix/script; then
206 dflt=$vendorprefix/script
207 else
208 dflt=$vendorbin
209 fi
210 ;;
211 vendorlib)
212 case "$vendorprefix" in
ba04bae9
JH
213 *perl*) dflt=$prefix/lib/vendor_perl/$version ;;
214 *) dflt=$prefix/lib/$package/vendor_perl/$version ;;
5f578af9
AD
215 esac
216 ;;
ba04bae9 217 vendorarch) dflt="$vendorlib/$archname" ;;
dc45a647 218
c1bd2363
MB
219 vendorman1dir) dflt="$vendorprefix/man/man1" ;;
220 vendorman3dir) dflt="$vendorprefix/man/man3" ;;
5f578af9 221 # We don't know what to do with these yet.
c1bd2363
MB
222 vendorhtml1dir) dflt='' ;;
223 vendorhtml3dir) dflt='' ;;
5f578af9
AD
224
225 esac # End of vendorprefix != ''
226 fi
227 ;;
dc45a647
MB
228 esac
229
230 eval val="\$$var"
231 if test X"$val" = X"$dflt"; then
232 echo "# $var='$dflt'"
233 else
234 echo "# Preserving custom $var"
dc45a647
MB
235 echo "$var='$val'"
236 fi
237
238done >> Policy.sh
693762b4
AD
239
240$spitshell <<!GROK!THIS! >>Policy.sh
241
dc45a647 242# Lastly, you may add additional items here. For example, to set the
693762b4
AD
243# pager to your local favorite value, uncomment the following line in
244# the original Policy_sh.SH file and re-run sh Policy_sh.SH.
dc45a647
MB
245#
246# pager='$pager'
693762b4
AD
247#
248# A full Glossary of all the config.sh variables is in the file
249# Porting/Glossary.
85364e4e
MB
250
251!GROK!THIS!
3a6175e1
AD
252
253#Credits:
254# The original design for this Policy.sh file came from Wayne Davison,
255# maintainer of trn.
256# This version for Perl5.004_61 originally written by
9e80d8f4 257# Andy Dougherty <doughera@lafayette.edu>.
3a6175e1 258# This file may be distributed under the same terms as Perl itself.