http://www.cs.bham.ac.uk/research/poplog/sysdoc/pop11-executables.txt

See also
http://www.cs.bham.ac.uk/research/poplog/sysdoc/AREADME


This file was posted to comp.lang.pop and pop-forum on 16 May 2005
It answers some questions about multiple pop11 executables in
$usepop/pop/pop (i.e. $popsys).

The text below was expanded on 31 May 2005

On 15 May 2005, Pete Goodeve wrote about porting Poplog BeOS.

I replied to some of his questions.

Ideally, instead of producing a port to BeOS it would be good to produce
mechanisms to generate the BeOS port from the latest version of linux
poplog. But maybe that will be too difficult.

If not too many system sources have to be changed, then the changes
could be inserted in conditional compilation commands in the main
sources in $popsrc and $popsrc/syscomp, and after that it should be
possible to copy the latest version of linux poplog to BeOs, insert a
working corepop, use it to rebuild saved images for popc, poplibr and
poplink, use those saved images to recompile and relink all the poplog
sources and executables except corepop, then rebuild newpop and run it.
On a modern computer that would take at most a few minutes.

(Running the install script for linux poplog V15.6, i.e. rebuilding all
the system saved images then re-linking and running newpop to relink and
build user saved images, indexes etc., on a 2010 ghz AMD64 takes less
than 12 seconds. That includes compiling the poplog widget set. It does
not include recompiling and archiving the main poplog system sources.
That would add several minutes I expect.)

Likewise it should be possible using such a mechanism to generate
debian, freebsd and amd64 versions of poplog. I had hoped we would be
able to do that with OSX poplog, but it still seems to be quite far from
that.

> ....

The next bit should be in a FAQ, and I think I'll copy this to a file in
the sysdoc directory

    http://www.cs.bham.ac.uk/research/poplog/sysdoc/pop11-executables.txt
    [THIS FILE]

[PG]
> ....Though I do admit to still being
> confused about the intended purpose of the various '***pop11's.
> 'newpop11' is just what a freshly linked system is named, I gather,
> and 'corepop' and 'corepop11' are the same file (historical difference),
> but in the end we have 'corepop11', 'basepop11', and plain 'pop11'.
> Why are they all there?  How do they differ?

Since you've asked here's what I understand the answer to be.

1. basepop11

This is the basic run-time executable used by all normal users.

The commands invoked by normal users all use basepop11. E.g. pop11
invokes
    basepop11 +popsavelib

prolog invokes

    basepop11 +popsavelib +prolog

pml invokes

    basepop11 +popsavelib +pml

The precise mechanisms depend on a very messy but surprisingly portable
scheme using environment variables $pop_pop11 $pop_prolog $pop_pml
$pop_clisp etc. plus the use of hard or symbolic links in $popsys

E.g. pop11 is a link to basepop11. If you run basepop11 with a command
xxxx and $pop_xxx is an environment variable, then that is equivalent
to running basepop11 followed by the value of $pop_xxx. So

    pop11  is equivalent to:  basepop11 $pop_pop11
    pml    is equivalent to:  basepop11 $pop_pml
    clisp  is equivalent to:  basepop11 $pop_clisp

etc. (See REF SYSTEM/'Additional Startup Mechanism in Unix')

Because there are hard links to basepop11 in $popsys, 'mv' should never
be used to install a new basepop11. It should always be done using 'cp'
so that the links are preserved.
(I think symbolic links did not exist when that scheme was invented.
They are more flexible than hard links).

2. corepop (and corepop11 defunct)
corepop is an executable that is used to build and run the
system-building tools used for recompiling, archiving and linking
poplog. It can be used to rebuild  basepop11, and if something goes
wrong so that basepop11 does not work.

corepop was at one time called 'safepop11' I think.

The corepop executable is a 'minimal' version of pop11 without Ved, and
without X facilities. In solaris poplog version 15.53 there are still
three executables of increasing size: corepop, corepop11, basepop11

I don't know why there are three instead of two!

On 32-bit linux poplog V15.6 on x86 architectures the size of the
basepop11 file linked on RedHat 8 is currently 1803756 bytes and the
size of corepop is 1300338 bytes. (For some reason the files are smaller
when linked on Fedora core 3 running on AMD64).

The 'size' command gives

       text    data     bss     dec     hex filename
    1437816   62656  243332 1743804  1a9bbc basepop11
    1037955   41252  242504 1321711  142aef corepop


The corepop executable is used both to create and to run the
system-building saved images in $popsys

    popc.psv        - for compiling poplog sources (*.p *.s)
                      invoked as $popsys/pgcomp. For each file
                      compiled it creates a .o file and a .w file.
                      The former gets archived by pglibr (below)
                      into a library with suffix .olb, and the latter
                      into a library with suffix .wlb.
                      The entries in .olb are used by the Poplog linker
                      to create system .o files prior to linking.
                      The entries in .wlb are used by the the Poplog
                      linker to build the run-time dictionary, since,
                      unlike programs written in C, C++ etc. the
                      procedures written Pop11 are available to be
                      invoked by their names at run time, in user code.



    poplibr.psv     - for building archives from compiled code
                      invoked as $popsys/pglibr
                      This takes the .o and .w files produced by the
                      poplog system compiler (pgcomp) and either creates
                      .olb and .wlb archives, or else adds/replaces them
                      in existing archives.

    poplink.psv     - for creating poplink_cmnd and the required
                      .o files files for re-linking poplog
                      invoked as $popsys/pglink
                      When this is run as pglink it uses the the .olb
                      and .wlb archives and other information specified
                      in environment variables, to create a number of .o
                      files ready for linking, and a shell script called
                      poplink_cmnd, which, when run invokes the ordinary
                      linker (via cc or gcc) to create an executable
                      called newpop11, along with possibly other files,
                      e.g. newpop11.map newpop11.rsv (obsolete).
                      If the newpop11 works it can replace the basepop11
                      file, or can be used to create another pop11 of a
                      different kind, e.g. a reduced pop11 for
                      delivering some application.



    newpop.psv      - for running pglink and various other things
                      including creating user saved images, indexes
                      etc.
                      invoked as $popsrc/newpop

The system-building saved images, popc.psv, poplibr.psv, poplink.psv and
newpop.psv are created from pop11 sources in the directory
    $popsrc/syscomp

The script to create the first three is in
    $popsrc/mksyscomp

The script to create newpop.psv is in
    $popsrc/mknewpop

The scripts to run the first three, pgcomp, pglib, pglink are in
$popsrc. The script to run newpop is in $popsrc/newpop

Further details follow.


Once you have a working corepop on a system it should not be upgraded
every time you change poplog. That's because your changes may introduce
a bug that stops corepop working, and then you will not be able to
compile, archive or link poplog sources to fix the bug.

corepop is created as described in
    http://www.cs.bham.ac.uk/research/poplog/sysdoc/rebuilding-corepop

by running one of these two (equivalent commands):

    pglink -core
    pglink -safe

That should produce required .o files and a shell script poplink_cmnd,
which it then runs to create a reduced newpop11 executable that can be
tested to see if it runs, and if so copied to to corepop (after saving
corepop somewhere as a precaution -- using 'cp' not 'mv'!).

3. newpop11

Every time you run pglink it produces a new executable called newpop11
as described above. What sort of executable it is, e.g. whether it
includes Ved or links to X facilities, or whether it is shareable or
not, etc. depend on flags you give to pglink. See the shell script
    $popsys/pglink

E.g. to produce a candidate newpop11 to be used as a new basepop11
linked with ved, X11 facilities, motif, etc. and a symbol map in
newpop11.map use

    pglink -map -xm

to produce newpop11 with no X facilities do

    pglink -nox

to create a newpop11 that runs X facilities using only Athena widgets,
not motif, use

    pglink -map

Once you have a version of newpop11 that you want to use as basepop11
you can copy it to basepop11, then rebuild all saved images using the
scripts in $usepop/pop/com

4. rsvpop11

On some versions of poplog (e.g. Solaris poplog) you will find another
executable rsvpop11. If it runs it exits immediately, unless run with a
saved image.

This is a relic of a time when poplog was a commercial product and
basepop11 would run only if evidence of a poplog licence for that
machine was available. In order to allow users to produce products that
could run without a poplog licence, a mechanism was introduced that
allowed products to start up using instead of basepop11 the rsvpop11
executable that was created at the same time. Then any saved image
produced by the basepop11 could be run using the rsvpop11. This did not
fully prevent end users of poplog-based products (like Clementine) from
gaining access to the full functionality of poplog, but made it more
difficult.

5. basepop11.old

This is automatically created when basepop11 is over-written by the
installation scripts. It allows reversion to an old version if something
goes wrong. Once everything is working basepop11.old and its 'map' file
can be deleted.

I hope that helps.

Aaron Sloman
16 May 2005 ; 8 Jun 2012
http://www.cs.bham.ac.uk/~axs/