This directory contains all of the source code that made its way into the
GNU Tools package. Each directory has a script called OSDBUILD in it.
To reproduce the first draft of the distribution tree, perform the
following steps:

1) Create a temporary directory that will hold the build, source, custom
   and distribution directories. For example, /u/gnu. Set an environment
   variable to that directory (absolute path) called GNUROOT. Under this
   directory, make a directory gnutools, and set GNUCDMT to that directory.
   Under $GNUCDMT, make a directory called dist. Set the variable GNUDIST
   to that directory. Under $GNUROOT make a directory called build, and
   create a linked source tree to that directory. Use the lndir command
   from XFree86 if you have it installed, or you can use cpio.
   For example, lets suppose you extracted the source archive in /u/tmp.
   It will have created a directory called gnutools-MM.NN.PPpp, for
   example, gnutools-5.0.7i. Lets say you'll be building in /u/gnu:
   mkdir /u/gnu
   mkdir /u/gnu/gnutools
   mkdir /u/gnu/gnutools/dist
   mkdir /u/gnu/gnutools/input
   mkdir /u/gnu/build
   GNUROOT=/u/gnu; export GNUROOT
   GNUCDMT=$GNUROOT/gnutools; export GNUCDMT
   GNUDIST=$GNUCDMT/dist; export GNUDIST
   /usr/X11R6/bin/lndir /u/tmp/gnutools-5.0.7i $GNUROOT/build
           or
   cd /u/tmp/gnutools-5.0.7i; find . |cpio -pdvl $GNUROOT/build

2) For each directory here, change to it and run OSDBUILD. Then run gmake.
   After the build has completed, run gmake check to see if things worked
   out the way you think they should. Some directories cannot run the
   regression tests without DejaGNU installed. Once you are satisfied,
   make a package directory in $GNUDIST, for example mkdir $GNUDIST/gcc, and
   run gmake install DESTDIR=$GNUDIST/gcc (or whatever package directory
   you made for the package).
3) Thats it. You will now have a starting distribution tree in $GNUDIST.
   Examine this directory carefully, make any links you feel appropriate,
   gzip -9 the info pages, pre-format the man pages and compress both
   the man source and formatted ones with compress (NOT gzip) and
   generally make sure the tree looks to be in good shape. Now make a
   list of custom packages and do the CDMT thing on them.

For example, you can use the following script (I do) to do it all for you.
Run this at the very top of the build directory, i.e $GNUROOT/build:

#! /bin/sh
if [ -z "$GNUDIST" ]; then
  echo "ERROR: GNUDIST environment variable not set"
  exit 1
fi

if [ -z "$GNUCDMT" ]; then
  echo "ERROR: GNUCDMT environment variable not set"
  exit 1
fi

if [ ! -d $GNUDIST ]; then
  echo "ERROR: \$GNUDIST does not point to a directory"
  exit 1
fi

if [ ! -d $GNUCDMT ]; then
  echo "ERROR: \$GNUCDMT does not point to a directory"
  exit 1
fi

if [ ! -d LOGS ]; then
  mkdir LOGS
fi

LOGDIR=`pwd`/LOGS
BASEDIR=`pwd`

for subdir in [a-z]*; do
  echo "sub-directory $subdir ... \c"
  cd $subdir
  sh ./OSDBUILD > $LOGDIR/${subdir}.conflog 2>&1
  touch ${LOGDIR}/${subdir}.bad
  if [ $? -ne 0 ]; then
    echo ""
    echo "ERROR: Configuration in $subdir failed!"
  else
    echo "configured ... \c"
    case $subdir in
      gcc-*) mkargs=bootstrap ;;
      *)     mkargs= ;;
    esac
    gmake $mkargs > $LOGDIR/${subdir}.build 2>&1
    if [ $? -ne 0 ]; then
      echo ""
      echo "ERROR: Build in $subdir failed!"
    else
      echo "built ... \c"
      if [ ! -d ${GNUDIST}/${subdir} ]; then
        mkdir ${GNUDIST}/${subdir}
      else
        pfx=$subdir
	mkdir ${GNUDIST}/${subdir}
      fi
      gmake install DESTDIR=${GNUDIST}/${subdir} > $LOGDIR/${subdir}.inst 2>&1
      if [ $? -ne 0 ]; then
        echo ""
        echo "ERROR: Install in $subdir failed!"
      else
        echo "installed"
        rm ${LOGDIR}/${subdir}.bad
      fi
    fi
  fi
  cd $BASEDIR
done

echo "All done. Review logs in $LOGDIR"

The script is not perfect but it helps.

Changed Files / Updating in the future
======================================

If you want to update a package in the future, be sure to check for any
*.osd files in the directory in question. If they havent accepted or applied
these patches in the new version yet, you may need to repeat the changes.

Things to look out for when making a package
============================================

Some files are repeated. For example, libiberty.a, libbfd.a and a few others
appear in more than one package. I suggest keeping the one from the binutils
package. Another file that is repeated is the info/dir file. This file should
not be shipped at all. Rather, the ccs script should call install-info, which
is part of GWXLIBS. However, install-info appears here as well, in the
texinfo package. This latest version, compiled here, should be saved aside for
inclusion into the next revision of GWXLIBS. However, the way it is configured
in this tree its called "ginstall-info" so if you really want to keep the
package complete, keep that name in the GNU package, just dont create a
link to install-info. I do, however, recommend that you update the GWXLIBS
package, which tends to be needed fairly frequently anyway. Both gcc and
binutils provide c++filt. Use the one from gcc, and remember to remove
gc++filt from the binutils package too.

The following shell script is useful to run in the root of the dist
directory ($GNUDIST) to produce a list of files that are duplicated
and in which package:

#! /bin/sh
FILE1=/tmp/fl1.$$
FILE2=/tmp/fl2.$$
find . ! -type d | sort -t '/' -k 3, > $FILE1
find . ! -type d | sort -u -t '/' -k 3, > $FILE2
for file in `diff -c $FILE1 $FILE2 | sed -n -e 's,^- .*/usr,/usr,p' | sort -u`; do
  PKGS=`grep $file $FILE1 | sed -e 's,\./\(.*\)/usr/.*,\1,' | sort -u | tr '\n' ' '`
  echo "$file:$PKGS"
done
rm -f $FILE1 $FILE2

This script produces the following output in version 5.0.7i of gnutools:
/usr/gnu/bin/aclocal:automake automake14 
/usr/gnu/bin/automake:automake automake14 
/usr/gnu/include/ansidecl.h:binutils gdb 
/usr/gnu/include/bfd.h:binutils gdb 
/usr/gnu/include/bfdlink.h:binutils gdb 
/usr/gnu/include/dis-asm.h:binutils gdb 
/usr/gnu/include/symcat.h:binutils gdb 
/usr/gnu/info/bfd.info:binutils gdb 
/usr/gnu/info/bfd.info-1:binutils gdb 
/usr/gnu/info/bfd.info-2:binutils gdb 
/usr/gnu/info/bfd.info-3:binutils gdb 
/usr/gnu/info/bfd.info-4:binutils gdb 
/usr/gnu/info/bfd.info-5:binutils gdb 
/usr/gnu/info/bfd.info-6:binutils gdb 
/usr/gnu/info/bfd.info-7:binutils gdb 
/usr/gnu/info/bfd.info-8:binutils gdb 
/usr/gnu/info/bfd.info-9:binutils gdb 
/usr/gnu/info/configure.info:binutils gdb 
/usr/gnu/info/configure.info-1:binutils gdb 
/usr/gnu/info/configure.info-2:binutils gdb 
/usr/gnu/info/configure.info-3:binutils gdb 
/usr/gnu/info/dir:automake automake14 bc binutils bison coreutils cvs diffutils gawk gcc gdb groff indent jwhois libtool make sed tar texinfo 
/usr/gnu/info/standards.info:autoconf binutils gdb 
/usr/gnu/lib/charset.alias:coreutils jwhois 
/usr/gnu/lib/libbfd.a:binutils gdb 
/usr/gnu/lib/libbfd.la:binutils gdb 
/usr/gnu/lib/libiberty.a:binutils gcc gdb 
/usr/gnu/lib/libopcodes.a:binutils gdb 
/usr/gnu/lib/libopcodes.la:binutils gdb 
/usr/gnu/share/locale/da/LC_MESSAGES/opcodes.mo:binutils gdb 
/usr/gnu/share/locale/de/LC_MESSAGES/opcodes.mo:binutils gdb 
/usr/gnu/share/locale/es/LC_MESSAGES/bfd.mo:binutils gdb 
/usr/gnu/share/locale/es/LC_MESSAGES/opcodes.mo:binutils gdb 
/usr/gnu/share/locale/fr/LC_MESSAGES/bfd.mo:binutils gdb 
/usr/gnu/share/locale/fr/LC_MESSAGES/opcodes.mo:binutils gdb 
/usr/gnu/share/locale/id/LC_MESSAGES/opcodes.mo:binutils gdb 
/usr/gnu/share/locale/ja/LC_MESSAGES/bfd.mo:binutils gdb 
/usr/gnu/share/locale/pt_BR/LC_MESSAGES/opcodes.mo:binutils gdb 
/usr/gnu/share/locale/sv/LC_MESSAGES/bfd.mo:binutils gdb 
/usr/gnu/share/locale/sv/LC_MESSAGES/opcodes.mo:binutils gdb 
/usr/gnu/share/locale/tr/LC_MESSAGES/bfd.mo:binutils gdb 
/usr/gnu/share/locale/tr/LC_MESSAGES/opcodes.mo:binutils gdb 

As you can see, most of the duplicates arise from the same files being
installed in both GDB and BINUTILS. I usually use the ones from binutils.
The texinfo dir file is in almost all the packages. Remove it from all
of them, it should be created by the ccs script. The duplicates in
autoconf and automake are becuase there are two versions. In the automake14
directory, rename aclocal to aclocal14, an automake to automake14.

There are duplicates of charset.alias and locale.alias as well. Remove all
references to these files, not just the duplicates. They are provided in
the gwxlibs package by GNU gettext.

GCC has some funky weirdness with two libraries. In the path usr/gnu/lib
you will see libstdc++.a.SOMEVERSION and pic/libstdc++.a.SOMEVERSION. Deep
down in usr/gnu/lib/gcc-lib/i586-pc-sco3.2v5.0/2.95.3 you will see that
libstdc++.a is a symlink to it, and pic/libstdc++.a is a symlink to the
PIC one. Remove those links and move the files from gnu/lib to */2.95.3/.
For example, remove */2.95.3/libstdc++.a and mv lib/libstdc++.a.SOMEVERSION
*/2.95.3/libstdc++.a.

GCC is configured to use the GNU assembler. When you create the package
make sure that gcc has a dependency on the binutils package. You also
want to make links from c++, g++, cpp, g77 and gcj and gcjh to
i586-pc-sco3.2v5.0-*. The gcc front-end already installs with that link.

Convert all hard links to symbolic links, making sure you use the most
version-specific name of the file as the raw file. Have all others
symlink to it. This will help the mkcdmt package. That package will
harden them back to hardlinks if you use the -h option (suggested).

The binutils version of strip is *BAD NEWS*. Remove it, in any guise. You
will find the main binary in usr/gnu/bin/gstrip and a link to it in
usr/gnu/i586-pc-sco3.2v5.0/bin/strip. Since gcc is configured to use
DWARF-2 now, you should use the latest top-of-tree strip from SCO.
The original strip can't handle DWARF2.

Almost all files install with the 'g' prefix. Usually you link those to
ones without the 'g' prefix. For example, gobjcopy links to objcopy.
Ones to specifically NOT do it for are gar and granlib.

Remember to pre-format and compress all man pages and their source.
I use the handy reman utility I wrote. Source code to that at the end
of this document. Make sure all info files are compressed with gzip -9.

For all locale directories in usr/gnu/share/locale, make sure there is
a symbolic link from language/LC_MESSAGES to language/LC_TIME. You MUST
make sure that this hasn't already been done for a given directory
in the GWXLIBS package, else you will have a conflict. It is best to do
this in the ccs script rather than creating actual custom entries for
the links. Make sure you remove them too, but only if the directory is
empty (the LC_MESSAGES directory for that language).

Some packages already contain symlinks into the LC_TIME directory. You
should remove those directories and rely on the CCS script creating a
symlink for the whole directory. coreutils is the biggest culprint.
In $GNUDIST do: find . -type d -a -name LC_TIME|xargs rm -fr

Make sure that 'guptime' and gmake are setgid mem.

Make sure all binaries, archives and objects have been stripped
and mcs -d.

Remove the libtool libltdl* stuff. Its provided in gwxlibs. This includes
the header file.

In the gcc headers directory (usr/gnu/lib/gcc-lib/*/*/include) edit
the math.h file and protect the macros around __builtin_generic
with #ifndef __GNUC__.

The next step is to create the actual custom data files. Use my handy
mkcdmt program and point it at $GNUDIST. GROFF causes a weirdness in
the tool. Its "/usr/gnu/share/groff/1.18.1/eign" file tries to be a
symlink to /usr/lib/eign. When realpath() used in mkcdmt resolves the
path, it resolves it into SSO land. Therefore, remove this file from the
dist directory and handle it in the CCS script.

I used the file gnutools.mkcdmt as input to create the current gnutools
product, with the following arguments to mkcdmt:
mkcdmt -d $GNUCDMT -P gnutools -D "GNU Development Tools" -V5.0.7i \
    -C -p gnutools.mkcdmt

In order for this to work correctly you will need a few extra files.
See the directory GNUTOOLS. The control script gnutools.mkcdmt takes
care of just about everything for you though. Its in GNUTOOLS.

