annotate mini-native.sh @ 630:0e8a887f9d8b

buildall.sh should create the README file in the output directory.
author Rob Landley <rob@landley.net>
date Thu, 05 Mar 2009 12:25:19 -0600
parents 189dc4e359ec
children 4ab92aee351c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
177
6b4844b708b9 dash->bash.
Rob Landley <rob@landley.net>
parents: 164
diff changeset
1 #!/bin/bash
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # Get lots of predefined environment variables and shell functions.
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
503
e98ed40c55ef Move include.sh to sources/include.sh. End user doesn't call it directly, shouldn't be at top level.
Rob Landley <rob@landley.net>
parents: 496
diff changeset
5 source sources/include.sh
96
137ba51ee993 Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents: 85
diff changeset
6
395
c2b290c1df40 Upgrade BUILD_SHORT to make a small busybox+uClibc system in /usr, with top level symlinks (/bin, /lib, etc) and adjustments to boot script and run-emulator.
Rob Landley <rob@landley.net>
parents: 390
diff changeset
7 # Purple. And why not?
485
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 484
diff changeset
8 echo -e "$NATIVE_COLOR"
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 484
diff changeset
9 echo "=== Building minimal native development environment"
395
c2b290c1df40 Upgrade BUILD_SHORT to make a small busybox+uClibc system in /usr, with top level symlinks (/bin, /lib, etc) and adjustments to boot script and run-emulator.
Rob Landley <rob@landley.net>
parents: 390
diff changeset
10
597
3d67228ceb1e Rename $NATIVE to $NATIVE_ROOT and allow it to be supplied externally so system-image.sh can package up an arbitrary native root filesystem source dir.
Rob Landley <rob@landley.net>
parents: 579
diff changeset
11 rm -rf "${NATIVE_ROOT}"
96
137ba51ee993 Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents: 85
diff changeset
12
496
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
13 if [ ! -z "${NATIVE_TOOLSDIR}" ]
331
d2820523ee06 When doing BUILD_SHORT (without development tools), use / instead of /tools.
Rob Landley <rob@landley.net>
parents: 326
diff changeset
14 then
423
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
15 mkdir -p "${TOOLS}/bin" || dienow
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
16
331
d2820523ee06 When doing BUILD_SHORT (without development tools), use / instead of /tools.
Rob Landley <rob@landley.net>
parents: 326
diff changeset
17 # Tell the wrapper script where to find the dynamic linker.
d2820523ee06 When doing BUILD_SHORT (without development tools), use / instead of /tools.
Rob Landley <rob@landley.net>
parents: 326
diff changeset
18 export UCLIBC_DYNAMIC_LINKER=/tools/lib/ld-uClibc.so.0
597
3d67228ceb1e Rename $NATIVE to $NATIVE_ROOT and allow it to be supplied externally so system-image.sh can package up an arbitrary native root filesystem source dir.
Rob Landley <rob@landley.net>
parents: 579
diff changeset
19 UCLIBC_TOPDIR="${NATIVE_ROOT}"
521
e7d1db74c942 More fiddling to make /tools vs /usr work.
Rob Landley <rob@landley.net>
parents: 519
diff changeset
20 UCLIBC_DLPREFIX="/tools"
331
d2820523ee06 When doing BUILD_SHORT (without development tools), use / instead of /tools.
Rob Landley <rob@landley.net>
parents: 326
diff changeset
21 else
597
3d67228ceb1e Rename $NATIVE to $NATIVE_ROOT and allow it to be supplied externally so system-image.sh can package up an arbitrary native root filesystem source dir.
Rob Landley <rob@landley.net>
parents: 579
diff changeset
22 mkdir -p "${NATIVE_ROOT}"/{tmp,proc,sys,dev,etc} || dienow
521
e7d1db74c942 More fiddling to make /tools vs /usr work.
Rob Landley <rob@landley.net>
parents: 519
diff changeset
23 UCLIBC_TOPDIR="${TOOLS}"
423
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
24 for i in bin sbin lib
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
25 do
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
26 mkdir -p "$TOOLS/$i" || dienow
597
3d67228ceb1e Rename $NATIVE to $NATIVE_ROOT and allow it to be supplied externally so system-image.sh can package up an arbitrary native root filesystem source dir.
Rob Landley <rob@landley.net>
parents: 579
diff changeset
27 ln -s "usr/$i" "${NATIVE_ROOT}/$i" || dienow
423
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
28 done
331
d2820523ee06 When doing BUILD_SHORT (without development tools), use / instead of /tools.
Rob Landley <rob@landley.net>
parents: 326
diff changeset
29 fi
395
c2b290c1df40 Upgrade BUILD_SHORT to make a small busybox+uClibc system in /usr, with top level symlinks (/bin, /lib, etc) and adjustments to boot script and run-emulator.
Rob Landley <rob@landley.net>
parents: 390
diff changeset
30
424
e39509d8d925 Install uClibc and kernel .config files into src directory of mini-native.
Rob Landley <rob@landley.net>
parents: 423
diff changeset
31 # Copy qemu setup script and so on.
e39509d8d925 Install uClibc and kernel .config files into src directory of mini-native.
Rob Landley <rob@landley.net>
parents: 423
diff changeset
32
e39509d8d925 Install uClibc and kernel .config files into src directory of mini-native.
Rob Landley <rob@landley.net>
parents: 423
diff changeset
33 cp -r "${SOURCES}/native/." "${TOOLS}/" || dienow
e39509d8d925 Install uClibc and kernel .config files into src directory of mini-native.
Rob Landley <rob@landley.net>
parents: 423
diff changeset
34
579
05a608d26600 Delete man pages (they take up almost 2 megs) and consolidate some code.
Rob Landley <rob@landley.net>
parents: 576
diff changeset
35 if [ -z "${NATIVE_TOOLSDIR}" ]
05a608d26600 Delete man pages (they take up almost 2 megs) and consolidate some code.
Rob Landley <rob@landley.net>
parents: 576
diff changeset
36 then
05a608d26600 Delete man pages (they take up almost 2 megs) and consolidate some code.
Rob Landley <rob@landley.net>
parents: 576
diff changeset
37 sed -i -e 's@/tools/@/usr/@g' "${TOOLS}/sbin/init.sh" || dienow
05a608d26600 Delete man pages (they take up almost 2 megs) and consolidate some code.
Rob Landley <rob@landley.net>
parents: 576
diff changeset
38 fi
05a608d26600 Delete man pages (they take up almost 2 megs) and consolidate some code.
Rob Landley <rob@landley.net>
parents: 576
diff changeset
39
553
80f3356577fc Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents: 546
diff changeset
40 # Install Linux kernel headers.
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
41
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
42 setupfor linux
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 # Install Linux kernel headers (for use by uClibc).
278
f878f79763c7 Use make -j to install kernel headers.
Rob Landley <rob@landley.net>
parents: 223
diff changeset
44 make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="${TOOLS}" &&
540
d0b059fd91a8 Link include/asm/page.h to include/sys/user.h, in case people try to build old packages.
Rob Landley <rob@landley.net>
parents: 537
diff changeset
45 # This makes some very old package builds happy.
d0b059fd91a8 Link include/asm/page.h to include/sys/user.h, in case people try to build old packages.
Rob Landley <rob@landley.net>
parents: 537
diff changeset
46 ln -s ../sys/user.h "${TOOLS}/include/asm/page.h" &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
47 cd ..
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
48
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
49 cleanup linux
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
50
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
51 # Build and install uClibc. (We could just copy the one from the compiler
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
52 # toolchain, but this is cleaner.)
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
53
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
54 setupfor uClibc
530
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 527
diff changeset
55 make CROSS="${ARCH}-" KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig &&
533
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
56 cp .config "${TOOLS}"/src/config-uClibc || dienow
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
57
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
58 # Alas, if we feed install and install_utils to make at the same time with
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
59 # -j > 1, it dies. Not SMP safe.
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
60 for i in install install_utils
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
61 do
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
62 make CROSS="${ARCH}-" KERNEL_HEADERS="${TOOLS}/include" \
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
63 PREFIX="${UCLIBC_TOPDIR}/" \
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
64 RUNTIME_PREFIX="$UCLIBC_DLPREFIX/" DEVEL_PREFIX="$UCLIBC_DLPREFIX/" \
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
65 UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow
b970ffb2eb4d Work around problem with the make -j dependencies of uClibc.
Rob Landley <rob@landley.net>
parents: 530
diff changeset
66 done
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
67 cd ..
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
68
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
69 cleanup uClibc
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
70
311
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 310
diff changeset
71 # Build and install toybox
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 310
diff changeset
72
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 310
diff changeset
73 setupfor toybox
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 310
diff changeset
74 make defconfig &&
389
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
75 if [ -z "$USE_TOYBOX" ]
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
76 then
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
77 make CROSS="${ARCH}-" &&
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
78 cp toybox "$TOOLS/bin" &&
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
79 ln -s toybox "$TOOLS/bin/patch" &&
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
80 ln -s toybox "$TOOLS/bin/oneit" &&
530
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 527
diff changeset
81 #ln -s toybox "$TOOLS/bin/netcat" &&
389
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
82 cd ..
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
83 else
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
84 make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" &&
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
85 rm "${TOOLS}"/bin/sh && # Bash won't install if this exists.
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
86 cd ..
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 387
diff changeset
87 fi
311
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 310
diff changeset
88
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 310
diff changeset
89 cleanup toybox
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 310
diff changeset
90
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
91 # Build and install busybox
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
92
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
93 setupfor busybox
453
61a26b8092bf Busybox defconfig has become useless, so switch busybox to build via allyesconfig minus symbols to be disabled.
Rob Landley <rob@landley.net>
parents: 447
diff changeset
94 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
358
9829e6cc8637 Update busybox from 1.2.2 to 1.11.0. Toybox i still used for oneit and patch,
Rob Landley <rob@landley.net>
parents: 351
diff changeset
95 make -j $CPUS CROSS_COMPILE="${ARCH}-" &&
9829e6cc8637 Update busybox from 1.2.2 to 1.11.0. Toybox i still used for oneit and patch,
Rob Landley <rob@landley.net>
parents: 351
diff changeset
96 make busybox.links &&
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
97 cp busybox "${TOOLS}/bin"
453
61a26b8092bf Busybox defconfig has become useless, so switch busybox to build via allyesconfig minus symbols to be disabled.
Rob Landley <rob@landley.net>
parents: 447
diff changeset
98
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
99 [ $? -ne 0 ] && dienow
453
61a26b8092bf Busybox defconfig has become useless, so switch busybox to build via allyesconfig minus symbols to be disabled.
Rob Landley <rob@landley.net>
parents: 447
diff changeset
100
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
101 for i in $(sed 's@.*/@@' busybox.links)
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
102 do
358
9829e6cc8637 Update busybox from 1.2.2 to 1.11.0. Toybox i still used for oneit and patch,
Rob Landley <rob@landley.net>
parents: 351
diff changeset
103 ln -s busybox "${TOOLS}/bin/$i" # || dienow
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
104 done
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
105 cd ..
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
106
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
107 cleanup busybox
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
108
598
5fa326c07bc4 Change NATIVE_TOOLCHAIN to work like all the other config variables: unset gives the default behavior.
Rob Landley <rob@landley.net>
parents: 597
diff changeset
109 if [ "$NATIVE_TOOLCHAIN" == "none" ]
496
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
110 then
510
d6182f514567 A system without development headers doesn't need static libraries either.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
111 # If we're not installing a compiler, delete the headers, static libs,
d6182f514567 A system without development headers doesn't need static libraries either.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
112 # and example source code.
d6182f514567 A system without development headers doesn't need static libraries either.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
113
496
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
114 rm -rf "${TOOLS}"/include &&
510
d6182f514567 A system without development headers doesn't need static libraries either.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
115 rm -rf "${TOOLS}"/lib/*.a &&
496
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
116 rm -rf "${TOOLS}/src" || dienow
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
117
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
118 elif [ "$NATIVE_TOOLCHAIN" == "headers" ]
423
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
119 then
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
120
496
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
121 # If you want to use a compiler other than gcc, you need to keep the headers,
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
122 # so do nothing here.
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
123 echo
423
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
124
310
3a1ae92d6f6a Teach BUILD_SHORT to remove include files (saving ~5 megs), and move the
Rob Landley <rob@landley.net>
parents: 306
diff changeset
125 else
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
126
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
127 # Build and install native binutils
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
128
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
129 setupfor binutils build-binutils
62
4125b672b00c Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents: 53
diff changeset
130 CC="${ARCH}-gcc" AR="${ARCH}-ar" "${CURSRC}/configure" --prefix="${TOOLS}" \
4125b672b00c Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents: 53
diff changeset
131 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
4125b672b00c Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents: 53
diff changeset
132 --disable-nls --disable-shared --disable-multilib --program-prefix= \
417
6dd7e870b1d4 No shipping package should ever use -Werror, no idea what new gcc versions will decide to warn on. (Fixes build on ubuntu 8.10.)
Rob Landley <rob@landley.net>
parents: 414
diff changeset
133 --disable-werror $BINUTILS_FLAGS &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 284
diff changeset
134 make -j $CPUS configure-host &&
182
fc827ab6166f Autodetect number of processors and feed appropriate -j to make.
Rob Landley <rob@landley.net>
parents: 177
diff changeset
135 make -j $CPUS &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 284
diff changeset
136 make -j $CPUS install &&
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
137 cd .. &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
138 mkdir -p "${TOOLS}/include" &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
139 cp binutils/include/libiberty.h "${TOOLS}/include"
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
140
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
141 cleanup binutils build-binutils
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
142
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
143 # Build and install native gcc, with c++ support this time.
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
144
223
f6973e090c4f Update mini-native for the new tarball strategy.
Rob Landley <rob@landley.net>
parents: 221
diff changeset
145 setupfor gcc-core build-gcc
f6973e090c4f Update mini-native for the new tarball strategy.
Rob Landley <rob@landley.net>
parents: 221
diff changeset
146 setupfor gcc-g++ build-gcc gcc-core
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
147 # GCC tries to "help out in the kitchen" by screwing up the linux include
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
148 # files. Cut out those bits with sed and throw them away.
295
bbfb6e7bf7e6 Add first pass at Super Hitachi platform.
Rob Landley <rob@landley.net>
parents: 294
diff changeset
149 sed -i 's@^STMP_FIX.*@@' "${CURSRC}/gcc/Makefile.in" &&
46
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
150 # GCC has some deep assumptions about the name of the cross-compiler it should
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
151 # be using. These assumptions are wrong, and lots of redundant corrections
294
87df194d555d Back to gcc 4.1.2 until I find a large enough rock to fix the soft-float thing.
Rob Landley <rob@landley.net>
parents: 293
diff changeset
152 # are required to make it stop.
87df194d555d Back to gcc 4.1.2 until I find a large enough rock to fix the soft-float thing.
Rob Landley <rob@landley.net>
parents: 293
diff changeset
153 CC="${ARCH}-gcc" GCC_FOR_TARGET="${ARCH}-gcc" CC_FOR_TARGET="${ARCH}-gcc" \
87df194d555d Back to gcc 4.1.2 until I find a large enough rock to fix the soft-float thing.
Rob Landley <rob@landley.net>
parents: 293
diff changeset
154 AR="${ARCH}-ar" AR_FOR_TARGET="${ARCH}-ar" AS="${ARCH}-as" LD="${ARCH}-ld" \
443
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
155 NM="${ARCH}-nm" NM_FOR_TARGET="${ARCH}-nm" CXX_FOR_TARGET="${ARCH}-g++" \
294
87df194d555d Back to gcc 4.1.2 until I find a large enough rock to fix the soft-float thing.
Rob Landley <rob@landley.net>
parents: 293
diff changeset
156 "${CURSRC}/configure" --prefix="${TOOLS}" --disable-multilib \
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
157 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
158 --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
159 --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \
445
c2215a078923 On arm, gcc has an internal compiler error building dwarf2 exceptions in mini-native. (Yes, it dies builing _itself_.) Switch to setjmp/longjmp excpetions.
Rob Landley <rob@landley.net>
parents: 443
diff changeset
160 --disable-libstdcxx-pch --enable-sjlj-exceptions --program-prefix="" \
443
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
161 $GCC_FLAGS &&
517
89b2e2c55b28 Give mini-native.sh the same xgcc bypass trick cross-compiler.sh uses.
Rob Landley <rob@landley.net>
parents: 516
diff changeset
162 mkdir gcc &&
89b2e2c55b28 Give mini-native.sh the same xgcc bypass trick cross-compiler.sh uses.
Rob Landley <rob@landley.net>
parents: 516
diff changeset
163 ln -s `which "${ARCH}-gcc"` gcc/xgcc &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 284
diff changeset
164 make -j $CPUS configure-host &&
182
fc827ab6166f Autodetect number of processors and feed appropriate -j to make.
Rob Landley <rob@landley.net>
parents: 177
diff changeset
165 make -j $CPUS all-gcc &&
456
2a308aa24aec Make gcc stop putting stuff in a lib64 directory on x86-64 even when we --disable-multilib, and remove spurious uClibc warnings about trying to use the cross compiler to "make allnoconfig".
Rob Landley <rob@landley.net>
parents: 453
diff changeset
166 # Work around gcc bug; we disabled multilib but it doesn't always notice.
2a308aa24aec Make gcc stop putting stuff in a lib64 directory on x86-64 even when we --disable-multilib, and remove spurious uClibc warnings about trying to use the cross compiler to "make allnoconfig".
Rob Landley <rob@landley.net>
parents: 453
diff changeset
167 ln -s lib "$TOOLS/lib64" &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 284
diff changeset
168 make -j $CPUS install-gcc &&
456
2a308aa24aec Make gcc stop putting stuff in a lib64 directory on x86-64 even when we --disable-multilib, and remove spurious uClibc warnings about trying to use the cross compiler to "make allnoconfig".
Rob Landley <rob@landley.net>
parents: 453
diff changeset
169 rm "$TOOLS/lib64" &&
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
170 ln -s gcc "${TOOLS}/bin/cc" &&
443
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
171 # Now we need to beat libsupc++ out of gcc (which uClibc++ needs to build).
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
172 # But don't want to build the whole of libstdc++-v3 because
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
173 # A) we're using uClibc++ instead, B) the build breaks.
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
174 make -j $CPUS configure-target-libstdc++-v3 &&
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
175 cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ &&
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
176 make -j $CPUS &&
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
177 mv .libs/libsupc++.a "$TOOLS"/lib &&
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
178 cd ../../../..
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
179
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
180 cleanup gcc-core build-gcc
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
181
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
182 # Move the gcc internal libraries and headers somewhere sane, and
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
183 # build and install gcc wrapper script.
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
184
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
185 mkdir -p "${TOOLS}"/gcc &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
186 mv "${TOOLS}"/lib/gcc/*/*/include "${TOOLS}"/gcc/include &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
187 mv "${TOOLS}"/lib/gcc/*/* "${TOOLS}"/gcc/lib &&
390
a9a9eee9e620 Teach the wrapper script to do the libgcc_s --as-needed stuff when
Rob Landley <rob@landley.net>
parents: 389
diff changeset
188 mv "${TOOLS}/bin/gcc" "${TOOLS}/bin/rawgcc" &&
546
a7f128fc53b5 Rename gcc-uClibc.c to ccwrap.c
Rob Landley <rob@landley.net>
parents: 544
diff changeset
189 "${ARCH}-gcc" "${SOURCES}"/toys/ccwrap.c -Os -s -o "${TOOLS}/bin/gcc" \
432
b697ea9d73f3 Use the wrapper for g++, and clean up compiler install slightly better.
Rob Landley <rob@landley.net>
parents: 424
diff changeset
190 -DGCC_UNWRAPPED_NAME='"rawgcc"' -DGIMME_AN_S &&
443
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
191
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
192 # Wrap C++
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
193 mv "${TOOLS}/bin/g++" "${TOOLS}/bin/rawg++" &&
432
b697ea9d73f3 Use the wrapper for g++, and clean up compiler install slightly better.
Rob Landley <rob@landley.net>
parents: 424
diff changeset
194 ln "${TOOLS}/bin/gcc" "${TOOLS}/bin/g++" &&
443
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
195 rm "${TOOLS}/bin/c++" &&
432
b697ea9d73f3 Use the wrapper for g++, and clean up compiler install slightly better.
Rob Landley <rob@landley.net>
parents: 424
diff changeset
196 ln -s g++ "${TOOLS}/bin/c++"
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
197
432
b697ea9d73f3 Use the wrapper for g++, and clean up compiler install slightly better.
Rob Landley <rob@landley.net>
parents: 424
diff changeset
198 cleanup "${TOOLS}"/{lib/gcc,gcc/lib/install-tools,bin/${ARCH}-unknown-*}
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
199
443
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
200 # Tell future packages to link against the libraries in mini-native,
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
201 # rather than the ones in the cross compiler directory.
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
202
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
203 export WRAPPER_TOPDIR="${TOOLS}"
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
204
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
205 # Build and install uClibc++
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
206
447
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
207 setupfor uClibc++
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
208 CROSS= make defconfig &&
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
209 sed -r -i 's/(UCLIBCXX_HAS_(TLS|LONG_DOUBLE))=y/# \1 is not set/' .config &&
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
210 sed -r -i '/UCLIBCXX_RUNTIME_PREFIX=/s/".*"/""/' .config &&
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
211 CROSS= make oldconfig &&
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
212 CROSS="$ARCH"- make &&
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
213 CROSS= make install PREFIX="${TOOLS}/c++" &&
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
214
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
215 # Move libraries somewhere useful.
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
216
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
217 mv "${TOOLS}"/c++/lib/* "${TOOLS}"/lib &&
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
218 rm -rf "${TOOLS}"/c++/{lib,bin} &&
470
919121ba6c5c Move uClibc 0.9.30 build from unstable to stable (and an unrelated fix: symlink uClibc++.a like .so).
Rob Landley <rob@landley.net>
parents: 456
diff changeset
219 ln -s libuClibc++.so "${TOOLS}"/lib/libstdc++.so &&
479
06d7357c87fd Fix uClibc++ cleanup.
Rob Landley <rob@landley.net>
parents: 470
diff changeset
220 ln -s libuClibc++.a "${TOOLS}"/lib/libstdc++.a &&
06d7357c87fd Fix uClibc++ cleanup.
Rob Landley <rob@landley.net>
parents: 470
diff changeset
221 cd ..
447
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
222
4ed02d53fc92 Add C++ support to native compiler, based on uClibc++.
Rob Landley <rob@landley.net>
parents: 445
diff changeset
223 cleanup uClibc++
443
716b7af6d8c3 Build libsupc++.a in preparation for building uClibc++.
Rob Landley <rob@landley.net>
parents: 432
diff changeset
224
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
225 # Build and install make
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
226
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
227 setupfor make
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
228 CC="${ARCH}-gcc" ./configure --prefix="${TOOLS}" --build="${CROSS_HOST}" \
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
229 --host="${CROSS_TARGET}" &&
182
fc827ab6166f Autodetect number of processors and feed appropriate -j to make.
Rob Landley <rob@landley.net>
parents: 177
diff changeset
230 make -j $CPUS &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 284
diff changeset
231 make -j $CPUS install &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
232 cd ..
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
233
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
234 cleanup make
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
235
482
3e9d715e4a11 Rename CROSS_BUILD_STATIC, NATIVE_NOTOOLSDIR, NATIVE_NOTOOLCHAIN and make them work properly.
Rob Landley <rob@landley.net>
parents: 479
diff changeset
236 # Remove the busybox /bin/sh link so the bash install doesn't get upset.
3e9d715e4a11 Rename CROSS_BUILD_STATIC, NATIVE_NOTOOLSDIR, NATIVE_NOTOOLCHAIN and make them work properly.
Rob Landley <rob@landley.net>
parents: 479
diff changeset
237
3e9d715e4a11 Rename CROSS_BUILD_STATIC, NATIVE_NOTOOLSDIR, NATIVE_NOTOOLCHAIN and make them work properly.
Rob Landley <rob@landley.net>
parents: 479
diff changeset
238 rm "$TOOLS"/bin/sh
3e9d715e4a11 Rename CROSS_BUILD_STATIC, NATIVE_NOTOOLSDIR, NATIVE_NOTOOLCHAIN and make them work properly.
Rob Landley <rob@landley.net>
parents: 479
diff changeset
239
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
240 # Build and install bash. (Yes, this is an old version. I prefer it.)
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
241 # I plan to replace it with toysh anyway.
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
242
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
243 setupfor bash
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
244 # wire around some tests ./configure can't run when cross-compiling.
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
245 cat > config.cache << EOF &&
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
246 ac_cv_func_setvbuf_reversed=no
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
247 bash_cv_sys_named_pipes=yes
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
248 bash_cv_have_mbstate_t=yes
66
57f77c25b39d Hit uClibc build with a large rock so it stops inserting hardwired paths in
Rob Landley <rob@landley.net>
parents: 63
diff changeset
249 bash_cv_getenv_redef=no
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
250 EOF
157
dff36fab9e7e Of course there's a bug. (The ranlib fix was apparently a NOP, this should
Rob Landley <rob@landley.net>
parents: 155
diff changeset
251 CC="${ARCH}-gcc" RANLIB="${ARCH}-ranlib" ./configure --prefix="${TOOLS}" \
153
106f3875f606 The bash build continues to be stupid. Force RANLIB.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
252 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \
106f3875f606 The bash build continues to be stupid. Force RANLIB.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
253 --without-bash-malloc --disable-readline &&
183
d2a27709d3b6 Fixup the -j stuff to actually work. (typo in gcc, and uClibc can't use it.)
Rob Landley <rob@landley.net>
parents: 182
diff changeset
254 # note: doesn't work with -j
d2a27709d3b6 Fixup the -j stuff to actually work. (typo in gcc, and uClibc can't use it.)
Rob Landley <rob@landley.net>
parents: 182
diff changeset
255 make &&
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
256 make install &&
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
257 # Make bash the default shell.
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
258 ln -s bash "${TOOLS}/bin/sh" &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
259 cd ..
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
260
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
261 cleanup bash
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
262
280
00ee362817e1 Cross-compile a native distcc for target.
Rob Landley <rob@landley.net>
parents: 278
diff changeset
263 setupfor distcc
544
fcdbdb1059fa Commit 527 broke distccd. Fix it. (Cross compiling remains fiddly.)
Rob Landley <rob@landley.net>
parents: 540
diff changeset
264 CC="${ARCH}-cc" ./configure --host="${CROSS_TARGET}" --prefix="${TOOLS}" \
613
518c8e257b3d Fixes Mark Miller sent for distcc support.
Rob Landley <rob@landley.net>
parents: 598
diff changeset
265 --with-included-popt --disable-Werror &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 284
diff changeset
266 make -j $CPUS &&
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 284
diff changeset
267 make -j $CPUS install &&
484
4b0507445452 Hook up c++ to distcc.
Rob Landley <rob@landley.net>
parents: 482
diff changeset
268 mkdir -p "${TOOLS}/distcc" || dienow
4b0507445452 Hook up c++ to distcc.
Rob Landley <rob@landley.net>
parents: 482
diff changeset
269
4b0507445452 Hook up c++ to distcc.
Rob Landley <rob@landley.net>
parents: 482
diff changeset
270 for i in gcc cc g++ c++
4b0507445452 Hook up c++ to distcc.
Rob Landley <rob@landley.net>
parents: 482
diff changeset
271 do
4b0507445452 Hook up c++ to distcc.
Rob Landley <rob@landley.net>
parents: 482
diff changeset
272 ln -s ../bin/distcc "${TOOLS}/distcc/$i" || dienow
4b0507445452 Hook up c++ to distcc.
Rob Landley <rob@landley.net>
parents: 482
diff changeset
273 done
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
274 cd ..
280
00ee362817e1 Cross-compile a native distcc for target.
Rob Landley <rob@landley.net>
parents: 278
diff changeset
275
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 295
diff changeset
276 cleanup distcc
280
00ee362817e1 Cross-compile a native distcc for target.
Rob Landley <rob@landley.net>
parents: 278
diff changeset
277
83
8fb80545fe84 Move the "hello world" source into sources/toys. Build (in mini-native)
Rob Landley <rob@landley.net>
parents: 81
diff changeset
278 # Put statically and dynamically linked hello world programs on there for
315
7fe514d773b9 Install setup script even for BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 311
diff changeset
279 # test purposes.
83
8fb80545fe84 Move the "hello world" source into sources/toys. Build (in mini-native)
Rob Landley <rob@landley.net>
parents: 81
diff changeset
280
8fb80545fe84 Move the "hello world" source into sources/toys. Build (in mini-native)
Rob Landley <rob@landley.net>
parents: 81
diff changeset
281 "${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -o "${TOOLS}/bin/hello-dynamic" &&
315
7fe514d773b9 Install setup script even for BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 311
diff changeset
282 "${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -static -o "${TOOLS}/bin/hello-static"
83
8fb80545fe84 Move the "hello world" source into sources/toys. Build (in mini-native)
Rob Landley <rob@landley.net>
parents: 81
diff changeset
283
8fb80545fe84 Move the "hello world" source into sources/toys. Build (in mini-native)
Rob Landley <rob@landley.net>
parents: 81
diff changeset
284 [ $? -ne 0 ] && dienow
8fb80545fe84 Move the "hello world" source into sources/toys. Build (in mini-native)
Rob Landley <rob@landley.net>
parents: 81
diff changeset
285
516
f846099333ac I can see the man pages being potentially useful, but info pages are a complete waste of space.
Rob Landley <rob@landley.net>
parents: 510
diff changeset
286 # Delete some unneeded files
f846099333ac I can see the man pages being potentially useful, but info pages are a complete waste of space.
Rob Landley <rob@landley.net>
parents: 510
diff changeset
287
579
05a608d26600 Delete man pages (they take up almost 2 megs) and consolidate some code.
Rob Landley <rob@landley.net>
parents: 576
diff changeset
288 rm -rf "${TOOLS}"/{info,man,libexec/gcc/*/*/install-tools}
516
f846099333ac I can see the man pages being potentially useful, but info pages are a complete waste of space.
Rob Landley <rob@landley.net>
parents: 510
diff changeset
289
496
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
290 # End of NATIVE_TOOLCHAIN
423
8029eb9a4a8c Split out BUILD_NOTOOLS from BUILD_SHORT.
Rob Landley <rob@landley.net>
parents: 417
diff changeset
291
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
292 fi
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
293
75
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 68
diff changeset
294 # Clean up and package the result
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
295
53
3fd961e31444 Build a gcc wrapper for _target_, and add a "strip" command to halve the
Rob Landley <rob@landley.net>
parents: 52
diff changeset
296 "${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*}
626
189dc4e359ec Strip shared libraries to save more space.
Rob Landley <rob@landley.net>
parents: 613
diff changeset
297 "${ARCH}-strip" --strip-unneeded "${TOOLS}"/lib/*
53
3fd961e31444 Build a gcc wrapper for _target_, and add a "strip" command to halve the
Rob Landley <rob@landley.net>
parents: 52
diff changeset
298
75
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 68
diff changeset
299 echo -n creating mini-native-"${ARCH}".tar.bz2 &&
482
3e9d715e4a11 Rename CROSS_BUILD_STATIC, NATIVE_NOTOOLSDIR, NATIVE_NOTOOLCHAIN and make them work properly.
Rob Landley <rob@landley.net>
parents: 479
diff changeset
300 cd "${BUILD}" &&
75
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 68
diff changeset
301 { tar cjvf "mini-native-${ARCH}.tar.bz2" "mini-native-${ARCH}" || dienow
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 68
diff changeset
302 } | dotprogress
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 68
diff changeset
303
576
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
304 # If we're building something with a $BASE_ARCH, symlink to actual target name.
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
305
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
306 if [ "$ARCH" != "$ARCH_NAME" ]
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
307 then
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
308 rm -rf "mini-native-$ARCH_NAME"{,.tar.bz2} &&
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
309 ln -s mini-native-"$ARCH" mini-native-"$ARCH_NAME" &&
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
310 ln -s mini-native-"$ARCH".tar.bz2 mini-native-"$ARCH_NAME".tar.bz2 ||
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
311 dienow
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
312 fi
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
313
036dbe218036 Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents: 572
diff changeset
314
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
315 # Color back to normal
52
6d6551a37687 Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents: 51
diff changeset
316 echo -e "\e[0mBuild complete"