1#!/bin/mksh
2# $MirOS: src/scripts/xbuild-tool.sed,v 1.7 2007/06/10 11:05:11 tg Exp $
3#-
4# Copyright (c) 2004, 2006
5#	Thorsten Glaser <tg@mirbsd.de>
6#
7# Provided that these terms and disclaimer and all copyright notices
8# are retained or reproduced in an accompanying document, permission
9# is granted to deal in this work without restriction, including un-
10# limited rights to use, publicly perform, distribute, sell, modify,
11# merge, give away, or sublicence.
12#
13# Advertising materials mentioning features or use of this work must
14# display the following acknowledgement:
15#	This product includes material provided by Thorsten Glaser.
16#
17# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
18# the utmost extent permitted by applicable law, neither express nor
19# implied; without malicious intent or gross negligence. In no event
20# may a licensor, author or contributor be held liable for indirect,
21# direct, other damage, loss, or other issues arising in any way out
22# of dealing in the work, even if advised of the possibility of such
23# damage or existence of a defect, except proven that it results out
24# of said person's immediate fault when using the work as intended.
25#-
26# This script replaces the need to build cross-binutils and cross-ld
27# by calling native (--enable-target=all --enable-64-bit-bfd) tools,
28# setting the appropriate environment option first.
29
30export GNUTARGET='@@TARGET@@' LDEMULATION='@@EMUL@@'
31
32ME=$0
33CALLED=${ME##*/}
34CALLED=/usr/bin/${CALLED#${GNUTARGET}-}
35if [[ ! -x $CALLED ]]; then
36	print -u2 "Cannot execute native tool $CALLED"
37	print -u2 "for $ME, exiting."
38	exit 255
39fi
40exec $CALLED "$@"
41