diff mbox series

[oe,meta-networking,1/3] postfix: Fix build with security flags and clang

Message ID 20170827012830.11782-1-raj.khem@gmail.com
State Accepted
Commit 407b28f8f287d56ee60d3697dc1cbd7b43a997ea
Headers show
Series [oe,meta-networking,1/3] postfix: Fix build with security flags and clang | expand

Commit Message

Khem Raj Aug. 27, 2017, 1:28 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...se-native-compiler-to-build-makedefs.test.patch | 64 ++++++++++++++++++++++
 .../recipes-daemons/postfix/files/icu-config.patch | 21 +++++++
 .../postfix/files/postfix-install.patch            | 26 +++++++++
 .../recipes-daemons/postfix/postfix.inc            |  2 +-
 .../recipes-daemons/postfix/postfix_3.2.2.bb       |  3 +
 5 files changed, 115 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch
 create mode 100644 meta-networking/recipes-daemons/postfix/files/icu-config.patch
 create mode 100644 meta-networking/recipes-daemons/postfix/files/postfix-install.patch

-- 
2.14.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch b/meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch
new file mode 100644
index 000000000..763a4a9b9
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch
@@ -0,0 +1,64 @@ 
+From a0d0de10e4c5ab55bc2fa48798079e2876b1211d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 26 Aug 2017 10:29:37 -0700
+Subject: [PATCH] makedefs: Use native compiler to build makedefs.test
+
+Its a binary used during build
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ makedefs | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/makedefs b/makedefs
+index 9fd4bc2..5ee7747 100644
+--- a/makedefs
++++ b/makedefs
+@@ -526,7 +526,7 @@ int     main(int argc, char **argv)
+     exit(0);
+ }
+ EOF
+-			   ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
++			   ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c || exit 1
+ 			   rm -f makedefs.test makedefs.test.[co]
+ 		       fi;;
+ 		esac
+@@ -762,7 +762,7 @@ int     main(int argc, char **argv)
+     exit(0);
+ }
+ EOF
+-		   ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
++		   ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c || exit 1
+ 		   ./makedefs.test 2>/dev/null ||
+ 			CCARGS="$CCARGS -DNO_SIGSETJMP"
+ 		   rm -f makedefs.test makedefs.test.[co]
+@@ -796,7 +796,7 @@ int main(int argc, char **argv)
+ 				  &error) != 14);
+ }
+ EOF
+-		    ${CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
++		    ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
+ 			$icu_ldflags >/dev/null 2>&1
+ 		    if ./makedefs.test 2>/dev/null ; then
+ 			CCARGS="$CCARGS $icu_cppflags"
+@@ -911,7 +911,7 @@ int     main(void)
+     exit(ferror(stdout) ? 1 : 0);
+ }
+ EOF
+-    eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
++    eval ${BUILD_CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
+     ./makedefs.test || exit 1
+     rm -f makedefs.test makedefs.test.[co]
+ }
+@@ -1067,7 +1067,7 @@ int     main(void)
+     exit(ferror(stdout) ? 1 : 0);
+ }
+ EOF
+-	eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
++	eval ${BUILD_CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
+ 	parm_val=`./makedefs.test` || exit 1
+ 	rm -f makedefs.test makedefs.test.[co]
+ 	eval ${parm_name}=\""\$parm_val"\"
+-- 
+2.14.1
+
diff --git a/meta-networking/recipes-daemons/postfix/files/icu-config.patch b/meta-networking/recipes-daemons/postfix/files/icu-config.patch
new file mode 100644
index 000000000..9bd9c2f03
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/icu-config.patch
@@ -0,0 +1,21 @@ 
+do not entertain cppflags from icu, this is because
+icu-config feeds the -I path without sysroot which
+caused native headers to be included and build is
+corrupted in any case its just adding -I/usr/include
+to the CCARGS which we loose nothing if its not
+entertained.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: postfix-3.2.2/makedefs
+===================================================================
+--- postfix-3.2.2.orig/makedefs
++++ postfix-3.2.2/makedefs
+@@ -799,7 +799,6 @@ EOF
+ 		    ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
+ 			$icu_ldflags >/dev/null 2>&1
+ 		    if ./makedefs.test 2>/dev/null ; then
+-			CCARGS="$CCARGS $icu_cppflags"
+ 			SYSLIBS="$SYSLIBS $icu_ldflags"
+ 		    else
+ 			CCARGS="$CCARGS -DNO_EAI"
diff --git a/meta-networking/recipes-daemons/postfix/files/postfix-install.patch b/meta-networking/recipes-daemons/postfix/files/postfix-install.patch
new file mode 100644
index 000000000..45479bd52
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/postfix-install.patch
@@ -0,0 +1,26 @@ 
+Index: postfix-3.2.2/postfix-install
+===================================================================
+--- postfix-3.2.2.orig/postfix-install
++++ postfix-3.2.2/postfix-install
+@@ -843,7 +843,7 @@ IFS="$BACKUP_IFS"
+ # the wrong place when Postfix is being upgraded.
+ 
+ case "$mail_version" in
+-"") mail_version="`$POSTCONF -dhx mail_version`" || exit 1
++"") mail_version="`$POSTCONF -c $CONFIG_DIRECTORY -dhx mail_version`" || exit 1
+ esac
+ 
+ # Undo MAIL_VERSION expansion at the end of a parameter value. If
+Index: postfix-3.2.2/Makefile.in
+===================================================================
+--- postfix-3.2.2.orig/Makefile.in
++++ postfix-3.2.2/Makefile.in
+@@ -20,7 +20,7 @@ META	= meta/main.cf.proto meta/master.cf
+ EXPAND	= sed -e "s;\$${LIB_PREFIX};$(LIB_PREFIX);" \
+ 	    -e "s;\$${LIB_SUFFIX};$(LIB_SUFFIX);"
+ SHLIB_DIR_OVERRIDE = \
+-	$${shlib_directory:-`$(SHLIB_ENV) bin/postconf -dhx shlib_directory`}
++	$${shlib_directory:-`$(SHLIB_ENV) $(POSTCONF) -dhx shlib_directory`}
+ 
+ default: update
+ 
diff --git a/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-networking/recipes-daemons/postfix/postfix.inc
index cb9d59f93..a588bd347 100644
--- a/meta-networking/recipes-daemons/postfix/postfix.inc
+++ b/meta-networking/recipes-daemons/postfix/postfix.inc
@@ -73,7 +73,7 @@  export CCARGS-sasl_class-native = ""
 export AUXLIBS-sasl_class-native = ""
 
 # PCRE, TLS support default
-export CCARGS  = "${CFLAGS} -DHAS_PCRE -DUSE_TLS ${CCARGS-ldap} ${CCARGS-sasl} ${CCARGS-nonis}"
+export CCARGS  = "${CFLAGS} -DHAS_PCRE -DUSE_TLS -I${STAGING_INCDIR}/openssl ${CCARGS-ldap} ${CCARGS-sasl} ${CCARGS-nonis}"
 export AUXLIBS = "-lpcre -lssl -lcrypto ${AUXLIBS-sasl} ${AUXLIBS-ldap}"
 export POSTCONF = "${STAGING_DIR_NATIVE}${sbindir_native}/postconf"
 
diff --git a/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb b/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb
index 1118b2ed4..439ede9b6 100644
--- a/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb
+++ b/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb
@@ -10,6 +10,9 @@  SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV
            file://aliasesdb \
            file://check_hostname.sh \
            file://0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch \
+           file://0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch \
+           file://postfix-install.patch \
+           file://icu-config.patch \
            "
 SRC_URI[md5sum] = "aea073a9b0bea5bdb590460a270a4aa0"
 SRC_URI[sha256sum] = "d06849418d119d09366997b2b481bb23f737629769b4e4a52da42fb3ad8b0576"