aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-11-21 10:11:01 +0000
committerDenys Vlasenko <vda.linux@googlemail.com>2018-11-27 10:38:10 +0100
commit7b42f8fc76d78fe9c6b0cbe15e1425f2fd9fb5e8 (patch)
treec18d535a6a1821a683f2bebf0370c1d77c4d86a1
parentdffc8ff6a638a4ae865821eb2d0852124c096c11 (diff)
downloadbusybox-w32-7b42f8fc76d78fe9c6b0cbe15e1425f2fd9fb5e8.tar.gz
busybox-w32-7b42f8fc76d78fe9c6b0cbe15e1425f2fd9fb5e8.tar.bz2
busybox-w32-7b42f8fc76d78fe9c6b0cbe15e1425f2fd9fb5e8.zip
Tweaks to build process for embedded scripts
- Force a rebuild if a script in applets_sh is changed. - Move the dummy usage messages for custom applets to usage.h and change the name from 'dummy' to 'scripted'. - Hide an error from gen_build_files.sh if an embed directory exists but is empty. - Tidy up embedded_scripts script. v2: Remove a couple of unnecessary tests in embedded_scripts, as pointed out by Xabier Oneca. Drop the stripping of comments. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--Makefile2
-rw-r--r--include/applets.src.h6
-rw-r--r--include/usage.src.h3
-rwxr-xr-xscripts/embedded_scripts22
-rwxr-xr-xscripts/gen_build_files.sh4
5 files changed, 14 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 4b5a01df9..f0b4da234 100644
--- a/Makefile
+++ b/Makefile
@@ -853,7 +853,7 @@ quiet_cmd_split_autoconf = SPLIT include/autoconf.h -> include/config/*
853quiet_cmd_gen_embedded_scripts = GEN include/embedded_scripts.h 853quiet_cmd_gen_embedded_scripts = GEN include/embedded_scripts.h
854 cmd_gen_embedded_scripts = $(srctree)/scripts/embedded_scripts include/embedded_scripts.h $(srctree)/embed $(srctree)/applets_sh 854 cmd_gen_embedded_scripts = $(srctree)/scripts/embedded_scripts include/embedded_scripts.h $(srctree)/embed $(srctree)/applets_sh
855#bbox# piggybacked generation of few .h files 855#bbox# piggybacked generation of few .h files
856include/config/MARKER: scripts/basic/split-include include/autoconf.h $(wildcard $(srctree)/embed/*) $(srctree)/scripts/embedded_scripts 856include/config/MARKER: scripts/basic/split-include include/autoconf.h $(wildcard $(srctree)/embed/*) $(wildcard $(srctree)/applets_sh/*) $(srctree)/scripts/embedded_scripts
857 $(call cmd,split_autoconf) 857 $(call cmd,split_autoconf)
858 $(call cmd,gen_bbconfigopts) 858 $(call cmd,gen_bbconfigopts)
859 $(call cmd,gen_common_bufsiz) 859 $(call cmd,gen_common_bufsiz)
diff --git a/include/applets.src.h b/include/applets.src.h
index a9db5d160..60968cec7 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -22,12 +22,6 @@ s - suid type:
22 BB_SUID_REQUIRE or BB_SUID_MAYBE applet. 22 BB_SUID_REQUIRE or BB_SUID_MAYBE applet.
23*/ 23*/
24 24
25#define NOUSAGE_STR "\b"
26
27#define dummy_trivial_usage NOUSAGE_STR \
28
29#define dummy_full_usage "" \
30
31#if defined(PROTOTYPES) 25#if defined(PROTOTYPES)
32# define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 26# define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
33# define APPLET_ODDNAME(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 27# define APPLET_ODDNAME(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/include/usage.src.h b/include/usage.src.h
index 00369dfb3..d22efd3ba 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -14,6 +14,9 @@
14 14
15#define NOUSAGE_STR "\b" 15#define NOUSAGE_STR "\b"
16 16
17#define scripted_trivial_usage NOUSAGE_STR
18#define scripted_full_usage ""
19
17#if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA 20#if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA
18# define CRYPT_METHODS_HELP_STR "des,md5,sha256/512" \ 21# define CRYPT_METHODS_HELP_STR "des,md5,sha256/512" \
19 " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")" 22 " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")"
diff --git a/scripts/embedded_scripts b/scripts/embedded_scripts
index c2e7c6961..86ad44d1d 100755
--- a/scripts/embedded_scripts
+++ b/scripts/embedded_scripts
@@ -81,21 +81,15 @@ exec >"$target.$$"
81if [ $n -ne 0 ] 81if [ $n -ne 0 ]
82then 82then
83 printf '#ifdef DEFINE_SCRIPT_DATA\n' 83 printf '#ifdef DEFINE_SCRIPT_DATA\n'
84 if [ $n -ne 0 ] 84 printf 'const uint16_t applet_numbers[] = {\n'
85 then 85 for i in $custom_scripts $applet_scripts
86 printf 'const uint16_t applet_numbers[] = {\n' 86 do
87 for i in $custom_scripts $applet_scripts 87 # TODO support applets with names including invalid characters
88 do 88 printf '\tAPPLET_NO_%s,\n' $i
89 # TODO support applets with names including invalid characters 89 done
90 printf '\tAPPLET_NO_%s,\n' $i 90 printf '};\n'
91 done
92 printf '};\n'
93 fi
94 printf '#else\n' 91 printf '#else\n'
95 if [ $n -ne 0 ] 92 printf 'extern const uint16_t applet_numbers[];\n'
96 then
97 printf 'extern const uint16_t applet_numbers[];\n'
98 fi
99 printf '#endif\n' 93 printf '#endif\n'
100fi 94fi
101 95
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index 64e4bffa9..362632df3 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -23,9 +23,9 @@ custom_scripts()
23 custom_loc="$1" 23 custom_loc="$1"
24 if [ -d "$custom_loc" ] 24 if [ -d "$custom_loc" ]
25 then 25 then
26 for i in $(cd "$custom_loc"; ls *) 26 for i in $(cd "$custom_loc"; ls * 2>/dev/null)
27 do 27 do
28 printf "APPLET_SCRIPTED(%s, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, dummy)\n" $i; 28 printf "APPLET_SCRIPTED(%s, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, scripted)\n" $i;
29 done 29 done
30 fi 30 fi
31} 31}