Mercurial > hg > aboriginal
comparison root-filesystem.sh @ 815:8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 26 Aug 2009 02:37:57 -0500 |
parents | d0b74a631587 |
children | da1ebb2e22d3 |
comparison
equal
deleted
inserted
replaced
814:5dd054d1c789 | 815:8129df56091b |
---|---|
26 # Announce start of stage. | 26 # Announce start of stage. |
27 | 27 |
28 echo -e "$NATIVE_COLOR" | 28 echo -e "$NATIVE_COLOR" |
29 echo "=== Building $STAGE_NAME" | 29 echo "=== Building $STAGE_NAME" |
30 | 30 |
31 blank_tempdir "$STAGE_DIR" | |
31 blank_tempdir "$WORK" | 32 blank_tempdir "$WORK" |
32 blank_tempdir "$STAGE_DIR" | |
33 | 33 |
34 # Determine which directory layout we're using | 34 # Determine which directory layout we're using |
35 | 35 |
36 if [ -z "$ROOT_NODIRS" ] | 36 if [ -z "$ROOT_NODIRS" ] |
37 then | 37 then |
51 | 51 |
52 setupfor linux | 52 setupfor linux |
53 # Install Linux kernel headers (for use by uClibc). | 53 # Install Linux kernel headers (for use by uClibc). |
54 make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="$ROOT_TOPDIR" && | 54 make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="$ROOT_TOPDIR" && |
55 # This makes some very old package builds happy. | 55 # This makes some very old package builds happy. |
56 ln -s ../sys/user.h "$ROOT_TOPDIR/include/asm/page.h" && | 56 ln -s ../sys/user.h "$ROOT_TOPDIR/include/asm/page.h" |
57 cd .. | 57 |
58 | 58 cleanup |
59 cleanup linux | |
60 | 59 |
61 # Build and install uClibc. (We could just copy the one from the compiler | 60 # Build and install uClibc. (We could just copy the one from the compiler |
62 # toolchain, but this is cleaner.) | 61 # toolchain, but this is cleaner.) |
63 | 62 |
64 setupfor uClibc | 63 setupfor uClibc |
83 do | 82 do |
84 mv "$ROOT_TOPDIR"/bin/{"$i","${PROGRAM_PREFIX}$i"} || dienow | 83 mv "$ROOT_TOPDIR"/bin/{"$i","${PROGRAM_PREFIX}$i"} || dienow |
85 done | 84 done |
86 fi | 85 fi |
87 | 86 |
88 cd .. | 87 cleanup |
89 | |
90 cleanup uClibc | |
91 | 88 |
92 if [ "$NATIVE_TOOLCHAIN" == "none" ] | 89 if [ "$NATIVE_TOOLCHAIN" == "none" ] |
93 then | 90 then |
94 # If we're not installing a compiler, delete the headers, static libs, | 91 # If we're not installing a compiler, delete the headers, static libs, |
95 # and example source code. | 92 # and example source code. |
115 --disable-nls --disable-shared --disable-multilib --disable-werror \ | 112 --disable-nls --disable-shared --disable-multilib --disable-werror \ |
116 --program-prefix="$PROGRAM_PREFIX" $BINUTILS_FLAGS && | 113 --program-prefix="$PROGRAM_PREFIX" $BINUTILS_FLAGS && |
117 make -j $CPUS configure-host && | 114 make -j $CPUS configure-host && |
118 make -j $CPUS CFLAGS="-O2 $STATIC_FLAGS" && | 115 make -j $CPUS CFLAGS="-O2 $STATIC_FLAGS" && |
119 make -j $CPUS install && | 116 make -j $CPUS install && |
120 cd .. && | |
121 mkdir -p "$ROOT_TOPDIR/include" && | 117 mkdir -p "$ROOT_TOPDIR/include" && |
122 cp binutils/include/libiberty.h "$ROOT_TOPDIR/include" | 118 cp "$CURSRC/include/libiberty.h" "$ROOT_TOPDIR/include" |
123 | 119 |
124 cleanup binutils build-binutils | 120 cleanup build-binutils |
125 | 121 |
126 # Build and install native gcc, with c++ support this time. | 122 # Build and install native gcc, with c++ support this time. |
127 | 123 |
128 setupfor gcc-core build-gcc | 124 setupfor gcc-core build-gcc |
129 setupfor gcc-g++ build-gcc gcc-core | 125 setupfor gcc-g++ build-gcc gcc-core |
164 # A) we're using uClibc++ instead, B) the build breaks. | 160 # A) we're using uClibc++ instead, B) the build breaks. |
165 make -j $CPUS configure-target-libstdc++-v3 && | 161 make -j $CPUS configure-target-libstdc++-v3 && |
166 cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ && | 162 cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ && |
167 make -j $CPUS && | 163 make -j $CPUS && |
168 mv .libs/libsupc++.a "$ROOT_TOPDIR"/lib && | 164 mv .libs/libsupc++.a "$ROOT_TOPDIR"/lib && |
169 cd ../../../.. | 165 |
170 | 166 # We're done with that source and could theoretically cleanup gcc-core and |
171 cleanup gcc-core build-gcc | 167 # build-gcc here, but we still need the timestamps if we do binary packaging. |
172 | 168 |
173 # Move the gcc internal libraries and headers somewhere sane | 169 # Move the gcc internal libraries and headers somewhere sane |
174 | 170 |
175 mkdir -p "$ROOT_TOPDIR"/gcc && | 171 mkdir -p "$ROOT_TOPDIR"/gcc && |
176 mv "$ROOT_TOPDIR"/lib/gcc/*/*/include "$ROOT_TOPDIR"/gcc/include && | 172 mv "$ROOT_TOPDIR"/lib/gcc/*/*/include "$ROOT_TOPDIR"/gcc/include && |
188 | 184 |
189 # Wrap C++ | 185 # Wrap C++ |
190 mv "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}g++" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}rawg++" && | 186 mv "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}g++" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}rawg++" && |
191 ln "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}gcc" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}g++" && | 187 ln "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}gcc" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}g++" && |
192 rm "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}c++" && | 188 rm "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}c++" && |
193 ln -s "${PROGRAM_PREFIX}g++" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}c++" | 189 ln -s "${PROGRAM_PREFIX}g++" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}c++" && |
194 | 190 |
195 cleanup "$ROOT_TOPDIR"/{lib/gcc,gcc/lib/install-tools,bin/${ARCH}-unknown-*} | 191 # When tarring up individual binary packages, we want this one to be called |
192 # "gcc" and that's not what we fed to setupfor, so rename it. | |
193 | |
194 mv "$WORK"/{gcc-core,gcc} | |
195 PACKAGE=gcc cleanup build-gcc \ | |
196 "$ROOT_TOPDIR"/{lib/gcc,gcc/lib/install-tools,bin/${ARCH}-unknown-*} | |
196 | 197 |
197 # Tell future packages to link against the libraries in the new root filesystem, | 198 # Tell future packages to link against the libraries in the new root filesystem, |
198 # rather than the ones in the cross compiler directory. | 199 # rather than the ones in the cross compiler directory. |
199 | 200 |
200 export ${ARCH}_WRAPPER_TOPDIR="$ROOT_TOPDIR" | 201 export ${ARCH}_WRAPPER_TOPDIR="$ROOT_TOPDIR" |
212 # Move libraries somewhere useful. | 213 # Move libraries somewhere useful. |
213 | 214 |
214 mv "$ROOT_TOPDIR"/c++/lib/* "$ROOT_TOPDIR"/lib && | 215 mv "$ROOT_TOPDIR"/c++/lib/* "$ROOT_TOPDIR"/lib && |
215 rm -rf "$ROOT_TOPDIR"/c++/{lib,bin} && | 216 rm -rf "$ROOT_TOPDIR"/c++/{lib,bin} && |
216 ln -s libuClibc++.so "$ROOT_TOPDIR"/lib/libstdc++.so && | 217 ln -s libuClibc++.so "$ROOT_TOPDIR"/lib/libstdc++.so && |
217 ln -s libuClibc++.a "$ROOT_TOPDIR"/lib/libstdc++.a && | 218 ln -s libuClibc++.a "$ROOT_TOPDIR"/lib/libstdc++.a |
218 cd .. | 219 |
219 | 220 cleanup |
220 cleanup uClibc++ | |
221 | 221 |
222 fi # End of NATIVE_TOOLCHAIN build | 222 fi # End of NATIVE_TOOLCHAIN build |
223 | 223 |
224 if [ "$NATIVE_TOOLCHAIN" != "only" ] | 224 if [ "$NATIVE_TOOLCHAIN" != "only" ] |
225 then | 225 then |
238 then | 238 then |
239 CFLAGS="$CFLAGS $STATIC_FLAGS" make CROSS="${ARCH}-" && | 239 CFLAGS="$CFLAGS $STATIC_FLAGS" make CROSS="${ARCH}-" && |
240 cp toybox "$ROOT_TOPDIR/bin" && | 240 cp toybox "$ROOT_TOPDIR/bin" && |
241 ln -s toybox "$ROOT_TOPDIR/bin/patch" && | 241 ln -s toybox "$ROOT_TOPDIR/bin/patch" && |
242 ln -s toybox "$ROOT_TOPDIR/bin/oneit" && | 242 ln -s toybox "$ROOT_TOPDIR/bin/oneit" && |
243 ln -s toybox "$ROOT_TOPDIR/bin/netcat" && | 243 ln -s toybox "$ROOT_TOPDIR/bin/netcat" |
244 cd .. | |
245 else | 244 else |
246 CFLAGS="$CFLAGS $STATIC_FLAGS" \ | 245 CFLAGS="$CFLAGS $STATIC_FLAGS" \ |
247 make install_flat PREFIX="$ROOT_TOPDIR"/bin CROSS="${ARCH}-" && | 246 make install_flat PREFIX="$ROOT_TOPDIR"/bin CROSS="${ARCH}-" |
248 cd .. | |
249 fi | 247 fi |
250 | 248 |
251 cleanup toybox | 249 cleanup |
252 | 250 |
253 # Build and install busybox | 251 # Build and install busybox |
254 | 252 |
255 setupfor busybox | 253 setupfor busybox |
256 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && | 254 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && |
257 cp .config "$ROOT_TOPDIR"/src/config-busybox && | 255 cp .config "$ROOT_TOPDIR"/src/config-busybox && |
258 LDFLAGS="$LDFLAGS $STATIC_FLAGS" \ | 256 LDFLAGS="$LDFLAGS $STATIC_FLAGS" \ |
259 make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY && | 257 make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY && |
260 make busybox.links && | 258 make busybox.links && |
261 cp busybox "$ROOT_TOPDIR/bin" | 259 cp busybox "$ROOT_TOPDIR/bin" || dienow |
262 | |
263 [ $? -ne 0 ] && dienow | |
264 | 260 |
265 for i in $(sed 's@.*/@@' busybox.links) | 261 for i in $(sed 's@.*/@@' busybox.links) |
266 do | 262 do |
267 # Allowed to fail. | 263 # Allowed to fail. |
268 ln -s busybox "$ROOT_TOPDIR/bin/$i" 2>/dev/null | 264 ln -s busybox "$ROOT_TOPDIR/bin/$i" 2>/dev/null || true |
269 done | 265 done |
270 cd .. | 266 |
271 | 267 cleanup |
272 cleanup busybox | |
273 | 268 |
274 # Build and install make | 269 # Build and install make |
275 | 270 |
276 setupfor make | 271 setupfor make |
277 LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \ | 272 LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \ |
278 --prefix="$ROOT_TOPDIR" --build="${CROSS_HOST}" --host="${CROSS_TARGET}" && | 273 --prefix="$ROOT_TOPDIR" --build="${CROSS_HOST}" --host="${CROSS_TARGET}" && |
279 make -j $CPUS && | 274 make -j $CPUS && |
280 make -j $CPUS install && | 275 make -j $CPUS install |
281 cd .. | 276 |
282 | 277 cleanup |
283 cleanup make | |
284 | 278 |
285 # Build and install bash. (Yes, this is an old version. It's intentional.) | 279 # Build and install bash. (Yes, this is an old version. It's intentional.) |
286 | 280 |
287 setupfor bash | 281 setupfor bash |
288 # Remove existing /bin/sh link (busybox) so the bash install doesn't get upset. | 282 # Remove existing /bin/sh link (busybox) so the bash install doesn't get upset. |
300 --without-bash-malloc --disable-readline && | 294 --without-bash-malloc --disable-readline && |
301 # note: doesn't work with -j | 295 # note: doesn't work with -j |
302 make && | 296 make && |
303 make install && | 297 make install && |
304 # Make bash the default shell. | 298 # Make bash the default shell. |
305 ln -sf bash "$ROOT_TOPDIR/bin/sh" && | 299 ln -sf bash "$ROOT_TOPDIR/bin/sh" |
306 cd .. | 300 |
307 | 301 cleanup |
308 cleanup bash | |
309 | 302 |
310 setupfor distcc | 303 setupfor distcc |
311 rsync_cv_HAVE_C99_VSNPRINTF=yes \ | 304 rsync_cv_HAVE_C99_VSNPRINTF=yes \ |
312 LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \ | 305 LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \ |
313 --host="${CROSS_TARGET}" --prefix="$ROOT_TOPDIR" \ | 306 --host="${CROSS_TARGET}" --prefix="$ROOT_TOPDIR" \ |
318 | 311 |
319 for i in gcc cc g++ c++ | 312 for i in gcc cc g++ c++ |
320 do | 313 do |
321 ln -s ../bin/distcc "$ROOT_TOPDIR/distcc/$i" || dienow | 314 ln -s ../bin/distcc "$ROOT_TOPDIR/distcc/$i" || dienow |
322 done | 315 done |
323 cd .. | 316 |
324 | 317 cleanup |
325 cleanup distcc | |
326 | 318 |
327 # Put statically and dynamically linked hello world programs on there for | 319 # Put statically and dynamically linked hello world programs on there for |
328 # test purposes. | 320 # test purposes. |
329 | 321 |
330 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os -s -o "$ROOT_TOPDIR/bin/hello-dynamic" && | 322 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os -s -o "$ROOT_TOPDIR/bin/hello-dynamic" && |