10Sstevel@tonic-gate#!/bin/sh 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 61618Srie# Common Development and Distribution License (the "License"). 71618Srie# You may not use this file except in compliance with the License. 80Sstevel@tonic-gate# 90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate# See the License for the specific language governing permissions 120Sstevel@tonic-gate# and limitations under the License. 130Sstevel@tonic-gate# 140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate# 200Sstevel@tonic-gate# CDDL HEADER END 210Sstevel@tonic-gate# 221618Srie 230Sstevel@tonic-gate# 244063Sab196087# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 250Sstevel@tonic-gate# Use is subject to license terms. 260Sstevel@tonic-gate# 270Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate# 290Sstevel@tonic-gate# Generate a proto area suitable for the current architecture ($(MACH)) 300Sstevel@tonic-gate# sufficient to support the sgs build. 310Sstevel@tonic-gate# 320Sstevel@tonic-gate# Currently, the following releases are supported: 33*5324Srie# 5.11, 5.10, and 5.9. 340Sstevel@tonic-gate# 350Sstevel@tonic-gate 360Sstevel@tonic-gateif [ "X$CODEMGR_WS" = "X" -o "X$MACH" = "X" ] ; then 37*5324Srie echo "usage: CODEMGR_WS and MACH environment variables must be set" 380Sstevel@tonic-gate exit 1 390Sstevel@tonic-gatefi 400Sstevel@tonic-gate 41*5324SrieRELEASE=$1 42*5324Srie 43*5324Srieif [ "X$RELEASE" = "X" ] ; then 44*5324Srie echo "usage: proto release" 45*5324Srie exit 1; 46*5324Sriefi 47*5324Srie 48*5324SrieIS_THIS_UNIFIED=1 49*5324Srie 50*5324Sriecase $RELEASE in 51*5324Srie "5.11") break;; 52*5324Srie "5.10") break;; 53*5324Srie "5.9") IS_THIS_UNIFIED=0; break;; 54*5324Srie *) 55*5324Srie echo "usage: unsupported release $RELEASE specified" 56*5324Srie exit 1;; 57*5324Srieesac 58*5324Srie 590Sstevel@tonic-gatedirs=" $CODEMGR_WS/proto \ 600Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH \ 610Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/lib \ 620Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr \ 630Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/demo \ 640Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib \ 650Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/abi \ 660Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/link_audit \ 670Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/mdb \ 680Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/mdb/proc \ 690Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/pics \ 700Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/4lib \ 710Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/bin \ 720Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/ccs \ 730Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/ccs/bin \ 740Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/include \ 750Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/include/sys \ 760Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/xpg4 \ 770Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/xpg4/bin \ 780Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/etc \ 790Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/etc/lib \ 800Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt \ 810Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld \ 820Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/bin \ 830Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/doc \ 840Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/lib \ 850Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man \ 860Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man1 \ 870Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man1l \ 880Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man3t \ 890Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man3l \ 900Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man3x" 910Sstevel@tonic-gate 920Sstevel@tonic-gate# 930Sstevel@tonic-gate# Add 64bit directories 940Sstevel@tonic-gate# 950Sstevel@tonic-gateMACH64="" 960Sstevel@tonic-gateif [ $MACH = "sparc" ]; then 970Sstevel@tonic-gate MACH64="sparcv9"; 980Sstevel@tonic-gatefi 990Sstevel@tonic-gateif [ $MACH = "i386" ]; then 1000Sstevel@tonic-gate MACH64="amd64"; 1010Sstevel@tonic-gatefi 1020Sstevel@tonic-gateif [ "${MACH64}x" != x ]; then 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate dirs="$dirs \ 1050Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/lib/$MACH64 \ 1060Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/bin/$MACH64 \ 1070Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/ccs/bin/$MACH64 \ 1080Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/$MACH64 \ 1090Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/abi/$MACH64 \ 1100Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/link_audit/$MACH64 \ 1110Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/mdb/proc/$MACH64 \ 1120Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/usr/lib/pics/$MACH64 \ 1130Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/bin/$MACH64 \ 1140Sstevel@tonic-gate $CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/lib/$MACH64 \ 1150Sstevel@tonic-gate " 1160Sstevel@tonic-gatefi 1170Sstevel@tonic-gate 1180Sstevel@tonic-gatefor dir in `echo $dirs` 1190Sstevel@tonic-gatedo 1200Sstevel@tonic-gate if [ ! -d $dir ] ; then 1210Sstevel@tonic-gate echo $dir 1220Sstevel@tonic-gate mkdir $dir 1230Sstevel@tonic-gate chmod 777 $dir 1240Sstevel@tonic-gate fi 1250Sstevel@tonic-gatedone 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate# We need a local copy of libc_pic.a (we should get this from the parent 1280Sstevel@tonic-gate# workspace, but as we can't be sure how the proto area is constructed there 1294192Srie# simply take it from a stashed copy on the linkers server. If 1304192Srie# LINKERS_EXPORT is defined, we use it. Failing that, we fall over 1314192Srie# to linkers.central. 1324192Srieif [ "$LINKERS_EXPORT" = "" ]; then 1334192Srie LINKERS_EXPORT=/net/linkers.central/export 1344063Sab196087fi 1350Sstevel@tonic-gate 1360Sstevel@tonic-gateif [ $MACH = "sparc" ]; then 1370Sstevel@tonic-gate PLATS="sparc sparcv9" 1380Sstevel@tonic-gateelif [ $MACH = "i386" ]; then 1390Sstevel@tonic-gate PLATS="i386 amd64" 1400Sstevel@tonic-gateelse 1410Sstevel@tonic-gate echo "Unknown Mach: $MACH - no libc_pic.a provided!" 1420Sstevel@tonic-gate PLATS="" 1430Sstevel@tonic-gatefi 1440Sstevel@tonic-gate 1450Sstevel@tonic-gatefor p in $PLATS 1460Sstevel@tonic-gatedo 1470Sstevel@tonic-gate SRCLIBCDIR=${SRC}/lib/libc/$p 1480Sstevel@tonic-gate if [ ! -d $SRCLIBCDIR ]; then 1490Sstevel@tonic-gate mkdir -p $SRCLIBCDIR 1500Sstevel@tonic-gate fi 1510Sstevel@tonic-gate if [ ! -f $SRCLIBCDIR/libc_pic.a ]; then 1524192Srie cp $LINKERS_EXPORT/big/libc_pic/$RELEASE/$p/libc_pic.a \ 1534192Srie $SRCLIBCDIR 1540Sstevel@tonic-gate fi 1550Sstevel@tonic-gatedone 1560Sstevel@tonic-gate 1571618SrieSYSLIB=$CODEMGR_WS/proto/root_$MACH/lib 1580Sstevel@tonic-gateUSRLIB=$CODEMGR_WS/proto/root_$MACH/usr/lib 1590Sstevel@tonic-gate 1600Sstevel@tonic-gateif [ ! -h $USRLIB/ld.so.1 ]; then 1610Sstevel@tonic-gate rm -f $USRLIB/ld.so.1 1620Sstevel@tonic-gate ln -s ../../lib/ld.so.1 $USRLIB/ld.so.1 1630Sstevel@tonic-gate echo "$USRLIB/ld.so.1 -> ../../lib/ld.so.1" 1640Sstevel@tonic-gatefi 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate# 1670Sstevel@tonic-gate# In addition create some 64 symlinks so that dependencies referenced 1680Sstevel@tonic-gate# from our test environment will map back to the appropriate libraries. 1690Sstevel@tonic-gate# 1701618Srieif [ ! -h $SYSLIB/64 ] ; then 1711618Srie rm -f $SYSLIB/64 1721618Srie ln -s $MACH64 $SYSLIB/64 1731618Srie echo "$SYSLIB/64 -> $SYSLIB/$MACH64" 1741618Sriefi 1751618Srieif [ ! -h $USRLIB/64 ] ; then 1761618Srie rm -f $USRLIB/64 1771618Srie ln -s $MACH64 $USRLIB/64 1781618Srie echo "$USRLIB/64 -> $USRLIB/$MACH64" 1790Sstevel@tonic-gatefi 1801618Srieif [ ! -h $USRLIB/link_audit/64 ] ; then 1811618Srie rm -f $USRLIB/link_audit/64 1821618Srie ln -s $MACH64 $USRLIB/link_audit/64 1831618Srie echo "$USRLIB/link_audit/64 -> $USRLIB/link_audit/$MACH64" 1841618Sriefi 1851618Srieif [ ! -h $USRLIB/64/ld.so.1 ]; then 1861618Srie rm -f $USRLIB/64/ld.so.1 1871618Srie ln -s ../../../lib/64/ld.so.1 $USRLIB/64/ld.so.1 1881618Srie echo "$USRLIB/64/ld.so.1 -> ../../../lib/64/ld.so.1" 1891618Sriefi 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate# 1920Sstevel@tonic-gate# 1930Sstevel@tonic-gate# 1940Sstevel@tonic-gateif [ $IS_THIS_UNIFIED = 0 ] ; then 1950Sstevel@tonic-gate rm -fr $CODEMGR_WS/proto/root_$MACH/lib 1960Sstevel@tonic-gate ln -s $CODEMGR_WS/proto/root_$MACH/usr/lib $CODEMGR_WS/proto/root_$MACH/lib 1970Sstevel@tonic-gatefi 198