🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #821

REPOST: Using gcc with UCB stuff on Solaris 2.x (solution)

#821
From: Casper H.S. Dik
Date: Thu, 07 Jan 1993 09:11
179 lines
5917 bytes
Oops. By mistake I posted a very old version of this script that
will only work for the cygnus distribution.
(That what you get when you post from your 4.x machine while you
work on a 2.,1 machine)

Don't use that version!!

And now for the original post:

Since there are programs that won't compile without the BSD
compatibility stuff, I configure a version of gcc that uses /usr/ucbinclude
and the proper libs for UCB compatibility.

The script at the end of this message will install /usr/ucb/gcc and
$GNUBIN/ucbgcc. Alternatively you can call gcc as ``gcc -bsd''.

The script has been tested with cygnus-2.0.2 and gcc 2.3.[23] on Solaris 2.1
It will not modify the existing gcc installation, it will only
add to it.

You will need a version of fixinc.svr4 handy when running this script
and you must have gcc in your $PATH.

Usage:
        cygnus-2.0.2:
            ./mkucbgcc 
        gcc-2.3.[23]
            ./mkucbgcc <gcc-src-directory>

Casper

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  mkucbgcc
# Wrapped by casper@fwi.uva.nl on Thu Jan  7 10:07:52 1993
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'mkucbgcc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mkucbgcc'\"
else
echo shar: Extracting \"'mkucbgcc'\" \(3253 characters\)
sed "s/^X//" >'mkucbgcc' <<'END_OF_FILE'
X#!/bin/sh
X#
X# Script to make a version of gcc that uses the BSD environment.
X# It will create the following files:
X# 	/usr/ucb/gcc
X# 	$GNUBIN/ucbgcc
X# And will create a directory
X#	$GNU/lib/gcc-lib/sparc-sun-solaris2-bsd/$version
X# that contains
X#	hardlinks to every file from sparc-sun-solaris2
X#	ucbinclude: a directory with fixed include files from /usr/ucbinclude
X#	a specs file that will use these new include files before the SysV ones
X#
X# Use of this C compiler:
X#	/usr/ucb/gcc
X#	ucbgcc
X#	gcc -bsd
X#
X# If you don't have cygnus-bin installed, you'll need to give a path to
X# your gcc source directory because mkucbgcc needs fixinc.svr4.
X#
X# This script has been tested with:
X#	cygnus-2.0.2
X#	gcc 2.3.2 and 2.3.3
X# on Solaris 2.1
X#
X# Author: Casper Dik (casper@fwi.uva.nl)
X#
XPATH=/bin:$PATH
Xexport PATH
X
Xecho Installing gcc for ucb environment.
Xspecs=`gcc -v 2>&1 |awk '$2 == "specs" { print $4 }' `
Xif [ `basename $specs` != specs -o ! -f $specs ]
Xthen
X    echo 1>&2 "Can't locate gcc or specs file"
X    exit 1
Xfi
X
X# The specs file lives in <root>/lib/gcc-lib/<mach>/<version>/specs
Xsvrpath=`dirname $specs`
Xversion=`basename $svrpath`
Xtmp=`dirname $svrpath`
Xmach=`basename $tmp`
Xtmp=`dirname $tmp`
Xif [ gcc-lib != `basename $tmp` ]
Xthen
X    echo 1>&2 "Oops, path to specs file is not what I expect"
X    exit 1
Xfi
Xtmp=`dirname $tmp`
X
Xroot=`dirname $tmp`
X
X# Not sure about the fixinc.svr4 bit.
Xif [ x"$1" != x ]
Xthen
X    fixinc="$1"/fixinc.svr4
X    if [ ! -d "$1" ]
X    then
X	echo 1>&2 "$1: not a directory"
X	exit 1
X    fi
X    if [ ! -x $fixinc -o ! -f $fixinc ]
X    then
X	echo 1>&2 "$fixinc: Can't execute"
X	exit 1
X    fi
Xelif [ -f $root/lib/fixincludes -a `expr $version : cygnus` != 0 ]
Xthen
X    fixinc=$root/lib/fixincludes 
Xelse
X    echo 1>&2 "Usage: $0 <gcc-src-directory> (for fixinc.svr4)"
X    exit 1
Xfi
X
Xif [ lib != `basename $tmp` ]
Xthen
X    echo 1>&2 "Oops, path to specs file is not what I expect"
X    exit 1
Xfi
Xif [ cygnus-2.0.2 != $version -a 2.3.2 != $version -a 2.3.3 != $version ]
Xthen
X    echo 1>&2 "Caveat: not tested for all versions of gcc."
Xfi
X
Xucbpath=$root/lib/gcc-lib/$mach-bsd/$version
X
Xecho Making directory structure.
Xrm -rf $ucbpath/ucbinclude
Xrm -f $ucbpath/*
Xmkdir -p $ucbpath/ucbinclude
X# Link for gcc -bsd
Xrm -f $root/lib/gcc-lib/sd
Xln -s $mach-bsd $root/lib/gcc-lib/sd
X
Xecho Making links.
Xecho "Expect complaint: \`\`ln: <$svrpath/include> directory''"
Xln $svrpath/* $ucbpath
Xset -e
Xrm $ucbpath/specs
Xecho "Updating specs file."
Xsed -e "/^\*cpp:$/N;s%cpp:\n%&-I$root/lib/gcc-lib/$mach-bsd/$version/ucbinclude -I/usr/ucbinclude %"\
X    -e "/^\*lib:$/N;s%lib:\n%&-lucb -lsocket -lnsl -lelf -laio %"\
X    -e "/^\*link:$/N;s%link:.*$%& -R /usr/ucblib%"\
X    -e "s%Y P,%&/usr/ucblib:%g" < $svrpath/specs > $ucbpath/specs
X
Xcp $svrpath/include/*.h $ucbpath/ucbinclude
X
Xecho Running fixincludes. This may take some time. Output in /tmp/fixincludes.log
Xecho Expect complaint from fixincludes about byteorder.h
X$fixinc $ucbpath/ucbinclude /usr/ucbinclude > /tmp/fixincludes.log < /dev/null
X
X
Xrm -f /usr/ucb/gcc $root/bin/ucbgcc
Xln -s $root/bin/ucbgcc /usr/ucb/gcc
Xcat > $root/bin/ucbgcc << !
X#!/bin/sh
Xexec $root/bin/gcc -b $mach-bsd "\$@"
X!
Xchmod 755 $root/bin/ucbgcc
X
Xecho Installation of /usr/ucb/gcc successfull.
Xexit 0
END_OF_FILE
if test 3253 -ne `wc -c <'mkucbgcc'`; then
    echo shar: \"'mkucbgcc'\" unpacked with wrong size!
fi
chmod +x 'mkucbgcc'
# end of 'mkucbgcc'
fi
echo shar: End of shell archive.
exit 0
Technical Details
Message-ID: <1993Jan7.091150.23465@fwi.uva.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!fwi.uva.nl!casper

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!fwi.uva.nl!casper
From: casper@fwi.uva.nl (Casper H.S. Dik)
Subject: REPOST: Using gcc with UCB stuff on Solaris 2.x (solution)
Message-ID: <1993Jan7.091150.23465@fwi.uva.nl>
Summary: Script to create a version of gcc for the UCB environment
Keywords: solaris, bsd, gcc, ucb
Sender: news@fwi.uva.nl
Nntp-Posting-Host: adam.fwi.uva.nl
Organization: FWI, University of Amsterdam
Date: Thu, 7 Jan 1993 09:11:50 GMT
Lines: 179