        ===========================                      how to compile
        GNU Pascal for DOS and OS/2                     GPC 1.1 (2.6.3)
        ===========================                    with and for emx

        Author: Peter Gerwinski (pege@mail.theo-phys.uni-essen.de)
        Created on:  15. Aug. 1995, 2:30-4:30am (version 1.0)
        Last change: 16. Aug. 1995 (version 1.1)


        This recipe is distributed in the hope that it will be use-
        ful, but WITHOUT ANY WARRANTY.  I disclaim any liability for
        damages resulting from following these instructions ...

        Feel free to copy, modify, translate or delete this file.

        And so on.


        GPC binaries for emx are available in GPC-263B.ZIP.  Perhaps
        the best idea is simply to unzip it?  For example with PKUNZIP:

          pkunzip -d gpc-263b \


        Okay, here is how I compiled it ...

        The emx extender for DOS and OS/2 makes it relatively easy to
        port GNU tools -- such as the GNU Pascal Compiler -- to these
        platforms.  However, it is not straightforward to compile it.
        There is no bash.  No symbolic links.  8.3 file names.  Etc.
        It took me about two complete days to find out what to do --
        not much when facing the about 15 MegaBytes of sources, but
        enough.  Although I am not content with my quick-and-dirty
        result I document here what steps to do.

        0) I assume you have the emx package installed with GNU
           development tools.  And a make utility, e.g. "nmake".

        1) Get the patched source code GCCSRC1.ZIP, GCCSRC2.ZIP,
           GCCSRC3.ZIP for GCC version 2.6.3.  (The correct version is
           important.  I found my copy at ftp.uni-paderborn.de.)
           Get the original source for GNU Pascal (GPC) 2.6.3 from
           kampi.hut.fi.  If necessary, rename the distribution archive
           in a suitable way (e.g. GPC-263.TGZ works even with DOS).
           Get DOS or OS/2 executables "tar" and "gzip".

        2) Unzip the source for GCC.  E.g. with PKUNZIP, when the ZIP
           files are in the actual directory:

             pkunzip -d gccsrc? \

        3) Unpack the source for GPC in the emx\gnu directory.  E.g.,
           when the TGZ file is in the emx directory:

             cd \emx\gnu
             gzip -d ..\gpc-263.tgz
             tar -xf ..\gpc-263.tar

        4) Rename the new subdirectories in \emx\gnu to make things
           more symmetric. :-)

             rendir gcc-2.6 gcc-263          (with OS/2: ren)
             rendir 2_6.3 gpc-263

        5) Unzip MAKE-GPC.ZIP in any directory you like:

             md make-gpc
             pkunzip ..\make-gpc make-gpc

        6) Copy "rts-vers.c" to \emx\gnu\gpc-263\rts.
           If you are installing on a FAT partition:
             Copy "MakeFAT" to \emx\gnu\gpc-263\Makefile.
             Copy "MakeFAT.rts" to \emx\gnu\gpc-263\Makefile.
           If you are installing on a HPFS partition:
             Copy "MakeHPFS" to \emx\gnu\gpc-263\Makefile.
             Copy "MakeHPFS.rts" to \emx\gnu\gpc-263\Makefile.
           (I.e. change their names to "Makefile." while copying.)
           Use the remaining C source files to replace those in
           \emx\gnu\gpc-263.  You must switch off the read-only flag
           in the original files before copying.

             cd make-gpc
             copy rts-vers.c \emx\gnu\gpc-263\rts
             copy Makefile \emx\gnu\gpc-263
             copy Makefile.rts \emx\gnu\gpc-263\rts\Makefile
             attrib -r \emx\gnu\gpc-263\gcc.c
             attrib -r \emx\gnu\gpc-263\gpc-cccp.c
             attrib -r \emx\gnu\gpc-263\gpc-util.c
             attrib -r \emx\gnu\gpc-263\toplev.c
             attrib -r \emx\gnu\gpc-263\version.c
             copy g*.c \emx\gnu\gpc-263
             copy toplev.c \emx\gnu\gpc-263
             copy version.c \emx\gnu\gpc-263

           (Is there really no switch to force overwriting of read-only
           files in copy nor in xcopy?  In Novell DOS 7 xcopy, there
           is "/R".)
           These sources are patched for emx.  I just copied everything
           surrounded by "#ifdef EMX ... #endif" (or similar) from
           Eberhard Mattes' GCC source into Juki's GPC source files.
           I also did the patch to gpc-util.c, so it is included, too.
           A lot of bugs could have been born now ...

        7) If you are installing on a drive different from C:, replace
           the OS/2 shell script files "makeexe.cmd" and "dostage1.cmd"
           with drive-independent ones.

             copy *.cmd ..\gcc-263

        8) Compile GCC.  One stage is enough.

             cd \emx\gnu\gcc-263
             dostage1
             makeexe

        9) Compile and install GPC, e.g. with "nmake":

             cd \emx\gnu\gpc-263
             nmake install

        10) Compile and install the GPC library.

             cd rts
             nmake install

        11) Hope that not too much went wrong.
            Write some tiny test programs.
            Write useful larger programs with GPC ...

        Good luck!

            Peter
