#!/bin/sh
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"@(#)postinstall	1.3	04/12/07 SMI"
#
# generate fixed header files after gcc instllation
#
# output location is:
#
# $BASEDIR/usr/sfw/lib/gcc/${GCCARCH}/${GCCVER)/include
#
# where GCCARCH=i386-pc-solaris2.10 or 
# and GCCVER is the current GCC version
#

GCCVER=3.4.3

case "$ARCH" in
sparc)	GCCARCH=sparc-sun-solaris2.10
	;;
i386)	GCCARCH=i386-pc-solaris2.10
	;;
*)	echo "$ARCH is unknown"
	exit 2
	;;
esac
	
FIXINCDIR=$BASEDIR/usr/sfw/libexec/gcc/$GCCARCH/$GCCVER/install-tools
FIXINC=fixinc.sh
HDRSRC=$BASEDIR/usr/include
HDRTARG=$BASEDIR/usr/sfw/lib/gcc/$GCCARCH/$GCCVER/include

TARGET_MACHINE=$ARCH; export TARGET_MACHINE

cd $FIXINCDIR

./$FIXINC $HDRTARG $HDRSRC >/dev/null 2>&1

find $HDRTARG -exec chown root:bin {} \;
find $HDRTARG -type d -exec chmod 755 {} \;
find $HDRTARG -type f -exec chmod 444 {} \;

exit 0
