# Copyright 06 Mar 1997 Sun Microsystems, Inc. All Rights Reserved.
#
#pragma ident  "@(#)postinstall	1.13 97/03/06 Sun Microsystems"
#
#
# postinstall script for Openstep End User Libraries/Services.
#
# Return pid of named process in variable "pid"
#
# Exit codes for installation scripts

e_ok=0
e_fatal=1      # stop installation on this exit
e_warning=2    # Installation will go on.
e_int=3        # Interrupted. Stop installation
e_reboot=10    # User must reboot after installation of all selected packages
e_rebootnow=20 # User must reboot right after installation of current package
               # To be added to one of the single-digit exit codes above

#
# temporary workaround which should be removed later
#

OBJC_MULTITHREADED=1
export OBJC_MULTITHREADED

LD_LIBRARY_PATH=$BASEDIR/$DOEDIR/openstep/lib:LD_LIBRARY_PATH
export LD_LIBRARY_PATH

#
# Trap interrupt
#
trap `exit $e_int` 15
#

#


# do the following only if the package is installed
pkginfo -q $PKGINST
if [ $? -eq 0 ]
then
    if [ -f $BASEDIR/$DOEDIR/openstep/bin/precomp -a \
       ! -f $BASEDIR/$DOEDIR/openstep/include/AppKit/AppKit.p ]; then
	echo "Regenerating AppKit.p"
        $BASEDIR/$DOEDIR/openstep/bin/precomp \
	    -o $BASEDIR/$DOEDIR/openstep/include/AppKit/AppKit.p \
            -I$BASEDIR/$DOEDIR/openstep/include \
            $BASEDIR/$DOEDIR/openstep/include/AppKit/AppKit.h

        echo "Regenerating Foundation.p"
        $BASEDIR/$DOEDIR/openstep/bin/precomp \
            -o $BASEDIR/$DOEDIR/openstep/include/Foundation/Foundation.p \
            -I$BASEDIR/$DOEDIR/openstep/include \
            $BASEDIR/$DOEDIR/openstep/include/Foundation/Foundation.h

        echo "Regenerating DPSClient.p"
        $BASEDIR/$DOEDIR/openstep/bin/precomp \
	    -o $BASEDIR/$DOEDIR/openstep/include/DPSClient/DPSClient.p \
            -I$BASEDIR/$DOEDIR/openstep/include \
	    $BASEDIR/$DOEDIR/openstep/include/DPSClient/DPSClient.h

        echo "Regenerating soundkit.p"
        $BASEDIR/$DOEDIR/openstep/bin/precomp \
	    -o $BASEDIR/$DOEDIR/openstep/include/soundkit/soundkit.p \
            -I$BASEDIR/$DOEDIR/openstep/include \
	    $BASEDIR/$DOEDIR/openstep/include/soundkit/soundkit.h
    fi

    if [ ! -d $BASEDIR/$DOEDIR/openstep/Library/Fonts ]; then
          mkdir $BASEDIR/$DOEDIR/openstep/Library/Fonts
    fi

    echo "Building .fontdirectory for F3 fonts..."
 
    cd $BASEDIR/$DOEDIR/openstep/Library/Fonts 
    $BASEDIR/$DOEDIR/openstep/etc/buildafmdir -c /usr/openwin/lib/X11/fonts/F3
fi

exit $e_ok

 


