aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-07-27 12:20:18 +0100
committerRon Yorston <rmy@pobox.com>2023-07-27 12:20:18 +0100
commit9e2c3594ccbd3ef45beab57cba6796f97f06906c (patch)
tree64f6b0aa7bcdfa8b18c374a701cb09f60564f1b2
parentdf560c7c017c1084a180d922922358ed600faeb5 (diff)
downloadbusybox-w32-9e2c3594ccbd3ef45beab57cba6796f97f06906c.tar.gz
busybox-w32-9e2c3594ccbd3ef45beab57cba6796f97f06906c.tar.bz2
busybox-w32-9e2c3594ccbd3ef45beab57cba6796f97f06906c.zip
win32: fail early if UTF8 isn't supported
When the UTF8 manifest is included in the binary and ACP isn't UTF8 fail at once. This avoids raising false hopes if the binary is run on Window 7/8. On Windows XP it won't even run. When the busybox applet is run without arguments always report the build-time configuration of globbing and the UTF8 manifest.
-rwxr-xr-xexamples/mswin-build/mkprerelease16
-rwxr-xr-xexamples/mswin-build/mkrelease34
-rw-r--r--libbb/appletlib.c31
3 files changed, 50 insertions, 31 deletions
diff --git a/examples/mswin-build/mkprerelease b/examples/mswin-build/mkprerelease
index 45f64fa72..1cace46a3 100755
--- a/examples/mswin-build/mkprerelease
+++ b/examples/mswin-build/mkprerelease
@@ -29,13 +29,13 @@ for i in $TARGETS
29do 29do
30 if [ $i = "build_pre_64" ] 30 if [ $i = "build_pre_64" ]
31 then 31 then
32 CONFIG=mingw64_defconfig; 32 CONFIG=mingw64_defconfig
33 elif [ $i = "build_pre_64u" ] 33 elif [ $i = "build_pre_64u" ]
34 then 34 then
35 CONFIG=mingw64u_defconfig; 35 CONFIG=mingw64u_defconfig
36 elif [ $i = "build_pre_32" ] 36 elif [ $i = "build_pre_32" ]
37 then 37 then
38 CONFIG=mingw32_defconfig; 38 CONFIG=mingw32_defconfig
39 fi 39 fi
40 40
41 (cd $i; git checkout master; make ${CONFIG}) 41 (cd $i; git checkout master; make ${CONFIG})
@@ -44,8 +44,16 @@ done
44# perform build 44# perform build
45for i in $TARGETS 45for i in $TARGETS
46do 46do
47 BITS=64
48 if [ $i = "build_pre_32" ]
49 then
50 BITS=32;
51 fi
52
47 ( 53 (
48 cd $i 54 cd $i
49 make -j $(nproc) EXTRAVERSION="-$(git describe --match=FRP | sed 's/FRP/PRE/')" 55 GCCV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-gcc)
56 CRTV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt)
57 make -j $(nproc) EXTRAVERSION="-$(git describe --match=FRP | sed 's/FRP/PRE/')" MINGW_VER="$GCCV; $CRTV"
50 ) 58 )
51done 59done
diff --git a/examples/mswin-build/mkrelease b/examples/mswin-build/mkrelease
index 7ce9094f6..956cba0c1 100755
--- a/examples/mswin-build/mkrelease
+++ b/examples/mswin-build/mkrelease
@@ -2,7 +2,7 @@
2# 2#
3# Build 32- and 64-bit busybox binaries for release 3# Build 32- and 64-bit busybox binaries for release
4# 4#
5TARGETS="build_32 build_64" 5TARGETS="build_32 build_64 build_64u"
6 6
7if [ ! -d busybox-w32 ] 7if [ ! -d busybox-w32 ]
8then 8then
@@ -20,15 +20,23 @@ done
20# apply default configuration 20# apply default configuration
21for i in $TARGETS 21for i in $TARGETS
22do 22do
23 BITS=32
24 if [ $i = "build_64" ] 23 if [ $i = "build_64" ]
25 then 24 then
26 BITS=64; 25 CONFIG=mingw64_defconfig
26 BITS=64
27 elif [ $i = "build_64u" ]
28 then
29 CONFIG=mingw64u_defconfig
30 BITS=64
31 elif [ $i = "build_32" ]
32 then
33 CONFIG=mingw32_defconfig
34 BITS=32
27 fi 35 fi
28 36
29 ( 37 (
30 cd $i 38 cd $i
31 make mingw${BITS}_defconfig 39 make ${CONFIG}
32 # link time optimisation, fortify, stack protection 40 # link time optimisation, fortify, stack protection
33 sed -e 's/^CONFIG_EXTRA_CFLAGS="\(.*\)"$/CONFIG_EXTRA_CFLAGS="\1 -flto -fstack-protector --param=ssp-buffer-size=4"/' \ 41 sed -e 's/^CONFIG_EXTRA_CFLAGS="\(.*\)"$/CONFIG_EXTRA_CFLAGS="\1 -flto -fstack-protector --param=ssp-buffer-size=4"/' \
34 -e 's/^CONFIG_EXTRA_CFLAGS=" /CONFIG_EXTRA_CFLAGS="/' \ 42 -e 's/^CONFIG_EXTRA_CFLAGS=" /CONFIG_EXTRA_CFLAGS="/' \
@@ -49,22 +57,16 @@ done
49# perform build 57# perform build
50for i in $TARGETS 58for i in $TARGETS
51do 59do
52 BITS=32 60 BITS=64
53 if [ $i = "build_64" ] 61 if [ $i = "build_32" ]
54 then 62 then
55 BITS=64; 63 BITS=32
56 fi 64 fi
57 65
58 ( 66 (
59 cd $i 67 cd $i
60 GCCV=`rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-gcc` 68 GCCV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-gcc)
61 CRTV=`rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt` 69 CRTV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt)
62 GLOB="; noglob" 70 make -j $(nproc) EXTRAVERSION="-`git describe --match=FRP`" MINGW_VER="$GCCV; $CRTV"
63 if grep -q ^CONFIG_GLOBBING=y .config
64 then
65 GLOB="; glob"
66 fi
67 VER="($GCCV; $CRTV$GLOB)"
68 make -j $(nproc) EXTRAVERSION="-`git describe --match=FRP`" MINGW_VER="$VER"
69 ) 71 )
70done 72done
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 1c135fde7..a70b3a4c2 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -886,19 +886,20 @@ int busybox_main(int argc UNUSED_PARAM, char **argv)
886 886
887 dup2(1, 2); 887 dup2(1, 2);
888 full_write2_str(bb_banner); /* reuse const string */ 888 full_write2_str(bb_banner); /* reuse const string */
889#if ENABLE_PLATFORM_MINGW32 889# if ENABLE_PLATFORM_MINGW32
890# if ENABLE_FEATURE_UTF8_MANIFEST 890 full_write2_str("\n(");
891 full_write2_str(GetACP() == CP_UTF8 ? " (Unicode on)" 891# if defined(MINGW_VER)
892 : " (Unicode off)");
893# endif
894 full_write2_str("\n");
895#else
896 full_write2_str(" multi-call binary.\n"); /* reuse */
897#endif
898#if defined(MINGW_VER)
899 if (sizeof(MINGW_VER) > 5) { 892 if (sizeof(MINGW_VER) > 5) {
900 full_write2_str(MINGW_VER "\n\n"); 893 full_write2_str(MINGW_VER "; ");
901 } 894 }
895# endif
896 full_write2_str(ENABLE_GLOBBING ? "glob" : "noglob");
897# if ENABLE_FEATURE_UTF8_MANIFEST
898 full_write2_str("; Unicode");
899# endif
900 full_write2_str(")\n\n");
901# else
902 full_write2_str(" multi-call binary.\n"); /* reuse */
902#endif 903#endif
903 full_write2_str( 904 full_write2_str(
904 "BusyBox is copyrighted by many authors between 1998-2023.\n" 905 "BusyBox is copyrighted by many authors between 1998-2023.\n"
@@ -1303,6 +1304,14 @@ int main(int argc UNUSED_PARAM, char **argv)
1303 } 1304 }
1304#endif 1305#endif
1305#if ENABLE_PLATFORM_MINGW32 1306#if ENABLE_PLATFORM_MINGW32
1307# if ENABLE_FEATURE_UTF8_MANIFEST
1308 if (GetACP() != CP_UTF8) {
1309 full_write2_str(bb_basename(argv[0]));
1310 full_write2_str(": needs UTF8 code page\n");
1311 return 1;
1312 }
1313# endif
1314
1306 /* detect if we're running an interpreted script */ 1315 /* detect if we're running an interpreted script */
1307 if (argv[0][1] == ':' && argv[0][2] == '/') { 1316 if (argv[0][1] == ':' && argv[0][2] == '/') {
1308 switch (argv[0][0]) { 1317 switch (argv[0][0]) {