annotate scripts/genconfig.sh @ 432:01473712c9fe

Document that optflags is always an int (so 32 bit and 64 bit platforms behave the same).
author Rob Landley <rob@landley.net>
date Mon, 06 Feb 2012 21:15:19 -0600
parents 8b0487639db9
children 8f5780dd6da4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
2
239
4f1ca01db000 Fluff out hello.c to supply more example code as a skeleton for new commands,
Rob Landley <rob@landley.net>
parents: 233
diff changeset
3 # This has to be a separate file from scripts/make.sh so it can be called
4f1ca01db000 Fluff out hello.c to supply more example code as a skeleton for new commands,
Rob Landley <rob@landley.net>
parents: 233
diff changeset
4 # before menuconfig. (It's called again from scripts/make.sh just to be sure.)
4f1ca01db000 Fluff out hello.c to supply more example code as a skeleton for new commands,
Rob Landley <rob@landley.net>
parents: 233
diff changeset
5
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
6 mkdir -p generated
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
7 OUTFILE=generated/Config.in
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
8
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
9 genconfig()
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
10 {
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
11 # Probe for container support on target
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
12
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
13 echo -e "# container support\nconfig TOYBOX_CONTAINER\n\tbool" || return 1
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
14 $CC -c -xc -o /dev/null - 2>/dev/null << EOF
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
15 #include <sched.h>
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
16 int x=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET;
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
17 EOF
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
18 [ $? -eq 0 ] && DEFAULT=y || DEFAULT=n
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
19 echo -e "\tdefault $DEFAULT\n" || return 1
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
20
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
21 # extract config stanzas from each command source file, in alphabetical order
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
22
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
23 for i in $(ls -1 toys/*.c)
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
24 do
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
25 # Grab the config block for Config.in
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
26 echo "# $i"
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
27 sed -n '/^\*\//q;/^config [A-Z]/,$p' $i || return 1
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
28 echo
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
29 done
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
30 }
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents:
diff changeset
31
426
8b0487639db9 Add autodetect for container support.
Rob Landley <rob@landley.net>
parents: 239
diff changeset
32 genconfig > generated/Config.in || rm "$OUTFILE"