1 From 7d9817ca935a35fe6c8e2c2c7615825fa08a3a19 Mon Sep 17 00:00:00 2001
2 From: "simit.ghane" <simit.ghane@lge.com>
3 Date: Tue, 7 May 2024 14:09:03 +0530
4 Subject: [PATCHV2] Fix building error with '-O2' in sysroot path
6 Upstream-Status: Backport [https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=7d9817ca935a35fe6c8e2c2c7615825fa08a3a19
7 https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=e96df0c82e086bf348753d2d0fa37fa6191b4b14
8 https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=5afadba008918d651afefb842ae123cc18454c74]
10 * cipher/Makefile.am (o_flag_munging): Tweak the sed script.
11 * random/Makefile.am (o_flag_munging): Ditto.
14 Characters like '-O2' or '-Ofast' will be replaced by '-O1' and '-O0'
15 respectively when compiling cipher and random in the filesystem
16 paths as well if they happen to contain '-O2' or '-Ofast
18 If we are cross compiling libgcrypt and sysroot contains such
20 get compile errors because the sysroot path has been modified.
22 Fix this by adding blank spaces and tabs before the original matching
23 pattern in the sed command.
25 Signed-off-by: simit.ghane <simit.ghane@lge.com>
27 ChangeLog entries added by wk
29 Note that there is also the configure option --disable-O-flag-munging;
32 random:cipher: handle substitution in sed command
34 * cipher/Makefile.am (o_flag_munging): Add 'g' flag for first sed
36 * random/Makefile.am (o_flag_munging): Likewise.
38 [jk: add changelog to commit message]
39 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
41 cipher/Makefile.am | 2 +-
42 random/Makefile.am | 2 +-
43 2 files changed, 2 insertions(+), 2 deletions(-)
45 diff --git a/cipher/Makefile.am b/cipher/Makefile.am
46 index c3d642b2ac..f1c3971c40 100644
47 --- a/cipher/Makefile.am
48 +++ b/cipher/Makefile.am
49 @@ -153,7 +153,7 @@ gost-s-box: gost-s-box.c
52 if ENABLE_O_FLAG_MUNGING
53 -o_flag_munging = sed -e 's/-O\([2-9sgz][2-9sgz]*\)/-O1/' -e 's/-Ofast/-O1/g'
54 +o_flag_munging = sed -e 's/[[:blank:]]-O\([1-9sgz][1-9sgz]*\)/ -O1 /g' -e 's/[[:blank:]]-Ofast/ -O1 /g'
58 diff --git a/random/Makefile.am b/random/Makefile.am
59 index 0c935a0595..340df38a79 100644
60 --- a/random/Makefile.am
61 +++ b/random/Makefile.am
62 @@ -56,7 +56,7 @@ jitterentropy-base.c jitterentropy.h jitterentropy-base-user.h
64 # The rndjent module needs to be compiled without optimization. */
65 if ENABLE_O_FLAG_MUNGING
66 -o_flag_munging = sed -e 's/-O\([1-9sgz][1-9sgz]*\)/-O0/g' -e 's/-Ofast/-O0/g'
67 +o_flag_munging = sed -e 's/[[:blank:]]-O\([1-9sgz][1-9sgz]*\)/ -O0 /g' -e 's/[[:blank:]]-Ofast/ -O0 /g'