Gentoo Archives: gentoo-amd64

From: Frank Peters <frank.peters@×××××××.net>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64]corss compile 64bit on 32bit os
Date: Wed, 16 Sep 2009 16:27:52
Message-Id: 20090916122744.0d9707f7.frank.peters@comcast.net
In Reply to: Re: [gentoo-amd64]corss compile 64bit on 32bit os by Xi Shen
1 On Wed, 16 Sep 2009 21:36:37 +0800
2 Xi Shen <davidshen84@××××××××××.com> wrote:
3
4 > when reading that doc, i cannot understand the following script
5 >
6 > #!/bin/bash
7 > exec /usr/lib/distcc/bin/sparc-unknown-linux-gnu-g${0:$[-2]} "$@"
8 >
9 > what does the ":" do here?
10 >
11 >
12
13 The construction "${0:$[-2]}" will return the last two characters of
14 the $0 string, with the $0 string being the name of the called script.
15 These last two characters are appended to the string "sparc-unknown-linux-gnu-g".
16
17 After glancing at the section in cross-compiling-distcc.xml, it seems
18 that this particular script will be called via a symlink, which will
19 be one of gcc, g++, c++. The last two chars of the link name are thus
20 appended to "sparc-unknown-linux-gnu-g" to form the name of an execuatable,
21 e.g. /usr/lib/distcc/bin/sparc-unknown-linux-gnu-gcc.
22
23 Frank Peters

Replies

Subject Author
Re: [gentoo-amd64]corss compile 64bit on 32bit os Xi Shen <davidshen84@××××××××××.com>