xref: /onnv-gate/usr/src/tools/scripts/mkclosed.sh (revision 5198:a4512bf4070e)
1#! /usr/bin/ksh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27# ident	"%Z%%M%	%I%	%E% SMI"
28#
29
30#
31# Generate a minimal set of closed binaries from a proto area.  Useful
32# when building just the open tree.
33#
34
35usage="mkclosed isa root closed-root"
36
37if [ $# -ne 3 ]; then
38	print -u2 "usage: $usage"
39	exit 1
40fi
41
42isa=$1
43case "$isa" in
44i386)	plat64=amd64;;
45sparc)	plat64=sparcv9;;
46*)	print -u2 "unknown isa: $isa"
47	exit 1
48	;;
49esac
50
51protoroot=$2
52closedroot=$3
53
54#
55# Make closedroot an absolute path if it isn't already.  This is
56# needed for the cpio invocation below.
57#
58[[ $closedroot = /* ]] || closedroot=`pwd`/$closedroot
59
60# Check arguments before modifying filesystem.
61cd $protoroot || exit 1
62
63mkdir -p $closedroot || exit 1
64
65#
66# Copy files from the proto area to the new closed tree.  We use cpio
67# rather than a tar pipeline to make it easier to detect errors.
68#
69# We need /lib/libc_i18n.a & /lib/{sparcv9,amd64}/libc_i18n.a
70#
71
72mkdir -p $closedroot/lib/$plat64
73cp lib/libc_i18n.a $closedroot/lib
74cp lib/$plat64/libc_i18n.a $closedroot/lib/$plat64
75