Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!ll-xn!ames!oliveb!felix!zemon
From: zemon@felix.UUCP (Art Zemon)
Newsgroups: comp.os.minix
Subject: Rebuilding libc.a under Minix
Message-ID: <3764@felix.UUCP>
Date: Thu, 23-Jul-87 16:22:20 EDT
Article-I.D.: felix.3764
Posted: Thu Jul 23 16:22:20 1987
Date-Received: Sat, 25-Jul-87 15:27:29 EDT
Sender: daemon@felix.UUCP
Reply-To: zemon@felix.UUCP (Art Zemon)
Distribution: world
Organization: FileNet Corp., Costa Mesa, CA
Lines: 85


    The following two shell scripts will rebuild libc.a from
    source running on a Minix machine.  What you need to do is
    replace the "run" shell script with mine, run it, and then
    run my "build" shell script.  You must have an existing
    /usr/lib/libc.a on-line to run build.  The old library is
    used to determine the order in which the modules will be
    installed in the new library.  New modules are inserted in
    the new library in alphabetical order followed by modules
    which existed in the old library in the old order.

    I wrote and tested this under Minix v1.2 and know it works
    there.  I think it will work under v1.1 but have not tested
    it.

    Cheers,
	-- Art Z.


========== run ==================================================
for i in *.c
do
    echo $i
    cc -c -LIB $i
done


========== build ================================================
#
# Build libc.a using all of the .s files in the current directory.
# New files are placed at the beginning of the library followed by
# modules which are already in the old library (/usr/lib/libc.a).
# Old modules are placed in the new library in the same order in which
# they appear in the old library.
#
# Art Zemon, July 17, 1987
#
echo Reading old library
ar t /usr/lib/libc.a > list
split -8 list
cat /dev/null > orig.order
echo Creating orig.order
for f in x??
do
    echo ar a libc.a `cat $f` >> orig.order
    rm $f
done

#
# Figure out which files are not in the existing library.
# Base this decision on the .c files because there are a couple of .s
# files here which don't belong in the library.
#
echo Checking .c files
cat /dev/null > new.files
for c in *.c
do
    f=`basename $c .c`.s
    echo $f
    if grep -s $f list > /dev/null 2>&1 ; then cat /dev/null ; else echo ar av libc.a $f >> new.files ; fi
done

#
# Figure out which modules are in the library but not here and extract them
# from the library.
#
echo determining which modules must be extracted from old library
rm -f libc.a
sh orig.order > /dev/null 2> missing
ar xv /usr/lib/libc.a `grep 'Cannot find ' missing | gres 'Cannot find ' ''`
rm missing libc.a list

#
# Construct the library
#
echo constructing new library with new modules
sh new.files
echo appending original modules to new library
sh orig.order
echo done
--
	-- Art Zemon
	   FileNet Corporation
	   Costa Mesa, California
	   ...!hplabs!felix!zemon