1*5eb667acSRobert Mustacchi#
2*5eb667acSRobert Mustacchi# CDDL HEADER START
3*5eb667acSRobert Mustacchi#
4*5eb667acSRobert Mustacchi# The contents of this file are subject to the terms of the
5*5eb667acSRobert Mustacchi# Common Development and Distribution License (the "License").
6*5eb667acSRobert Mustacchi# You may not use this file except in compliance with the License.
7*5eb667acSRobert Mustacchi#
8*5eb667acSRobert Mustacchi# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*5eb667acSRobert Mustacchi# or http://www.opensolaris.org/os/licensing.
10*5eb667acSRobert Mustacchi# See the License for the specific language governing permissions
11*5eb667acSRobert Mustacchi# and limitations under the License.
12*5eb667acSRobert Mustacchi#
13*5eb667acSRobert Mustacchi# When distributing Covered Code, include this CDDL HEADER in each
14*5eb667acSRobert Mustacchi# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*5eb667acSRobert Mustacchi# If applicable, add the following below this CDDL HEADER, with the
16*5eb667acSRobert Mustacchi# fields enclosed by brackets "[]" replaced with your own identifying
17*5eb667acSRobert Mustacchi# information: Portions Copyright [yyyy] [name of copyright owner]
18*5eb667acSRobert Mustacchi#
19*5eb667acSRobert Mustacchi# CDDL HEADER END
20*5eb667acSRobert Mustacchi#
21*5eb667acSRobert Mustacchi
22*5eb667acSRobert Mustacchi#
23*5eb667acSRobert Mustacchi# Copyright (c) 2011, Joyent Inc. All rights reserved.
24*5eb667acSRobert Mustacchi# Use is subject to license terms.
25*5eb667acSRobert Mustacchi#
26*5eb667acSRobert Mustacchi
27*5eb667acSRobert Mustacchi#
28*5eb667acSRobert Mustacchi# Test to catch that we properly look for libraries dependencies in
29*5eb667acSRobert Mustacchi# our full library parth
30*5eb667acSRobert Mustacchi#
31*5eb667acSRobert Mustacchi
32*5eb667acSRobert Mustacchiif [ $# != 1 ]; then
33*5eb667acSRobert Mustacchi	echo expected one argument: '<'dtrace-path'>'
34*5eb667acSRobert Mustacchi	exit 2
35*5eb667acSRobert Mustacchifi
36*5eb667acSRobert Mustacchi
37*5eb667acSRobert Mustacchilibdira=${TMPDIR:-/tmp}/libdepa.$$
38*5eb667acSRobert Mustacchilibdirb=${TMPDIR:-/tmp}/libdepb.$$
39*5eb667acSRobert Mustacchilibdirc=${TMPDIR:-/tmp}/libdepc.$$
40*5eb667acSRobert Mustacchidtrace=$1
41*5eb667acSRobert Mustacchi
42*5eb667acSRobert Mustacchisetup_libs()
43*5eb667acSRobert Mustacchi{
44*5eb667acSRobert Mustacchi        mkdir $libdira
45*5eb667acSRobert Mustacchi        mkdir $libdirb
46*5eb667acSRobert Mustacchi        mkdir $libdirc
47*5eb667acSRobert Mustacchi        cat > $libdira/liba.$$.d <<EOF
48*5eb667acSRobert Mustacchi#pragma D depends_on library libb.$$.d
49*5eb667acSRobert Mustacchi#pragma D depends_on library libc.$$.d
50*5eb667acSRobert Mustacchi#pragma D depends_on library libd.$$.d
51*5eb667acSRobert MustacchiEOF
52*5eb667acSRobert Mustacchi        cat > $libdirb/libb.$$.d <<EOF
53*5eb667acSRobert Mustacchi#pragma D depends_on library libc.$$.d
54*5eb667acSRobert MustacchiEOF
55*5eb667acSRobert Mustacchi        cat > $libdirb/libc.$$.d <<EOF
56*5eb667acSRobert MustacchiEOF
57*5eb667acSRobert Mustacchi        cat > $libdirb/libd.$$.d <<EOF
58*5eb667acSRobert MustacchiEOF
59*5eb667acSRobert Mustacchi        cat > $libdirc/libe.$$.d <<EOF
60*5eb667acSRobert Mustacchi#pragma D depends_on library liba.$$.d
61*5eb667acSRobert MustacchiEOF
62*5eb667acSRobert Mustacchi        cat > $libdirc/libf.$$.d <<EOF
63*5eb667acSRobert MustacchiEOF
64*5eb667acSRobert Mustacchi}
65*5eb667acSRobert Mustacchi
66*5eb667acSRobert Mustacchi
67*5eb667acSRobert Mustacchisetup_libs
68*5eb667acSRobert Mustacchi
69*5eb667acSRobert Mustacchi$dtrace -L$libdira -L$libdirb -L$libdirc -e
70*5eb667acSRobert Mustacchi
71*5eb667acSRobert Mustacchistatus=$?
72*5eb667acSRobert Mustacchirm -rf $libdira
73*5eb667acSRobert Mustacchirm -rf $libdirb
74*5eb667acSRobert Mustacchirm -rf $libdirc
75*5eb667acSRobert Mustacchireturn $status
76*5eb667acSRobert Mustacchi