1 ########################################################################
3 # This software is part of the ast package #
4 # Copyright (c) 1994-2016 AT&T Intellectual Property #
5 # and is licensed under the #
6 # Eclipse Public License, Version 1.0 #
7 # by AT&T Intellectual Property #
9 # A copy of the License is available at #
10 # http://www.eclipse.org/org/documents/epl-v10.html #
11 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
13 # Information and Software Systems Research #
17 # Glenn Fowler <glenn.s.fowler@gmail.com> #
19 ########################################################################
20 ########################################################################
22 # This software is part of the ast package #
23 # Copyright (c) 1994-2011 AT&T Intellectual Property #
24 # and is licensed under the #
25 # Eclipse Public License, Version 1.0 #
26 # by AT&T Intellectual Property #
28 # A copy of the License is available at #
29 # http://www.eclipse.org/org/documents/epl-v10.html #
30 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
32 # Information and Software Systems Research #
36 # Glenn Fowler <glenn.s.fowler@gmail.com> #
38 ########################################################################
39 : cross compiler a.out execution
45 case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
46 0123) ARGV0
="-a $command"
49 @(#)$Id: crossexec (AT&T Labs Research) 2004-01-04 $
52 [+NAME?crossexec - cross compiler a.out execution]
53 [+DESCRIPTION?\bcrossexec\b runs a cross-compiled \acommand\a in an environment
54 that supports a cross-compilation architecture different from the
55 current host. The cross environment is determined by \acrosstype\a,
56 usually a host type name produced by \bpackage\b(1). \acrosstype\a
57 is used to find an entry in \b$HOME/.crossexec\b that specifies
58 the cross compiler host and access details.]
59 [+?The exit status of \bcrossexec\b is the exit status of \acommand\a.]
60 [+CROSS ENVIRONMENT FILE?\b$HOME/.crossexec\b contains one line for each
61 supported \acrosstype\a. Each line contains 5 tab separated fields.
62 Field default values are specified as \b-\b. The fields are:]{
63 [+crosstype?The host type produced by \bpackage\b(1).]
64 [+host?The host name.]
65 [+user?The user name on \ahost\a. The default is the current user.]
66 [+dir?The directory to copy \acommand\a and execute it. The default
67 is the \auser\a \b$HOME\b on \ahost\a.]
68 [+shell?The command used to get shell access to \ahost\a. Currently
69 only \brsh\b and \bssh\b are supported.]
70 [+copy?The command used to copy \acommand\a to \ahost\a. Currently
71 only \brcp\b and \bscp\b are supported.]
73 [n:show?Show the underlying commands but do not execute.]
75 crosstype command [ option ... ] [ file ... ]
77 [+SEE ALSO?\brcp\b(1), \brsh\b(1), \bscp\b(1), \bssh\b(1)]
81 USAGE
="crosstype command [ option ... ] [ file ... ]"
88 getopts $ARGV0 "$USAGE" OPT
'-?'
94 # get the options and operands
96 while getopts $ARGV0 "$USAGE" OPT
116 then echo "$command: $info: not found" >&2
123 read hosttype hostname usr dir sh
cp
128 *) echo "$command: $type: unknown cross compiler host type" >&2
137 # fill in the defaults
141 *) cpu
=${usr}@ shu
="-l $usr" ;;
154 trap "rm -f $tmp" 0 1 2 3 15
155 $exec $cp $cmd $cpu$hostname:$dir </dev
/null ||
exit 1
157 $exec $sh $shu $hostname "cd $dir; LD_LIBRARY_PATH=: $cmd $@ </dev/null 2>/dev/null; code=\$?; rm -f $cmd; echo $command: exit \$code >&2" </dev
/null
2>$tmp
158 exit `sed -e '/^'$command': exit [0-9][0-9]*$/!d' -e 's/.* //' $tmp`