Mercurial > hg > aboriginal
annotate sources/functions.sh @ 1737:1acbe7e78d9d draft
Switch from bz2 to gz tarball output.
bz2 is slowly being replaced by lz variants, but gzip isn't going anywhere.
(It retains a niche as a streaming protocol, it's the 80/20 solution optimizing
for speed, low memory requirements, and simple compressor implementation.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 20 Feb 2015 13:12:45 -0600 |
parents | b89324905ca2 |
children | cdc277cf7b83 |
rev | line source |
---|---|
840 | 1 #!/bin/echo "This file is sourced, not run" |
2 | |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Lots of reusable functions. This file is sourced, not run. |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
1090
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1084
diff
changeset
|
5 # Output path to cross compiler. |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
6 |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
7 cc_path() |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
8 { |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
9 local i |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
10 |
1090
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1084
diff
changeset
|
11 # Output cross it if exists, else simple. If neither exists, output simple. |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1084
diff
changeset
|
12 |
944
fc134a13357e
Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents:
942
diff
changeset
|
13 for i in "$BUILD"/{,simple-}cross-compiler-"$1/bin" |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
14 do |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
15 [ -e "$i/$1-cc" ] && break |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
16 done |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
17 echo -n "$i:" |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
18 } |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
19 |
1401
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
20 base_architecture() |
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
21 { |
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
22 ARCH="$1" |
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
23 source "$CONFIG_DIR/$1" |
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
24 } |
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
25 |
1398
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
26 load_target() |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
27 { |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
28 # Get target platform from first command line argument. |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
29 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
30 ARCH_NAME="$1" |
1398
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
31 CONFIG_DIR="$SOURCES/targets" |
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
32 |
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
33 # Read the relevant config file. |
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
34 |
1401
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
35 if [ -f "$CONFIG_DIR/$1" ] |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
36 then |
1401
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
37 base_architecture "$ARCH_NAME" |
1398
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
38 CONFIG_DIR= |
1401
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
39 elif [ -f "$CONFIG_DIR/$1/settings" ] |
1398
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
40 then |
1401
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
41 source "$CONFIG_DIR/$1/settings" |
f1d2afdf2034
Add base_architecture, make base architectures and extra targets work, and move i586 virtio stuff to new i686-kvm target.
Rob Landley <rob@landley.net>
parents:
1400
diff
changeset
|
42 [ -z "$ARCH" ] && dienow "No base_architecture" |
1398
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
43 else |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
44 echo "Supported architectures: " |
1398
b74d36876c0a
Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
Rob Landley <rob@landley.net>
parents:
1391
diff
changeset
|
45 ls "$CONFIG_DIR" |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
46 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
47 exit 1 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
48 fi |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
49 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
50 # Which platform are we building for? |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
51 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
52 export WORK="${BUILD}/temp-$ARCH_NAME" |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
53 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
54 # Say "unknown" in two different ways so it doesn't assume we're NOT |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
55 # cross compiling when the host and target are the same processor. (If host |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
56 # and target match, the binutils/gcc/make builds won't use the cross compiler |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
57 # during root-filesystem.sh, and the host compiler links binaries against the |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
58 # wrong libc.) |
984
9840847885e8
Add export_if_blank and make lots of build paths overrideable.
Rob Landley <rob@landley.net>
parents:
973
diff
changeset
|
59 export_if_blank CROSS_HOST=`uname -m`-walrus-linux |
1090
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1084
diff
changeset
|
60 export_if_blank CROSS_TARGET=${ARCH}-unknown-linux |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
61 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
62 # Setup directories and add the cross compiler to the start of the path. |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
63 |
844
ea9af6c73dbf
Use the ARCH_NAME rather than ARCH when making stage directories. The only place we don't run check_for_base_arch is system-image, and here we want this to differ because of the kernels.
Mark Miller <mark@mirell.org>
parents:
840
diff
changeset
|
64 STAGE_DIR="$BUILD/${STAGE_NAME}-${ARCH_NAME}" |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
65 |
1099
3c6263354ca9
Blank $STAGE_DIR before adjusting $PATH so building the cross-compiler stage doesn't get confused if it dies during the uClibc++ build and gets re-run (adjusting the path to point to the cross compiler we're about to delete and rebuild). Make NO_CLEANUP explicit in system-image.sh so it can rebuild zImage and squashfs independently by default.
Rob Landley <rob@landley.net>
parents:
1098
diff
changeset
|
66 blank_tempdir "$STAGE_DIR" |
3c6263354ca9
Blank $STAGE_DIR before adjusting $PATH so building the cross-compiler stage doesn't get confused if it dies during the uClibc++ build and gets re-run (adjusting the path to point to the cross compiler we're about to delete and rebuild). Make NO_CLEANUP explicit in system-image.sh so it can rebuild zImage and squashfs independently by default.
Rob Landley <rob@landley.net>
parents:
1098
diff
changeset
|
67 blank_tempdir "$WORK" |
3c6263354ca9
Blank $STAGE_DIR before adjusting $PATH so building the cross-compiler stage doesn't get confused if it dies during the uClibc++ build and gets re-run (adjusting the path to point to the cross compiler we're about to delete and rebuild). Make NO_CLEANUP explicit in system-image.sh so it can rebuild zImage and squashfs independently by default.
Rob Landley <rob@landley.net>
parents:
1098
diff
changeset
|
68 |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
69 export PATH="$(cc_path "$ARCH")$PATH" |
1090
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1084
diff
changeset
|
70 [ ! -z "$HOST_ARCH" ] && [ "$HOST_ARCH" != "$ARCH" ] && |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1084
diff
changeset
|
71 PATH="$(cc_path "$HOST_ARCH")$PATH" |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
72 |
944
fc134a13357e
Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents:
942
diff
changeset
|
73 DO_CROSS="CROSS_COMPILE=${ARCH}-" |
798
2c9f22daa8fe
Allow target settings to specify BUILD_STATIC.
Rob Landley <rob@landley.net>
parents:
796
diff
changeset
|
74 |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
75 return 0 |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
76 } |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
727
diff
changeset
|
77 |
820
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
78 # Note that this sources the file, rather than calling it as a separate |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
79 # process. That way it can set environment variables if it wants to. |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
80 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
81 build_section() |
820
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
82 { |
1084
b52ba5df878d
Don't build anything statically in host-tools.sh, glibc is broken.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
83 # Don't build anything statically in host-tools, glibc is broken. |
b52ba5df878d
Don't build anything statically in host-tools.sh, glibc is broken.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
84 # See http://people.redhat.com/drepper/no_static_linking.html for |
b52ba5df878d
Don't build anything statically in host-tools.sh, glibc is broken.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
85 # insane rant from the glibc maintainer about why he doesn't care. |
b52ba5df878d
Don't build anything statically in host-tools.sh, glibc is broken.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
86 is_in_list $1 $BUILD_STATIC && [ ! -z "$ARCH" ] && STATIC_FLAGS="--static" |
b52ba5df878d
Don't build anything statically in host-tools.sh, glibc is broken.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
87 |
1200
8651437b2b44
Add DEBUG_PACKAGE config variable to build just one package with CPUS=1.
Rob Landley <rob@landley.net>
parents:
1184
diff
changeset
|
88 OLDCPUS=$CPUS |
1517
a246e0b13639
Bug fix: DEBUG_PACKAGE shouldn't pollute NO_CLEANUP.
Rob Landley <rob@landley.net>
parents:
1461
diff
changeset
|
89 OLDNOCLEAN=$NO_CLEANUP |
a246e0b13639
Bug fix: DEBUG_PACKAGE shouldn't pollute NO_CLEANUP.
Rob Landley <rob@landley.net>
parents:
1461
diff
changeset
|
90 is_in_list $1 $DEBUG_PACKAGE && CPUS=1 && NO_CLEANUP=1 |
1200
8651437b2b44
Add DEBUG_PACKAGE config variable to build just one package with CPUS=1.
Rob Landley <rob@landley.net>
parents:
1184
diff
changeset
|
91 |
938
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
92 if [ -e "$SOURCES/sections/$1".build ] |
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
93 then |
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
94 setupfor "$1" |
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
95 . "$SOURCES/sections/$1".build |
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
96 cleanup |
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
97 else |
1358
9252453c40d0
Combine set_titlebar and "echo ===" stuff into announce() function. Consistently output target/stage info, and yank redundant instances.
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
98 announce "$1" |
938
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
99 . "$SOURCES"/sections/"$1".sh |
609bc05b0d6a
Teach build_section to run "*.build" sections (with setupfor/cleanup called for them) as well as "*.sh" sections which do their own setup/cleanup.
Rob Landley <rob@landley.net>
parents:
936
diff
changeset
|
100 fi |
1200
8651437b2b44
Add DEBUG_PACKAGE config variable to build just one package with CPUS=1.
Rob Landley <rob@landley.net>
parents:
1184
diff
changeset
|
101 CPUS=$OLDCPUS |
1517
a246e0b13639
Bug fix: DEBUG_PACKAGE shouldn't pollute NO_CLEANUP.
Rob Landley <rob@landley.net>
parents:
1461
diff
changeset
|
102 NO_CLEANUP=$OLDNOCLEAN |
820
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
103 } |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
104 |
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:
494
diff
changeset
|
105 # Find appropriate miniconfig file |
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:
494
diff
changeset
|
106 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
107 getconfig() |
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:
494
diff
changeset
|
108 { |
1552
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
109 for i in {$ARCH_NAME,$ARCH}/miniconfig-$1 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
110 do |
1152
2f39d1bfb2fd
Add baseconfig-linux, the infrastructure to use it, and move over the arm targets. (You can override with a miniconfig-linux or miniconfig-uClibc in the appropriate target directory.)
Rob Landley <rob@landley.net>
parents:
1107
diff
changeset
|
111 [ -f "$CONFIG_DIR/$i" ] && cat "$CONFIG_DIR/$i" && return |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
112 done |
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:
494
diff
changeset
|
113 |
1152
2f39d1bfb2fd
Add baseconfig-linux, the infrastructure to use it, and move over the arm targets. (You can override with a miniconfig-linux or miniconfig-uClibc in the appropriate target directory.)
Rob Landley <rob@landley.net>
parents:
1107
diff
changeset
|
114 # Output baseconfig, then append $1_CONFIG (converting $1 to uppercase) |
2f39d1bfb2fd
Add baseconfig-linux, the infrastructure to use it, and move over the arm targets. (You can override with a miniconfig-linux or miniconfig-uClibc in the appropriate target directory.)
Rob Landley <rob@landley.net>
parents:
1107
diff
changeset
|
115 cat "$SOURCES/baseconfig-$1" |
2f39d1bfb2fd
Add baseconfig-linux, the infrastructure to use it, and move over the arm targets. (You can override with a miniconfig-linux or miniconfig-uClibc in the appropriate target directory.)
Rob Landley <rob@landley.net>
parents:
1107
diff
changeset
|
116 eval "echo \"\${$(echo $1 | tr a-z A-Z)_CONFIG}\"" |
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:
494
diff
changeset
|
117 } |
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:
494
diff
changeset
|
118 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
119 # Find all files in $STAGE_DIR newer than $CURSRC. |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
120 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
121 recent_binary_files() |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
122 { |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
123 PREVIOUS= |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
124 (cd "$STAGE_DIR" || dienow |
1390
ac60cab45463
Remove FWL debris and rename do_rename to do_manifest while we're at it. (Based on prompting from Alessio Bogani).
Rob Landley <rob@landley.net>
parents:
1389
diff
changeset
|
125 find . -depth -newer "$CURSRC/BUILD-TIMESTAMP" \ |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
126 | sed -e 's/^.//' -e 's/^.//' -e '/^$/d' |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
127 ) | while read i |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
128 do |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
129 TEMP="${PREVIOUS##"$i"/}" |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
130 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
131 if [ $[${#PREVIOUS}-${#TEMP}] -ne $[${#i}+1] ] |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
132 then |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
133 # Because the expanded $i might have \ chars in it, that's why. |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
134 echo -n "$i" |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
135 echo -ne '\0' |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
136 fi |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
137 PREVIOUS="$i" |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
138 done |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
139 } |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
140 |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
141 # Delete a working copy of source code once the build's done. |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
142 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
143 cleanup() |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
144 { |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
145 # If package build exited with an error, do not continue. |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
146 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
147 [ $? -ne 0 ] && dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
148 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
149 if [ ! -z "$BINARY_PACKAGE_TARBALLS" ] |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
150 then |
1737
1acbe7e78d9d
Switch from bz2 to gz tarball output.
Rob Landley <rob@landley.net>
parents:
1728
diff
changeset
|
151 TARNAME="$PACKAGE-$STAGE_NAME-${ARCH_NAME}".tar.gz |
1391
42ec661e3916
Fix BINARY_PACKAGE_TARBALLS generation: some packages produce no output (zlib used to build dropbear for example), and thus check for an empty list before trying to make a tarball.
Rob Landley <rob@landley.net>
parents:
1390
diff
changeset
|
152 [ ! -z "$(recent_binary_files)" ] && |
42ec661e3916
Fix BINARY_PACKAGE_TARBALLS generation: some packages produce no output (zlib used to build dropbear for example), and thus check for an empty list before trying to make a tarball.
Rob Landley <rob@landley.net>
parents:
1390
diff
changeset
|
153 echo -n Creating "$TARNAME" && |
1737
1acbe7e78d9d
Switch from bz2 to gz tarball output.
Rob Landley <rob@landley.net>
parents:
1728
diff
changeset
|
154 { recent_binary_files | xargs -0 tar -czvf \ |
1391
42ec661e3916
Fix BINARY_PACKAGE_TARBALLS generation: some packages produce no output (zlib used to build dropbear for example), and thus check for an empty list before trying to make a tarball.
Rob Landley <rob@landley.net>
parents:
1390
diff
changeset
|
155 "$BUILD/${TARNAME}" -C "$STAGE_DIR" || dienow |
42ec661e3916
Fix BINARY_PACKAGE_TARBALLS generation: some packages produce no output (zlib used to build dropbear for example), and thus check for an empty list before trying to make a tarball.
Rob Landley <rob@landley.net>
parents:
1390
diff
changeset
|
156 } | dotprogress |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
157 fi |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
158 |
567
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
159 if [ ! -z "$NO_CLEANUP" ] |
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
160 then |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
161 echo "skip cleanup $PACKAGE $@" |
567
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
162 return |
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
163 fi |
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
164 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
165 # Loop deleting directories |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
166 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
167 cd "$WORK" || dienow |
1183
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
168 for i in $WORKDIR_LIST |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
169 do |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
170 echo "cleanup $i" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
171 rm -rf "$i" || dienow |
1183
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
172 done |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
173 WORKDIR_LIST= |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
174 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
175 |
1183
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
176 # Create a working directory under TMPDIR, deleting existing contents (if any), |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
177 # and tracking created directories so cleanup can delete them automatically. |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
178 |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
179 blank_workdir() |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
180 { |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
181 WORKDIR_LIST="$1 $WORKDIR_LIST" |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
182 NO_CLEANUP= blank_tempdir "$WORK/$1" |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
183 cd "$WORK/$1" || dienow |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
184 } |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
185 |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
186 # Extract package $1 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
187 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
188 setupfor() |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
189 { |
897
850da666acc6
Redo command recording: no longer RECORD_COMMMANDS config entry, now sources/more/record-commands.sh run to set up the wrapper (either before or after host-tools.sh). General cleanup and simplification of code this interacted with, plus clean up bit rot in the reporting.
Rob Landley <rob@landley.net>
parents:
844
diff
changeset
|
190 export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.${ARCH_NAME}.${STAGE_NAME}.setupfor" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
191 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
192 # Make sure the source is already extracted and up-to-date. |
1184
aa8992b35e15
Make extract_package directly callable, and do so where necessary.
Rob Landley <rob@landley.net>
parents:
1183
diff
changeset
|
193 extract_package "$1" || exit 1 |
1582
6a8114c148d1
Lots of small improvements: check for toybox instead of busybox for host-tools $PATH adjustment, better manifest generation (with toybox in list), make package_cache function to find extracted source (so root-image.sh works when packages contains linux-git snapshot), fix more/record-commands.sh path adjustment.
Rob Landley <rob@landley.net>
parents:
1553
diff
changeset
|
194 SNAPFROM="$(package_cache "$1")" |
760
2537f30c2397
Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents:
744
diff
changeset
|
195 |
1183
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
196 # Delete old working copy (even in the NO_CLEANUP case) then make a new |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
197 # tree of links to the package cache. |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
198 |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
199 echo "Snapshot '$PACKAGE'..." |
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
200 |
1553
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
201 # Try hardlink, then symlink, then normal (noclobber) copy |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
202 for LINKTYPE in l s n |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
203 do |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
204 if [ -z "$REUSE_CURSRC" ] |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
205 then |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
206 blank_workdir "$PACKAGE" |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
207 CURSRC="$(pwd)" |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
208 fi |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
209 |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
210 cp -${LINKTYPE}fR "$SNAPFROM/"* "$CURSRC" && break |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
211 done |
da21ff27331e
Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
Rob Landley <rob@landley.net>
parents:
1552
diff
changeset
|
212 |
1183
61e7e9be8eb4
Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents:
1162
diff
changeset
|
213 cd "$CURSRC" || dienow |
897
850da666acc6
Redo command recording: no longer RECORD_COMMMANDS config entry, now sources/more/record-commands.sh run to set up the wrapper (either before or after host-tools.sh). General cleanup and simplification of code this interacted with, plus clean up bit rot in the reporting.
Rob Landley <rob@landley.net>
parents:
844
diff
changeset
|
214 export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.${ARCH_NAME}.${STAGE_NAME}.$1" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
215 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
216 # Ugly bug workaround: timestamp granularity in a lot of filesystems is only |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
217 # 1 second, so find -newer misses things installed in the same second, so we |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
218 # make sure it's a new second before we start actually doing anything. |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
219 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
220 if [ ! -z "$BINARY_PACKAGE_TARBALLS" ] |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
221 then |
1390
ac60cab45463
Remove FWL debris and rename do_rename to do_manifest while we're at it. (Based on prompting from Alessio Bogani).
Rob Landley <rob@landley.net>
parents:
1389
diff
changeset
|
222 touch "$CURSRC/BUILD-TIMESTAMP" || dienow |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
223 TIME=$(date +%s) |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
224 while true |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
225 do |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
226 [ $TIME != "$(date +%s)" ] && break |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
227 sleep .1 |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
228 done |
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.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
229 fi |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
230 } |
440
59fe5a276991
Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents:
436
diff
changeset
|
231 |
1253
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
232 # Given a filename.tar.ext, return the version number. |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
233 |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
234 getversion() |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
235 { |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
236 echo "$1" | sed -e 's/.*-\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/'"$2"'\1/' |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
237 } |
d4b251e78fc0
Break out download_functions.sh into their own file.
Rob Landley <rob@landley.net>
parents:
1229
diff
changeset
|
238 |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
239 # Figure out what version of a package we last built |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
240 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
241 get_download_version() |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
242 { |
724
3ccce25660f4
Make MANIFEST generation less brittle.
Rob Landley <rob@landley.net>
parents:
720
diff
changeset
|
243 getversion $(sed -n 's@URL=.*/\(.[^ ]*\).*@\1@p' "$TOP/download.sh" | grep ${1}-) |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
244 } |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
245 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
246 # Identify subversion or mercurial revision, or release number |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
247 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
248 identify_release() |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
249 { |
1552
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
250 DIR="$SRCDIR/$1" |
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
251 if [ -d "$DIR" ] |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
252 then |
1552
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
253 ( |
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
254 cd "$DIR" || dienow |
1582
6a8114c148d1
Lots of small improvements: check for toybox instead of busybox for host-tools $PATH adjustment, better manifest generation (with toybox in list), make package_cache function to find extracted source (so root-image.sh works when packages contains linux-git snapshot), fix more/record-commands.sh path adjustment.
Rob Landley <rob@landley.net>
parents:
1553
diff
changeset
|
255 ID="$(git log -1 --format=%H 2>/dev/null)" |
1552
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
256 [ ! -z "$ID" ] && echo git "$ID" && return |
767
dc19e20734ca
Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents:
762
diff
changeset
|
257 |
1582
6a8114c148d1
Lots of small improvements: check for toybox instead of busybox for host-tools $PATH adjustment, better manifest generation (with toybox in list), make package_cache function to find extracted source (so root-image.sh works when packages contains linux-git snapshot), fix more/record-commands.sh path adjustment.
Rob Landley <rob@landley.net>
parents:
1553
diff
changeset
|
258 ID="$(hg identify -n 2>/dev/null)" |
1552
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
259 [ ! -z "$ID" ] && echo hg "$ID" && return |
760
2537f30c2397
Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents:
744
diff
changeset
|
260 |
1582
6a8114c148d1
Lots of small improvements: check for toybox instead of busybox for host-tools $PATH adjustment, better manifest generation (with toybox in list), make package_cache function to find extracted source (so root-image.sh works when packages contains linux-git snapshot), fix more/record-commands.sh path adjustment.
Rob Landley <rob@landley.net>
parents:
1553
diff
changeset
|
261 ID="$(svn info 2>/dev/null | sed -n "s/^Revision: //p")" |
1552
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
262 [ ! -z "$ID" ] && echo svn "$ID" && return |
c3b91b70cc42
Remove USE_ALT option, I have a better idea (upcoming patch).
Rob Landley <rob@landley.net>
parents:
1517
diff
changeset
|
263 ) |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
264 fi |
760
2537f30c2397
Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents:
744
diff
changeset
|
265 |
2537f30c2397
Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents:
744
diff
changeset
|
266 echo release version $(get_download_version $1) |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
267 } |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
268 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
269 # Create a README identifying package versions in current build. |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
270 |
1390
ac60cab45463
Remove FWL debris and rename do_rename to do_manifest while we're at it. (Based on prompting from Alessio Bogani).
Rob Landley <rob@landley.net>
parents:
1389
diff
changeset
|
271 do_manifest() |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
272 { |
1390
ac60cab45463
Remove FWL debris and rename do_rename to do_manifest while we're at it. (Based on prompting from Alessio Bogani).
Rob Landley <rob@landley.net>
parents:
1389
diff
changeset
|
273 # Grab build script version number |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
274 |
1390
ac60cab45463
Remove FWL debris and rename do_rename to do_manifest while we're at it. (Based on prompting from Alessio Bogani).
Rob Landley <rob@landley.net>
parents:
1389
diff
changeset
|
275 [ -z "$SCRIPT_VERS" ] && |
1582
6a8114c148d1
Lots of small improvements: check for toybox instead of busybox for host-tools $PATH adjustment, better manifest generation (with toybox in list), make package_cache function to find extracted source (so root-image.sh works when packages contains linux-git snapshot), fix more/record-commands.sh path adjustment.
Rob Landley <rob@landley.net>
parents:
1553
diff
changeset
|
276 SCRIPT_VERS="mercurial rev $(cd "$TOP"; hg identify -n 2>/dev/null)" |
662
1fa9eb882e3b
Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents:
647
diff
changeset
|
277 |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
278 cat << EOF |
662
1fa9eb882e3b
Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents:
647
diff
changeset
|
279 Built on $(date +%F) from: |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
280 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
281 Build script: |
1390
ac60cab45463
Remove FWL debris and rename do_rename to do_manifest while we're at it. (Based on prompting from Alessio Bogani).
Rob Landley <rob@landley.net>
parents:
1389
diff
changeset
|
282 Aboriginal Linux (http://landley.net/aboriginal) $SCRIPT_VERS |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
283 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
284 Base packages: |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
285 uClibc (http://uclibc.org) $(identify_release uClibc) |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
286 BusyBox (http://busybox.net) $(identify_release busybox) |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
287 Linux (http://kernel.org/pub/linux/kernel) $(identify_release linux) |
1582
6a8114c148d1
Lots of small improvements: check for toybox instead of busybox for host-tools $PATH adjustment, better manifest generation (with toybox in list), make package_cache function to find extracted source (so root-image.sh works when packages contains linux-git snapshot), fix more/record-commands.sh path adjustment.
Rob Landley <rob@landley.net>
parents:
1553
diff
changeset
|
288 toybox (http://landley.net/toybox) $(identify_release toybox) |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
289 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
290 Toolchain packages: |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
291 Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils) |
464
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
292 GCC (http://gcc.gnu.org) $(identify_release gcc-core) |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
293 gmake (http://www.gnu.org/software/make) $(identify_release make) |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
294 bash (ftp://ftp.gnu.org/gnu/bash) $(identify_release bash) |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
295 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
296 Optional packages: |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
297 distcc (http://distcc.samba.org) $(identify_release distcc) |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
298 uClibc++ (http://cxx.uclibc.org) $(identify_release uClibc++) |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
299 EOF |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
300 } |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
301 |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
302 # When building with a base architecture, symlink to the base arch name. |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
303 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
304 link_arch_name() |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
305 { |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
306 [ "$ARCH" == "$ARCH_NAME" ] && return 0 |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
307 |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
308 rm -rf "$BUILD/$2" && |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
309 ln -s "$1" "$BUILD/$2" || dienow |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
310 } |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
311 |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
312 # Check if this target has a base architecture that's already been built. |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
313 # If so, link to it and exit now. |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
314 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
315 check_for_base_arch() |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
316 { |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
317 # If we're building something with a base architecture, symlink to actual |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
318 # target. |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
319 |
898
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
320 if [ "$ARCH" != "$ARCH_NAME" ] |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
321 then |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
322 link_arch_name $STAGE_NAME-{"$ARCH","$ARCH_NAME"} |
1737
1acbe7e78d9d
Switch from bz2 to gz tarball output.
Rob Landley <rob@landley.net>
parents:
1728
diff
changeset
|
323 [ -e $STAGE_NAME-"$ARCH".tar.gz ] && |
1acbe7e78d9d
Switch from bz2 to gz tarball output.
Rob Landley <rob@landley.net>
parents:
1728
diff
changeset
|
324 link_arch_name $STAGE_NAME-{"$ARCH","$ARCH_NAME"}.tar.gz |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
325 |
898
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
326 if [ -e "$BUILD/$STAGE_NAME-$ARCH" ] |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
327 then |
1358
9252453c40d0
Combine set_titlebar and "echo ===" stuff into announce() function. Consistently output target/stage info, and yank redundant instances.
Rob Landley <rob@landley.net>
parents:
1253
diff
changeset
|
328 announce "Using existing ${STAGE_NAME}-$ARCH" |
898
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
329 |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
330 return 1 |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
331 else |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
332 mkdir -p "$BUILD/$STAGE_NAME-$ARCH" || dienow |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
333 fi |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
334 fi |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
335 } |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
336 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
337 create_stage_tarball() |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
338 { |
1033
87b3a69ca71c
Delete empty build/temp-* directories when we're done with them.
Rob Landley <rob@landley.net>
parents:
1012
diff
changeset
|
339 # Remove the temporary directory, if empty |
87b3a69ca71c
Delete empty build/temp-* directories when we're done with them.
Rob Landley <rob@landley.net>
parents:
1012
diff
changeset
|
340 |
87b3a69ca71c
Delete empty build/temp-* directories when we're done with them.
Rob Landley <rob@landley.net>
parents:
1012
diff
changeset
|
341 rmdir "$WORK" 2>/dev/null |
87b3a69ca71c
Delete empty build/temp-* directories when we're done with them.
Rob Landley <rob@landley.net>
parents:
1012
diff
changeset
|
342 |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
343 # Handle linking to base architecture if we just built a derivative target. |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
344 |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
345 cd "$BUILD" || dienow |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
346 link_arch_name $STAGE_NAME-{$ARCH,$ARCH_NAME} |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
347 |
988
30e4bab11f9e
Rename SKIP_STAGE_TARBALLS to NO_STAGE_TARBALLS (for consistency), and make system-image.sh use it instead of doing it by hand.
Rob Landley <rob@landley.net>
parents:
984
diff
changeset
|
348 if [ -z "$NO_STAGE_TARBALLS" ] |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
349 then |
1737
1acbe7e78d9d
Switch from bz2 to gz tarball output.
Rob Landley <rob@landley.net>
parents:
1728
diff
changeset
|
350 echo -n creating "$STAGE_NAME-${ARCH}".tar.gz |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
351 |
1737
1acbe7e78d9d
Switch from bz2 to gz tarball output.
Rob Landley <rob@landley.net>
parents:
1728
diff
changeset
|
352 { tar czvf "$STAGE_NAME-${ARCH}".tar.gz "$STAGE_NAME-${ARCH}" || dienow |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
353 } | dotprogress |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
354 |
1737
1acbe7e78d9d
Switch from bz2 to gz tarball output.
Rob Landley <rob@landley.net>
parents:
1728
diff
changeset
|
355 link_arch_name $STAGE_NAME-{$ARCH,$ARCH_NAME}.tar.gz |
685
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
356 fi |
90ab1a1f4db5
Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents:
683
diff
changeset
|
357 } |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
358 |
796
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
359 # Create colon-separated path for $HOSTTOOLS and all fallback directories |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
360 # (Fallback directories are to support ccache and distcc on the host.) |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
361 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1067
diff
changeset
|
362 hosttools_path() |
796
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
363 { |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
364 local X |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
365 |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
366 echo -n "$HOSTTOOLS" |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
367 X=1 |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
368 while [ -e "$HOSTTOOLS/fallback-$X" ] |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
369 do |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
370 echo -n ":$HOSTTOOLS/fallback-$X" |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
371 X=$[$X+1] |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
372 done |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
373 } |
1606
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
374 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
375 # Archive directory $1 to file $2 (plus extension), type SYSIMAGE_TYPE |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
376 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
377 image_filesystem() |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
378 { |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
379 # Embed an initramfs cpio |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
380 |
1728
b89324905ca2
Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents:
1631
diff
changeset
|
381 if [ "$SYSIMAGE_TYPE" == "cpio" ] || [ "$SYSIMAGE_TYPE" == "rootfs" ] |
1606
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
382 then |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
383 # Borrow gen_init_cpio.c out of package cache copy of Linux source |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
384 extract_package linux && |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
385 $CC "$(package_cache $PACKAGE)/usr/gen_init_cpio.c" -o "$WORK"/my_gen_init_cpio || |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
386 dienow |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
387 "$WORK"/my_gen_init_cpio <( |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
388 "$SOURCES"/toys/gen_initramfs_list.sh "$1" || dienow |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
389 [ ! -e "$1"/init ] && |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
390 echo "slink /init /sbin/init.sh 755 0 0" |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
391 [ ! -d "$1"/dev ] && echo "dir /dev 755 0 0" |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
392 echo "nod /dev/console 660 0 0 c 5 1" |
1728
b89324905ca2
Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents:
1631
diff
changeset
|
393 ) | gzip -9 > "$2.cpio.gz" || dienow |
1606
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
394 echo Initramfs generated. |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
395 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
396 elif [ "$SYSIMAGE_TYPE" == "ext2" ] || [ "$SYSIMAGE_TYPE" == "ext3" ] |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
397 then |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
398 # Generate axn ext2 filesystem image from the $1 directory, with a |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
399 # temporary file defining the /dev nodes for the new filesystem. |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
400 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
401 [ -z "$SYSIMAGE_HDA_MEGS" ] && SYSIMAGE_HDA_MEGS=64 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
402 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
403 # Produce a filesystem with the currently used space plus 20% for filesystem |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
404 # overhead, which should always be big enough. |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
405 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
406 BLOCKS=$[1024*(($(du -m -s "$1" | awk '{print $1}')*12)/10)] |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
407 [ $BLOCKS -lt 4096 ] && BLOCKS=4096 |
1631
18cafed76d65
Fix ext2/ext3 build failures
Guenter Roeck <linux@roeck-us.net>
parents:
1617
diff
changeset
|
408 FILE="$2.$SYSIMAGE_TYPE" |
1606
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
409 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
410 echo "/dev d 755 0 0 - - - - -" > "$WORK/devs" && |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
411 echo "/dev/console c 640 0 0 5 1 0 0 -" >> "$WORK/devs" && |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
412 genext2fs -z -D "$WORK/devs" -d "$1" -b $BLOCKS -i 1024 "$FILE" && |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
413 rm "$WORK/devs" || dienow |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
414 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
415 # Extend image size to HDA_MEGS if necessary, keeping it sparse. (Feeding |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
416 # a larger -b size to genext2fs is insanely slow, and not particularly |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
417 # sparse.) |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
418 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
419 if [ ! -z "$SYSIMAGE_HDA_MEGS" ] && |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
420 [ $((`stat -c %s "$FILE"` / (1024*1024) )) -lt "$SYSIMAGE_HDA_MEGS" ] |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
421 then |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
422 echo resizing image to $SYSIMAGE_HDA_MEGS |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
423 resize2fs "$FILE" ${SYSIMAGE_HDA_MEGS}M || dienow |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
424 fi |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
425 |
1631
18cafed76d65
Fix ext2/ext3 build failures
Guenter Roeck <linux@roeck-us.net>
parents:
1617
diff
changeset
|
426 tune2fs -c 0 -i 0 $([ "$SYS_IMAGE_TYPE" = "ext3" ] && echo -j) "$FILE" || dienow |
1606
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
427 echo $SYSIMAGE_TYPE generated |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
428 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
429 elif [ "$SYSIMAGE_TYPE" == "squashfs" ] |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
430 then |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
431 mksquashfs "$1" "$2.sqf" -noappend -all-root \ |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
432 ${FORK:+-no-progress} -p "/dev d 755 0 0" \ |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
433 -p "/dev/console c 666 0 0 5 1" || dienow |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
434 else |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
435 echo "Unknown image type $SYSIMAGE_TYPE" >&2 |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
436 dienow |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
437 fi |
941d2bf65620
Move image creation logic into sources/functions.sh so we can create cpio and squashfs in the same build.
Rob Landley <rob@landley.net>
parents:
1582
diff
changeset
|
438 } |