1 |
vapier 10/01/08 07:10:34 |
2 |
|
3 |
Modified: cross-fix-root |
4 |
Log: |
5 |
cross-fix-root: add some usage text |
6 |
|
7 |
Revision Changes Path |
8 |
1.9 crossdev-wrappers/cross-fix-root |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/crossdev-wrappers/cross-fix-root?rev=1.9&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/crossdev-wrappers/cross-fix-root?rev=1.9&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/crossdev-wrappers/cross-fix-root?r1=1.8&r2=1.9 |
13 |
|
14 |
Index: cross-fix-root |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/crossdev-wrappers/cross-fix-root,v |
17 |
retrieving revision 1.8 |
18 |
retrieving revision 1.9 |
19 |
diff -u -r1.8 -r1.9 |
20 |
--- cross-fix-root 30 Dec 2009 04:57:24 -0000 1.8 |
21 |
+++ cross-fix-root 8 Jan 2010 07:10:34 -0000 1.9 |
22 |
@@ -1,16 +1,25 @@ |
23 |
#!/bin/sh |
24 |
-# Copyright 2008-2009 Gentoo Foundation |
25 |
+# Copyright 2008-2010 Gentoo Foundation |
26 |
# Distributed under the terms of the GNU General Public License v2 |
27 |
|
28 |
-# |
29 |
-# fix library perms, mung paths in pkg-config files, libtool linker scripts, |
30 |
-# and random -config scripts to point to our build directory, and cross-compile |
31 |
-# symlinks for the -config scripts as autotool packages will search for |
32 |
-# prefixed -config scripts when cross-compiling. note: the ugly ln/mv is to |
33 |
-# work around a possible race condition if multiple make jobs are generating |
34 |
-# the same symlink at the same time. a `mv` is "atomic" (it uses rename()) |
35 |
-# while a `ln` is actually unlink();symlink();. |
36 |
-# |
37 |
+usage() { |
38 |
+ cat <<-EOF |
39 |
+ Usage: cross-fix-root <sysroot> <cross-bindir> <cross-prefix> |
40 |
+ cross-fix-root <cross-prefix> |
41 |
+ cross-fix-root # takes settings from env |
42 |
+ |
43 |
+ Environment variables: |
44 |
+ CROSS_COMPILE=<cross-prefix> |
45 |
+ (SYSROOT|ROOT|STAGEDIR)=<sysroot> |
46 |
+ |
47 |
+ Description: |
48 |
+ Fix library perms and mung paths in libtool linker scripts & random -config |
49 |
+ scripts to point to our SYSROOT directory. Add symlinks for the -config |
50 |
+ with cross-compiler prefixes as autotool packages will search for them first |
51 |
+ when cross-compiling. |
52 |
+ EOF |
53 |
+ exit 1 |
54 |
+} |
55 |
|
56 |
LIBDIR="usr/lib" |
57 |
SYSROOT=${SYSROOT:-${ROOT:-${STAGEDIR}}} |
58 |
@@ -20,19 +29,24 @@ |
59 |
CROSS_BINDIR="${ROOTDIR}/tools" |
60 |
fi |
61 |
CROSS_PREFIX=${CROSS_COMPILE} |
62 |
-if [ -n "$3" ] ; then |
63 |
- SYSROOT="$1" |
64 |
- CROSS_BINDIR="$2" |
65 |
- CROSS_PREFIX="$3" |
66 |
-elif [ -n "$1" ] ; then |
67 |
- if [ -e "/usr/$1" ] ; then |
68 |
- SYSROOT="/usr/$1" |
69 |
- CROSS_BINDIR="/usr/bin" |
70 |
- CROSS_PREFIX="$1-" |
71 |
- else |
72 |
- exit 1 |
73 |
- fi |
74 |
-fi |
75 |
+case $# in |
76 |
+ 3) |
77 |
+ SYSROOT="$1" |
78 |
+ CROSS_BINDIR="$2" |
79 |
+ CROSS_PREFIX="$3" |
80 |
+ ;; |
81 |
+ 1) |
82 |
+ if [ -e "/usr/${1:-..........}" ] ; then |
83 |
+ SYSROOT="/usr/$1" |
84 |
+ CROSS_BINDIR="/usr/bin" |
85 |
+ CROSS_PREFIX="$1-" |
86 |
+ else |
87 |
+ usage |
88 |
+ fi |
89 |
+ ;; |
90 |
+ 0) [ -z "${SYSROOT}" ] && usage ;; |
91 |
+ *) usage ;; |
92 |
+esac |
93 |
|
94 |
cd "${SYSROOT}" || exit 0 |
95 |
|
96 |
@@ -61,6 +75,10 @@ |
97 |
if [ -n "${CROSS_BINDIR}" ] && [ -d "${CROSS_BINDIR}" ] && [ -n "${CROSS_PREFIX}" ] ; then |
98 |
cd usr/bin || exit 1 |
99 |
for config in *-config ; do |
100 |
+ # work around a possible race condition if multiple make jobs |
101 |
+ # are generating the same symlink at the same time. a `mv` |
102 |
+ # is "atomic" (it uses rename()) while a `ln` is actually |
103 |
+ # unlink() followed by a symlink(). |
104 |
ln -s "${SYSROOT}/usr/bin/${config}" "${CROSS_BINDIR}/${CROSS_PREFIX}${config}.$$" |
105 |
mv "${CROSS_BINDIR}/${CROSS_PREFIX}${config}.$$" "${CROSS_BINDIR}/${CROSS_PREFIX}${config}" |
106 |
done |