This is the DJGPP port of gcc-12.2.0

Please read this file up to end (maybe skipping sections You don't need,
for example You don't need to read how to build gcc-12.2.0 from sources
if You only intend to use binary archives). Also consult DJGPP documentation
and FAQ where needed.


Requirements to use this binary release:
    -  DJGPP-@DJVER@.
    -  binutils-2.30 or above (Earlier versions will NOT work)

Changes since release of DJGPP port of gcc-6.3.0:
    - support for std::experimental::filesystem added (note that library
      is renamed from libstdc++fs.a to libstdcfs.a to avoid filename conflict
      when LFN support is not available)

Source archives
===============

Archive djcross-gcc-12.2.0.tar.bz2 contains script which modifies
original gcc-12.2.0 sources for DJGPP. You don't need it unless You
want to recreate GCC source archive for DJGPP. If You are using this
archive and original sources of gcc-12.2.0.tar.gz, then You don't
need gcc1220s.zip. Running these scripts under DJGPP requires
using versions of GNU Autoconf and Automake not ported to DJGPP. As result
one should use different system (like Linux) for it.

The source archive gcc1220s.zip contains all the sources to build
all compilers (C, C++, Ada, Objective C, Objective C++, GNU Fortran) and also
also all required libraries.

Most users don't need source archives at all.

Binary archives
================

Binary archives are split into 4 parts:

  gcc1220b.zip  : The gcc.exe driver program and the C compiler.
                 It also contains the documentation.

  gpp1220b.zip  : The C++ compiler and libstdcxx.a together
                 with needed header files. Please note that one must
		 recompile all C++ sources built with any earlier GCC version

  objc1220b.zip : The Objective C and Objective C++ compilers and
		 libobjc.a and the needed header files.

  gfor1220b.zip  : GNU Fortran compiler

  ada1220b.zip : The GNU Ada compiler and development files

The archive gcc1220b.zip is required by all other binary packages

Binary packages includes following documentation files:

  Archive gcc1220b.zip:
	info/gcc.info - the use and the internals of the GNU compiler
	info/cpp.info - documentation of the GNU C preprocessor.
	info/cppinternals.info  - internals of the GNU C Preprocessor.
        info/gccinstall.info
	info/gccint.info
		(NEW: use install-info to add it to info/dir)
  Archive gpp1220b.zip:
        gnu/gcc-12.20/libstdcxx/* - some documentation of libstdc++-v3
		(HTML and text formats)
  Archive gfor1220b.zip:
	info/gfortran.info - documentation of the GNU Fortran compiler


Installing binaries of gcc-12.2.0
=================================

You should remove previous installation of gcc completely
(unless You really know what You are doing).

Following packages are required for binaries:
	binutils-2.30 or above.

	DJGPP-@DJVER@ (djdev205.zip). Later development version recommended

Rrquired packages for different programming languages
	C 			: gcc1220b.zip

	C++			: gcc1220b.zip, gpp1220b.zip

	Fortran	95              : gcc1220b.zip, gfor1220b.zip

	Objective C		: gcc1220b.zip, objc1220b.zip

        Ada                     : gcc1220b.zip, ada1220b.zip

Of course for ALL languages You also need at least binutils (bnu230b.zip
or newer) and @DJDEV@.zip (or newer when it will be released)

Unzip all the zip files from that directory, preserving the
directory structure.  For example:

	pkunzip -d @DJDEV@
or
	unzip386 @DJDEV@


NOTE:   For debugging GDB version 7.11 or above is recommended.


1. Only long filenames
----------------------

Unzip the binaries with an unzip program, which can restore the long filenames
stored in the zip archive.


2. Only short filenames
-----------------------

Unzip the binaries with an unzip program which doesn't know about long
filenames, or if your unzipper knows about them, please follow first
the steps described in the DJGPP FAQ in the section
about setting the NameNumericTail to 0 __BEFORE__!!! unzipping the archives.

3. Long and short filenames at the same time
--------------------------------------------

Use an unzip program which can restore the long filenames and follow
the instructions under 2. when the unzipper knows about long filenames.

Notes for using under Windows
-----------------------------

1. Windows 10 32 bit cannot be used after 2018.03 cummulative update (KB4088776)
from Microsoft is applied. Microsoft could possibly fix this sometime in future (maybe).

2. DJGPP will NOT work under Windows when creating short file names is disabled from
Windows registry. See
   https://support.microsoft.com/en-us/help/121007/how-to-disable-8-3-file-name-creation-on-ntfs-partitions
for details. One needs to reboot after change of this setting is applied. It does not
however create short file names for files written before creating SFNs is reenabled.

3. One needs to increase max. allowed DPMI memory size in windows registry (Windows Vista SP1 and all
newer versions). Create entry REG_DWORD entry DpmiLimit with large enough value under
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WOW. Values up slightly below 2GB work for me.
No reboot required after changing or adding value. Applying Windows updates may remove DpmiLimit value from
registry. Just create it again.


Rebuilding gcc-12.2.0 from the sources
======================================

Requirements
------------

-  Long filename support. I built it in DOS session under Windows Vista Business
   32 bit SP3. Other 32 bit Windows versions beginning with Win95 should be
   hopefully OK. I have not however tested myself whether it can be build under Win95,
   Win98, Win2k or Win2K, WinXP or Win 7. Windows 10 32 bit currently cannot be used.

-  plenty of physical RAM available. I guess that 1 GB should
   be enough (I had more on build machine)

-  Much of free disk space: the total size of all directories after build
   was about 6 GB. Perhaps one need more to be safe.

-  Amount of available DPMI memory for DOS session should
   be set to auto.

-  On windows Vista (and perhaps later versions) a registry hack to
   allow DPMI clients to use more that 32 MB of memory must be used

-  DJGPP v2.05 or above

-  many GNU utilities and libraries (the list may be incomplete)

	last version of DJGPP port of bash-2.0.5b
	GNU Diffutils 3.6 or above
	GNU Fileutils-4.1
	GNU Find 4.1.7 or above
	GNU grep 2.5.1 or above
	GNU Awk 3.1.1 or above
	GNU Make 4.2 or above
	GNU Sed 4.5 or above
	GNU shell utils 2.0.11
	GNU Textutils 2.0
	GNU Texinfo 4.13 or above
	GNU tar 1.1.2 or above
	GNU binutils 2.30 (required, older versions cannot be used!!!)
	recent GNU GMP version (versions 6.1.0 and newer are OK)
        recent MPFR versions (versions 3.0.0 or newer are OK)
	recent MPC versions (versions 1.0.0 or newer are OK)
	Zlib-1.2.11 or above (Warning configure does not check for presence
	     one only gets build error later)
	working GNU C compiler (perhaps not earlier than gcc-4.4.

   Some of earlier versions may possibly work (unless exlicitly said otherwise),
   but it is not tested.

-  one may need to increase DOS transfer buffer size to 24 KB or
   32 KB for some executables (GNU Make and ld) to optimize lower
   memory use as having to allocate additional lower memory block
   for long parameter lists when invoking child process wastes
   much of memory. I had transfer buffer size increased to 24 KB
   for GNU Make only

-  INFO-ZIP binary (compiled with DJGPP v2!!!) is needed for using build.sh
   to create binary distribution archives. There is no problems to compile
   it. See http://www.info-zip.org for additional information
   about INFO-ZIP. You can find DJGPP compiled binary there.

It is required to rebuild stubify.exe with larger stack size (1.5MB is enough, the default 512KB is not).
For some versions _stklen were set directly as static variable to 1.5 MB. Unfortunately it
did not work OK in all cases (like cross-native build of DJGP port of GCC). So these tricks are no more
used.

-  Working DJGPP installation of course:
   - DJGPP v2.05 is required (earlier versions are not supported)
   - one needs to rebuild stubify.exe to increase stack size to 1.5MB
     (edit src/stub/stub.asm from djlsr205.zip and rebuild stubify.exe).
     More recent CVS version of DJGPP v2.06 is required for building Ada
     compiler

If You modify some source files You may also need
	autoconf-2.64
	automake-1.11.6
	(No ports available for DJGPP yet. I did all patching GCC sources
	and updating autoconf and automake related stuff in Linux)

-  You should have sh.exe in DJGPP bin directory as symbolic link to
   bash.exe (type 'ln -s bash.exe sh.exe' in that directory)


Extracting the sources
----------------------

At first you should unzip the archive gcc1220s.zip. The sources are _NOT_
the complete sources like the original gcc-12.2.0 distribution. I have
removed many files to save disk space which are not needed for the DJGPP
port. However I left configuration of other machines in to make archives
usable to build cross-to-DJGPP compilers and DJGPP hosted cross-compilers
(I haven't tested it).


Compiling gcc
-------------

Directory gnu/gcc-12.20 contains all sources of gcc-12.2.0

Sources are NOT configured.

Change to directory gnu/build.gcc and configure sources
by running script djconfig.sh.

	sh djconfig.sh

It is possible that building this way do not work due to too long
path names. One can move directories build.gcc, install.gcc and
gcc-12.2.0 to then top directory of drive and retry. I myself am
building DJGPP port of GCC this way (I had related trouble earlier and
I do not want to repeat attempt each time).

When this is done You can build gcc-12.2.0 by running script djmake.sh
You may use redir to get output in file.

	sh djmake.sh bootstrap

When this successfully ends run script djinsttmp.sh which installs
all into directory gnu/install.gcc

After that change to this directory and run script makepkg.sh
to create binary distribution packages

Installing newly compiled gcc
-----------------------------

It's recommended to install binary packages which are generated
by makepkg.sh



Available resources
===================

See following URL for additional information:
gcc:		  http://gcc.gnu.org



Reporting bugs
==============

If you found a bug in gcc-12.2.0 (gcc, gfortran, libstdc++, etc) please report it to
the GCC bug addresses and to the DJGPP mailing list (djgpp@delorie.com). We may not
notice bug reports sent to GCC bug reporting system only due to large amount of
other bugs there.

But if you think you found a bug in the DJGPP related things, then please
report it in comp.os.msdos.djgpp (the news group) or mail it to
djgpp@delorie.com, which is the gateway to the news group.

Some possible situations:
  - gcc says 'Internal compiler error' (or something similar)
       more likely it is error of gcc if it is reproducible. It would
       be nice to test on some other system (e.g. Linux) and also with
       different version of compiler if possible and submit report to
       gcc bug address.
  - gcc crashes or freezes.
       In this situation it's hard to guess where is the problem. It may be
       problem with gcc itself but it may be also DJGPP specific one.

Please email me directly only in rare cases, if you think it is only of
interest to me, since I'll see the reports in DJGPP mailing list.


Thanks to
=========

To all who have contributed new features, test results, bug-fixes to GCC
(see http://gcc.gnu.org/thanks.html) and also who helped with DJGPP port of
gcc-12.2.0


Have fun with gcc

Andris Pavenis <andris.pavenis@iki.fi>
