Mercurial > hg > aboriginal
comparison host-tools.sh @ 792:b364ed2adf49
Fedora 11 hasn't got "which", so move the busybox build up and the host toolchain symlinks down to the end. Make sure toybox patch replaces busybox patch, and host toolchain ar replaces busybox ar.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 31 Jul 2009 01:00:45 -0500 |
parents | db06a8c1bfed |
children | 5f793a1ca658 |
comparison
equal
deleted
inserted
replaced
791:b9fa1da23205 | 792:b364ed2adf49 |
---|---|
63 # same command line utilities no matter where we're running, because we | 63 # same command line utilities no matter where we're running, because we |
64 # provide our own. | 64 # provide our own. |
65 | 65 |
66 else | 66 else |
67 | 67 |
68 # Start by creating symlinks to the host toolchain, since we need to use | 68 # Use the new tools we build preferentially, as soon as they become |
69 # that to build anything else. We build a cross compiler, and a native | 69 # available. |
70 # compiler for the target, but we don't build a host toolchain. We use the | 70 |
71 # one that's already there. | 71 PATH="$HOSTTOOLS:$PATH" |
72 | 72 |
73 for i in ar as nm cc make ld gcc | 73 # Start by building busybox. We have no idea what strange things our host |
74 do | 74 # system has (or lacks, such as "which"), so throw busybox at it first |
75 [ ! -f "${HOSTTOOLS}/$i" ] && | 75 # thing. |
76 (ln -s `PATH="$OLDPATH" which $i` "${HOSTTOOLS}/$i" || dienow) | 76 |
77 done | 77 if [ ! -f "${HOSTTOOLS}/busybox" ] |
78 then | |
79 setupfor busybox && | |
80 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && | |
81 make -j $CPUS && | |
82 make busybox.links && | |
83 cp busybox "${HOSTTOOLS}" | |
84 | |
85 [ $? -ne 0 ] && dienow | |
86 | |
87 for i in $(sed 's@.*/@@' busybox.links) | |
88 do | |
89 [ ! -f "${HOSTTOOLS}/$i" ] && | |
90 (ln -sf busybox "${HOSTTOOLS}/$i" || dienow) | |
91 done | |
92 cd .. | |
93 | |
94 cleanup busybox | |
95 fi | |
78 | 96 |
79 # Build toybox | 97 # Build toybox |
80 | 98 |
81 if [ ! -f "${HOSTTOOLS}/toybox" ] | 99 if [ ! -f "${HOSTTOOLS}/toybox" ] |
82 then | 100 then |
84 make defconfig && | 102 make defconfig && |
85 make || dienow | 103 make || dienow |
86 if [ -z "$USE_TOYBOX" ] | 104 if [ -z "$USE_TOYBOX" ] |
87 then | 105 then |
88 mv toybox "$HOSTTOOLS" && | 106 mv toybox "$HOSTTOOLS" && |
89 ln -s toybox "$HOSTTOOLS"/patch && | 107 ln -sf toybox "$HOSTTOOLS"/patch && |
90 ln -s toybox "$HOSTTOOLS"/netcat || dienow | 108 ln -sf toybox "$HOSTTOOLS"/netcat || dienow |
91 else | 109 else |
92 make install_flat PREFIX="${HOSTTOOLS}" || dienow | 110 make install_flat PREFIX="${HOSTTOOLS}" || dienow |
93 fi | 111 fi |
94 cd .. | 112 cd .. |
95 | 113 |
96 cleanup toybox | 114 cleanup toybox |
97 fi | 115 fi |
98 | 116 |
99 # Build busybox | 117 # Create symlinks to the host toolchain. We need a usable existing host |
100 | 118 # toolchain in order to build anything else (even a new host toolchain), |
101 if [ ! -f "${HOSTTOOLS}/busybox" ] | 119 # and we don't really want to have to care what the host type is, so |
102 then | 120 # just use the toolchain that's already there. |
103 setupfor busybox && | 121 |
104 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && | 122 for i in ar as nm cc make ld gcc |
105 make -j $CPUS && | 123 do |
106 make busybox.links && | 124 [ ! -f "${HOSTTOOLS}/$i" ] && |
107 cp busybox "${HOSTTOOLS}" | 125 (ln -sf `PATH="$OLDPATH" $HOSTTOOLS/which $i` "${HOSTTOOLS}/$i" || dienow) |
108 | 126 done |
109 [ $? -ne 0 ] && dienow | 127 |
110 | 128 # We now have all the tools we need in $HOSTTOOLS, so trim the $PATH to |
111 for i in $(sed 's@.*/@@' busybox.links) | 129 # remove the old ones. |
112 do | |
113 [ ! -f "${HOSTTOOLS}/$i" ] && | |
114 (ln -s busybox "${HOSTTOOLS}/$i" || dienow) | |
115 done | |
116 cd .. | |
117 | |
118 cleanup busybox | |
119 fi | |
120 | 130 |
121 PATH="${HOSTTOOLS}" | 131 PATH="${HOSTTOOLS}" |
122 fi | 132 fi |
123 | 133 |
124 # This is optionally used by root-filesystem to accelerate native builds when | 134 # This is optionally used by root-filesystem to accelerate native builds when |