Make perl_setup.com infer perl_root from its own location.
authorCraig A. Berry <craigberry@mac.com>
Sat, 28 Dec 2013 17:22:28 +0000 (11:22 -0600)
committerCraig A. Berry <craigberry@mac.com>
Sat, 28 Dec 2013 17:22:28 +0000 (11:22 -0600)
The perl_setup.com command procedure initializes the root logical
name, the shareable image logical name pointing to the main Perl
dynamic library, and either command symbols or command table
entries that reference those logical names.  It's always by
default hard-coded the prefix chosen at configuration time as the
basis for where Perl should be located.

The original rationale for that was that it gets run right before
installperl and sets things up correctly for installation.  But
that optimizes for a single use case that is easily handled by
specifying the correct install location as a parameter and
pessimizes for every other use case, notably relocating an
installed Perl directory tree.

So make it infer the correct root from its own location and
specify the install location only at installation time.  Among
other benefits, this allows the install location to be chosen
at installation time by overriding the default prefix like so:

  MMK/MACRO=(PREFIX="DSA0:[homedir.MyPerl2.]") install

configure.com
vms/descrip_mms.template

index 6135dfa..db9f0be 100644 (file)
@@ -7041,6 +7041,7 @@ $   DEBUG_REPLACE = "USEVMSDEBUG=__DEBUG__=1"
 $ ELSE
 $   DEBUG_REPLACE = "USEVMSDEBUG="
 $ ENDIF
+$ PREFIX_REPLACE = "PREFIX=PREFIX=''prefix'"
 $!
 $! In order not to stress the tiny command buffer on pre-7.3-2 systems,
 $! we put the following substitutions in a file and pass the file to
@@ -7063,6 +7064,7 @@ $ WC "FLAGS=FLAGS=''extra_flags'"
 $ WC "''LARGEFILE_REPLACE'"
 $ WC "ARCHNAME=ARCHNAME=''archname'"
 $ WC "''DEBUG_REPLACE'"
+$ WC "''PREFIX_REPLACE'"
 $ close CONFIG
 $!
 $ echo4 "Extracting ''defmakefile' (with variable substitutions)"
@@ -7230,25 +7232,20 @@ $ ELSE
 $ WRITE CONFIG "$! This perl configured & administered by ''perladmin'"
 $ ENDIF
 $ WRITE CONFIG "$!"
-$! HP hack to make distributing binaries easier
-$!----------------------------------------------
-$ pcsi_producer = f$trnlnm("PCSI_PRODUCER")
-$ if pcsi_producer .eqs. ""
-$ then
-$   WRITE CONFIG "$ define/translation=concealed ''vms_prefix' ''prefix'"
-$ else
-$  WRITE CONFIG "$ myproc = f$environment(""PROCEDURE"")"
-$  WRITE CONFIG "$ myroot_dev = f$parse(myproc,,,""DEVICE"",""NO_CONCEAL"")"
-$  WRITE CONFIG "$ myroot_dir = f$parse(myproc,,,""DIRECTORY"",""NO_CONCEAL"")"
-$  WRITE CONFIG "$ myroot_dir = myroot_dir - ""][000000."" - ""><000000."""
-$  WRITE CONFIG "$ myroot_dir = myroot_dir - ""][000000]"" - ""><000000>"""
-$  WRITE CONFIG "$ myroot_dir = myroot_dir - ""]["" - ""><"""
-$  WRITE CONFIG "$ myroot_dir = myroot_dir - "".]"" - "".>"" - ""["" - ""]"" - ""<"" - "">"""
-$  WRITE CONFIG "$ if f$trnlnm(""HP_BUILD_PERL_BIN_KIT"",""LNM$PROCESS_TABLE"") .EQS. """""
-$  WRITE CONFIG "$ then"
-$  WRITE CONFIG "$  define/translation=concealed ''vms_prefix' 'myroot_dev'['myroot_dir'.]"
-$  WRITE CONFIG "$ endif"
-$ endif
+$ WRITE CONFIG "$ if P1 .EQS. """""
+$ WRITE CONFIG "$ then"
+$ WRITE CONFIG "$   myproc = f$environment(""PROCEDURE"")"
+$ WRITE CONFIG "$   myroot_dev = f$parse(myproc,,,""DEVICE"",""NO_CONCEAL"")"
+$ WRITE CONFIG "$   myroot_dir = f$parse(myproc,,,""DIRECTORY"",""NO_CONCEAL"")"
+$ WRITE CONFIG "$   myroot_dir = myroot_dir - ""][000000."" - ""><000000."""
+$ WRITE CONFIG "$   myroot_dir = myroot_dir - ""][000000]"" - ""><000000>"""
+$ WRITE CONFIG "$   myroot_dir = myroot_dir - ""]["" - ""><"""
+$ WRITE CONFIG "$   myroot_dir = myroot_dir - "".]"" - "".>"" - ""["" - ""]"" - ""<"" - "">"""
+$ WRITE CONFIG "$   root_spec = myroot_dev + ""["" + myroot_dir + "".]"""
+$ WRITE CONFIG "$ else"
+$ WRITE CONFIG "$   root_spec = P1"
+$ WRITE CONFIG "$ endif"
+$ WRITE CONFIG "$ define/translation=concealed ''vms_prefix' 'root_spec'"
 $ WRITE CONFIG "$ ext = "".exe"""
 $ IF sharedperl
 $ THEN
index 94e93e7..4c3206a 100644 (file)
@@ -35,6 +35,7 @@
 ~LARGEFILE~
 ~ARCHNAME~
 ~USEVMSDEBUG~
+~PREFIX~
 
 #: >>>>> Architecture-specific options <<<<<
 .ifdef IXE
@@ -564,7 +565,7 @@ makeppport : $(MINIPERL_EXE) $(ARCHDIR)Config.pm nonxsext
        $(MINIPERL) mkppport
 
 install.html : [.pod]perltoc.pod
-       @ @perl_setup.com
+       @ @perl_setup.com "$(PREFIX)"
        @ If F$Search("perl_root:[lib]html.dir").eqs."" Then Create/Directory perl_root:[lib.html]
        $(MINIPERL) installhtml. "--podroot=. --recurse --htmldir=/perl_root/lib/html --htmlroot=.. --verbose"
 
@@ -615,7 +616,7 @@ minitest : $(MINITEST_EXE) unidatafiles.ts
 # install ought not need a source, but it doesn't work if one's not
 # there. Go figure...
 install : $(PERL_EXE)
-       @ @perl_setup.com
+       @ @perl_setup.com "$(PREFIX)"
        If F$TrnLnm("Sys") .nes. "" Then Deass SYS
        @ define/user_mode $(DBG)PERLSHR SYS$DISK:[]$(DBG)perlshr$(E)
        $(PERL) installperl