diff options
author | Mikko Rapeli <mikko.rapeli@bmw.de> | 2021-04-22 17:41:14 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-24 17:53:05 +0100 |
commit | 7d228861e8f62000310c37ef2cba76c7b7eab38c (patch) | |
tree | eeefb3f620a06210abc37f5d5d21da5b684245e8 /meta/recipes-extended/unzip | |
parent | dcfdecb9ff9d8ee6f3a82f5c3e07629b88c405fb (diff) | |
download | poky-7d228861e8f62000310c37ef2cba76c7b7eab38c.tar.gz |
unzip: use optimization from bitbake
Build with bitbake default optimizations, e.g. O2,
instead of custom O3. Reduces unzip binary package
size from 304401 to 283921 bytes, and enables building
with Os to even further reduce binary size if needed
and configured for the whole system.
(From OE-Core rev: 1330ac1902360cc5e01b69a6065963bf7b92d4bb)
Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/unzip')
-rw-r--r-- | meta/recipes-extended/unzip/unzip/unzip_optimization.patch | 127 | ||||
-rw-r--r-- | meta/recipes-extended/unzip/unzip_6.0.bb | 1 |
2 files changed, 128 insertions, 0 deletions
diff --git a/meta/recipes-extended/unzip/unzip/unzip_optimization.patch b/meta/recipes-extended/unzip/unzip/unzip_optimization.patch new file mode 100644 index 0000000000..4bab7b26af --- /dev/null +++ b/meta/recipes-extended/unzip/unzip/unzip_optimization.patch | |||
@@ -0,0 +1,127 @@ | |||
1 | unzip: use optimization from bitbake | ||
2 | |||
3 | Remove -O3 optimizations to use bitbake default optimization levels. | ||
4 | |||
5 | Upstream-Status: Inappropriate [configuration] | ||
6 | |||
7 | Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> | ||
8 | |||
9 | diff -rup unix-orig/configure unix/configure | ||
10 | --- a/unix-orig/configure 2021-04-16 10:25:03.120858292 +0000 | ||
11 | +++ b/unix/configure 2021-04-16 10:46:43.292546138 +0000 | ||
12 | @@ -70,7 +70,7 @@ int main() | ||
13 | _EOF_ | ||
14 | $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null | ||
15 | if test $? -eq 0; then | ||
16 | - CFLAGS_OPT='-O3' | ||
17 | + CFLAGS_OPT='' | ||
18 | echo " DEC C ($CFLAGS_OPT)" | ||
19 | else | ||
20 | # HP-UX HP C? | ||
21 | @@ -111,7 +111,7 @@ int main() | ||
22 | _EOF_ | ||
23 | $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null | ||
24 | if test $? -eq 0; then | ||
25 | - CFLAGS_OPT='-O3' | ||
26 | + CFLAGS_OPT='' | ||
27 | echo " GNU C ($CFLAGS_OPT)" | ||
28 | # Special Mac OS X shared library "ld" option? | ||
29 | if test ` uname -s 2> /dev/null ` = 'Darwin'; then | ||
30 | diff -rup unix-orig/Makefile unix/Makefile | ||
31 | --- a/unix-orig/Makefile 2021-04-16 10:25:03.000863878 +0000 | ||
32 | +++ b/unix/Makefile 2021-04-16 10:47:31.658299278 +0000 | ||
33 | @@ -47,7 +47,7 @@ LD = $(CC)# must match, else "unresolved | ||
34 | AS = as | ||
35 | LOC = $(D_USE_BZ2) $(LOCAL_UNZIP) | ||
36 | AF = $(LOC) | ||
37 | -CFLAGS = -O | ||
38 | +CFLAGS = | ||
39 | CF_NOOPT = -I. -I$(IZ_BZIP2) -DUNIX $(LOC) | ||
40 | CF = $(CFLAGS) $(CF_NOOPT) | ||
41 | LFLAGS1 = | ||
42 | @@ -594,12 +594,12 @@ generic_shlib: unix_make | ||
43 | @echo\ | ||
44 | 'which is UnZip linked with the DLL). This target is an example only.' | ||
45 | @echo "" | ||
46 | - $(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC -DDLL" | ||
47 | + $(MAKE) objsdll CC=gcc CFLAGS="-Wall -fPIC -DDLL" | ||
48 | gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL) | ||
49 | $(RM) libunzip.so.0 libunzip.so | ||
50 | $(LN) -s libunzip.so.0.4 libunzip.so.0 | ||
51 | $(LN) -s libunzip.so.0 libunzip.so | ||
52 | - gcc -c -O unzipstb.c | ||
53 | + gcc -c unzipstb.c | ||
54 | gcc -o unzip_shlib unzipstb.o -L. -lunzip | ||
55 | |||
56 | #---------------------------------------------------------------------------- | ||
57 | @@ -775,7 +775,7 @@ freebsd: unix_make | ||
58 | # with "echo" instead). | ||
59 | # | ||
60 | gcc: unix_make | ||
61 | - $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O3" LF2="" | ||
62 | + $(MAKE) unzips CC=gcc LD=gcc CFLAGS="" LF2="" | ||
63 | |||
64 | # Heurikon HK68 (68010), UniPlus+ System V 5.0, Green Hills C-68000 | ||
65 | hk68: unix_make | ||
66 | @@ -792,7 +792,7 @@ isc: unix_make | ||
67 | isc_gcc: unix_make | ||
68 | $(MAKE) unzips AS=gcc CC=gcc LD=gcc CRCA_O=crc_gcc$O \ | ||
69 | LF="-shlib $(LF)" SL="-shlib $(SL)" FL="-shlib $(FL)" LF2="" \ | ||
70 | - CFLAGS="-O3" LOC="-DSYSV -DASM_CRC -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \ | ||
71 | + CFLAGS="" LOC="-DSYSV -DASM_CRC -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \ | ||
72 | AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)" | ||
73 | $(STRIP) $(UNZIPS) | ||
74 | |||
75 | @@ -808,7 +808,7 @@ isi: unix_make | ||
76 | linux: unix_make | ||
77 | @echo 'NOTE: use linux_noasm target for non-Intel Linux compiles.' | ||
78 | $(MAKE) unzips CC=gcc LD=gcc AS=gcc\ | ||
79 | - CFLAGS="-O3 -Wall -DASM_CRC"\ | ||
80 | + CFLAGS="-Wall -DASM_CRC"\ | ||
81 | AF="-Di386 $(AF)" CRCA_O=crc_gcc$O | ||
82 | # GRR: this echo is pointless; if user gets this far, no difference to install | ||
83 | # @echo 'Be sure to use the install_asm target rather than the install target' | ||
84 | @@ -818,14 +818,14 @@ linux_asm: linux | ||
85 | # Linux (Posix, approximately SysV): virtually any version since before 0.96, | ||
86 | # for any platform. Change "-O" to "-O3" or whatever, as desired... | ||
87 | linux_noasm: unix_make | ||
88 | - $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O -Wall" | ||
89 | + $(MAKE) unzips CC=gcc LD=gcc CFLAGS="-Wall" | ||
90 | |||
91 | # Linux with lcc compiler: __inline__ (stat.h) not recognized, and must edit | ||
92 | # /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined. -O3 | ||
93 | # (or -O2 or -O) is ignored. [GRR 960828: test target only] | ||
94 | # | ||
95 | linux_lcc: unix_make | ||
96 | - $(MAKE) unzips CC=lcc LD=lcc CFLAGS="-O3 -Wall -D__inline__= " | ||
97 | + $(MAKE) unzips CC=lcc LD=lcc CFLAGS="-Wall -D__inline__= " | ||
98 | |||
99 | # Linux host with go32 (djgpp) cross-compiler (go32crs.tgz) for 32-bit DOS. | ||
100 | linux_dos: unix_make | ||
101 | @@ -844,7 +844,7 @@ linux_dos: unix_make | ||
102 | # library). | ||
103 | # | ||
104 | linux_shlib: unix_make | ||
105 | - $(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC"\ | ||
106 | + $(MAKE) objsdll CC=gcc CFLAGS="-Wall -fPIC"\ | ||
107 | LOC="-DDLL -DASM_CRC $(LOC)"\ | ||
108 | AS=gcc AF="-fPIC -Di386 $(AF)" CRCA_O=crc_gcc$O | ||
109 | gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)\ | ||
110 | @@ -858,7 +858,7 @@ linux_shlib: unix_make | ||
111 | # instead of the original UnZip version. (libz was libgz prior to 0.94) | ||
112 | linux_shlibz: unix_make | ||
113 | $(MAKE) objsdll CC=gcc AS=gcc AF="-fPIC -Di386 $(AF)" CRCA_O=crc_gcc$O\ | ||
114 | - CFLAGS="-O3 -Wall -fPIC" LOC="-DDLL -DUSE_ZLIB -DASM_CRC $(LOC)" | ||
115 | + CFLAGS="-Wall -fPIC" LOC="-DDLL -DUSE_ZLIB -DASM_CRC $(LOC)" | ||
116 | gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)\ | ||
117 | crc_gcc.pic.o | ||
118 | ln -sf libunzip.so.0.4 libunzip.so.0 | ||
119 | @@ -871,7 +871,7 @@ lynx: unix_make | ||
120 | |||
121 | # Macintosh MacOS X (Unix-compatible enviroment), using standard compiler | ||
122 | macosx: unix_make | ||
123 | - $(MAKE) unzips CFLAGS="-O3 -Wall -DBSD" LF2="" | ||
124 | + $(MAKE) unzips CFLAGS="-Wall -DBSD" LF2="" | ||
125 | $(STRIP) $(UNZIPS) | ||
126 | |||
127 | # Macintosh MacOS X (Unix-compatible enviroment), using gcc | ||
diff --git a/meta/recipes-extended/unzip/unzip_6.0.bb b/meta/recipes-extended/unzip/unzip_6.0.bb index 0c56a39d92..ec69508eea 100644 --- a/meta/recipes-extended/unzip/unzip_6.0.bb +++ b/meta/recipes-extended/unzip/unzip_6.0.bb | |||
@@ -26,6 +26,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/ | |||
26 | file://CVE-2019-13232_p1.patch \ | 26 | file://CVE-2019-13232_p1.patch \ |
27 | file://CVE-2019-13232_p2.patch \ | 27 | file://CVE-2019-13232_p2.patch \ |
28 | file://CVE-2019-13232_p3.patch \ | 28 | file://CVE-2019-13232_p3.patch \ |
29 | file://unzip_optimization.patch \ | ||
29 | " | 30 | " |
30 | UPSTREAM_VERSION_UNKNOWN = "1" | 31 | UPSTREAM_VERSION_UNKNOWN = "1" |
31 | 32 | ||