[comp.sys.acorn] Utils at Newcastle

maumg@warwick.ac.uk (Pop Mobility Freak) (04/15/91)

Dear Arc programmers,

If like me you do not have CLib 3.69 you will be having problems using the
following very useful postings made to the NewCastle Info Server.

27/Mar/91   331 bison               arc port of bison
27/Mar/91   119 diff                arc port of diff
27/Mar/91   335 flex                arc port of flex
27/Mar/91   814 gawk                arc port of GNU awk
27/Mar/91   137 grep                arc port of grep
27/Mar/91   186 indent              arc port of indent
27/Mar/91   285 make                arc port of make
27/Mar/91    18 makeport            arc port of makeport
27/Mar/91    35 nro                 arc port of nroff
27/Mar/91    73 patch               arc port of patch
27/Mar/91    93 rh                  arc port of ?
27/Mar/91   100 ro                  arc port of ?
27/Mar/91    68 sed                 arc port of sed
27/Mar/91    73 shar                arc port of shar
27/Mar/91    83 tr2tex              arc port of troff to tex translator
27/Mar/91   187 utils               arc port of various utilities
27/Mar/91    29 xfmt                arc port of xfmt
27/Mar/91   371 rcs                 code management system

I set about trying to recompile the files (all apart from gawk as I ran out
of discs when transfering the stuff from our Unix network) and have now
succeeded in doing so.

The main problem was all the makefiles are written to use the gnu version of
make and are incompatible with amu. So I first set about compiling make. To
do this I converted the makefile into a format understood by amu. This
enabled me to compile make. From this it was just a matter of modifying all
the other makefiles slightly for my directory structure.

I have posted a file to the newcastle info server (called utils_makefiles)
which contains all these makefiles (including the amu version to compile make
itself). I did try and compile make using AnsiLib and so include it in the
posting but the function mktime appears to be missing from AnsiLib (it is
however present in the Stubs and Shared C Library combination) so this was
impossible. Is this a bug Acorn?

To compile make you need to

        Copy the makefile called Make.Amu.Makefile out of the uuencoded
        archive I sent to the info server into the directory which contains
        the source and header files for make (ie containing C.Ar to C.Vpath
        and H.Compat to H.Version). The file make.makefile is the makefile
        which needs gnu make to make make. I have included this for
        completeness and because it has the clobber and clean targets (see
        later for description).

        Install the header files and object file for the utils library. This
        is where the fun starts as everyone likes to install everything in
        different places on their harddisc (if you do not have a harddisc you
        can give up now). To this end I have tried to make everything offsets
        from the operating system variables C$Loc and C$Libroot. Both these
        variables are set by the file CStart included with C release 3 but
        C$Loc is unset as the last operation in the obey file. Below is a
        depiction of the directory structure I have (and you will need) for
        the utils and other libraries needed.

                $.Languages.C = <C$Loc>
                |            CLib = <C$Libroot>
                |            |  h
                |            |  |  kernel
                |            |  |  pragmas
                |            |  |  swis
                |            |  |  varargs
                |            |  o
                |            |  |  AnsiLib
                |            |  |  ArthurLib
                |            |  |  overmgr
                |            |  |  Stubs
                |            Utils
                |            |  h
                |            |  |  Bag
                |            |  |  Bitset
                |            |  |  chunkfile
                |            |  |  Deque
                |            |  |  fcntl
                |            |  |  Filter
                |            |  |  Map
                |            |  |  Queue
                |            |  |  Regex
                |            |  |  Ring
                |            |  |  Set
                |            |  |  Stack
                |            |  |  utils
                |            |  o
                |            |  |  utils
                |            |  sys
                |            |  |  h
                |            |  |  |  Dir
                |            |  |  |  File
                |            |  |  |  File-mac
                |            |  |  |  Stat
                |            |  |  |  time
                |            |  |  |  Types

        As you can see I store everything in the directory $.Languages.C
        but you can put them anywhere as long as the variable C$Loc is set
        accordingly (adfs::Ian's_Disc.$.Languages.C in my case). The variable
        C$Libroot needs to be set to the directory containing the header and
        object files relating to the Shared C Library. Note only the header
        files which are not stored internally by the compiler need be on
        disc. So in my case C$Libroot = <C$Loc>.CLib. I would recomend having
        C$Libroot set at <C$Loc>.CLib as it is then consistent with the
        position of the Utils library (I also have Risc_OSLib in the same
        directory but it is not needed for these applications).

        Once this has been done simply change to the directory containing
        the makefile and type amu. This will produce a file !RunImage in the
        directory which you should copy into your library. If you do
        amu install  then the !RunImage file will be copied into %.Gnu. More
        on this later.

Now to compile all the other utilities (except flex, bison and utils, see
later) it is a simple matter of installing all the makefiles out of the
uuencoded archive, changing directory and typing make. For every makefile
there are a few targets which can specified to install the programs or clean
up after the compilation.

        make install    will copy all the compiled files into %.Gnu (or %.RCS
                        for the RCS programs). I know not all the programs
                        are written by GNU (or I least I think they are not)
                        but I did not want to go around creating too many
                        directories within my library and so they are all put
                        into %.Gnu. Note %.Gnu (or %.RCS) will *not* be
                        created if they do not exist. If you want to install
                        the programs into another place type

                        make install BIN=<destination directory>

                        or modify the makefile by changing the line

                        BIN = %.Gnu (or BIN = %.RCS)

                        If you install the programs into %.Gnu and %.RCS it
                        would be a good idea to change the variable Run$Path
                        of course.

        make clean      will remove all the object files made during the
                        compilation.

        make clobber    will do the same as clean and then remove all the
                        executables created in the current directory. This is
                        useful if you install the programs into a library and
                        then wish to free the disc space.

For utils the compilation process is the same but as it compiles no
executable the installation process is slightly different. When you type make
install the library (utils.o) will be copied into <C$Loc>.Utils and the
header files will also be copied. But before you start one of the source
files need be modified slightly. Line 16 of c.file should be

        static FILE *fdtofile(int fd) {
not
        static int fdtofile(int fd) {

For flex and bison they need to install libraries as well. Bison saves (and
will use when executed) Lib:Bison and similarly Flex saves Lib:Flex. So the
variable Lib$Path needs to be set to the full path of the directory where you
plan to install these (Lib$Path = adfs::Ian's_Disc.$.Library.Lib. in my case,
ie %.Lib.). This variable needs be set whenever flex or bison are to be used.

As a final note some of the programs need the command Libfile to install.
This is part of the Software Developers Toolkit and produces a library from a
set of object files. Also to recreate the utils library objasm (the object
assembler) is also needed. Xfmt needs flex to compile as so should obviously
be compiled after flex.

There is no need to download this file as it is included as ReadMe within the
archive at Newcastle.

PMF

Though I have tested all the makefiles and they work fine on my system if you
encounter any problems feel free to mail me at pmf@uk.ac.warwick.cs or
maumg@uk.ac.warwick.cu (the former is preferable).

I can accept no responsibility for and loss of data or other damage caused by
use (or mis-use) of the information included in this file and the posting
at Newcastle.

If you have any problems using the programs after compilation contact Paul
Moore instead of me as he will be better suited to assist you. But if you
cannot contact him then I will try and help you as I am a nice person (who
is probably asking for trouble :-) ).