Patchwork [meta-networking] cyrus-sasl: several fixes

login
register
mail settings
Submitter rongqing.li@windriver.com
Date July 19, 2013, 6:29 a.m.
Message ID <1374215371-23406-1-git-send-email-rongqing.li@windriver.com>
Download mbox | patch
Permalink /patch/54037/
State Accepted
Commit fe85f4980e7c7c35df8fc6b93431c125577dd643
Headers show

Comments

rongqing.li@windriver.com - July 19, 2013, 6:29 a.m.
From: "Roy.Li" <rongqing.li@windriver.com>

1. Fix hardcoded libdir
2. configure cyrus-sasl based on PACKAGECONFIG
3. create user by inherit useradd
4. add -fPIC to CFLAG to fix the below building failure:
        ld: ../sasldb/.libs/libsasldb.a(db_berkeley.o): relocation R_X86_64_32S against
        `.rodata' can not be used when making a shared object; recompile with -fPIC
        ../sasldb/.libs/libsasldb.a(db_berkeley.o): could not read symbols: Bad value
   The cause is that libsasldb.a is built twice since {.c.o: and .c.lo} co-exist, one
   with -fPIC, other without -fPIC. if no -fPIC library follows behind, this error
   will appear. so we enable -fPIC no matter whatever objects are built.
5. The version of db in oe-core is 5.0

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
 .../cyrus-sasl/cyrus-sasl_2.1.26.bb                |   31 ++++++++++++++++----
 .../cyrus-sasl/files/Fix-hardcoded-libdir.patch    |   25 ++++++++++++++++
 2 files changed, 51 insertions(+), 5 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
Joe MacDonald - July 19, 2013, 3:21 p.m.
Merged, thanks.
-J.

[[meta-networking][PATCH] cyrus-sasl: several fixes] On 13.07.19 (Fri 14:29) rongqing.li@windriver.com wrote:

> From: "Roy.Li" <rongqing.li@windriver.com>
> 
> 1. Fix hardcoded libdir
> 2. configure cyrus-sasl based on PACKAGECONFIG
> 3. create user by inherit useradd
> 4. add -fPIC to CFLAG to fix the below building failure:
>         ld: ../sasldb/.libs/libsasldb.a(db_berkeley.o): relocation R_X86_64_32S against
>         `.rodata' can not be used when making a shared object; recompile with -fPIC
>         ../sasldb/.libs/libsasldb.a(db_berkeley.o): could not read symbols: Bad value
>    The cause is that libsasldb.a is built twice since {.c.o: and .c.lo} co-exist, one
>    with -fPIC, other without -fPIC. if no -fPIC library follows behind, this error
>    will appear. so we enable -fPIC no matter whatever objects are built.
> 5. The version of db in oe-core is 5.0
> 
> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> ---
>  .../cyrus-sasl/cyrus-sasl_2.1.26.bb                |   31 ++++++++++++++++----
>  .../cyrus-sasl/files/Fix-hardcoded-libdir.patch    |   25 ++++++++++++++++
>  2 files changed, 51 insertions(+), 5 deletions(-)
>  create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
> 
> diff --git a/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb b/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb
> index 4311540..d8cb3d9 100644
> --- a/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb
> +++ b/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb
> @@ -5,21 +5,39 @@ LICENSE = "BSD"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=3f55e0974e3d6db00ca6f57f2d206396"
>  
>  SRC_URI = "ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-${PV}.tar.gz \
> -	   file://avoid-to-call-AC_TRY_RUN.patch"
> +	   file://avoid-to-call-AC_TRY_RUN.patch \
> +	   file://Fix-hardcoded-libdir.patch" 
>  
> -inherit autotools pkgconfig
> +inherit autotools pkgconfig useradd
>  
>  EXTRA_OECONF += "--with-dblib=berkeley \
>                   --with-bdb-libdir=${STAGING_LIBDIR} \
>                   --with-bdb-incdir=${STAGING_INCDIR} \
> -                 --without-pam --without-opie --without-des \
> +                 --with-bdb=db-5.3 \
> +                 --with-plugindir="${libdir}/sasl2/" \
>                   andrew_cv_runpath_switch=none"
>  
> -PACKAGECONFIG ??= ""
> +PACKAGECONFIG ??= "ntlm \
> +        ${@base_contains('DISTRO_FEATURES', 'ldap', 'ldap', '', d)} \
> +        ${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
> +        "
>  PACKAGECONFIG[gssapi] = "--enable-gssapi=yes,--enable-gssapi=no,krb5,"
> +PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,"
> +PACKAGECONFIG[opie] = "--with-opie,--without-opie,opie,"
> +PACKAGECONFIG[des] = "--with-des,--without-des,,"
> +PACKAGECONFIG[ldap] = "--with-ldap=${STAGING_LIBDIR} --enable-ldapdb,--without-ldap --disable-ldapdb,openldap,"
> +PACKAGECONFIG[ntlm] = "--with-ntlm,--without-ntlm,,"
> +
> +CFLAGS += "-fPIC"
>  
>  do_configure_prepend () {
>      rm -f acinclude.m4 config/libtool.m4
> +
> +    # make it be able to work with db 5.0 version
> +    local sed_files="sasldb/db_berkeley.c utils/dbconverter-2.c"
> +    for sed_file in $sed_files; do
> +        sed -i 's#DB_VERSION_MAJOR == 4.*#(&) || DB_VERSION_MAJOR == 5#' $sed_file
> +    done
>  }
>  
>  do_compile_prepend () {
> @@ -29,8 +47,11 @@ do_compile_prepend () {
>      cd ..
>  }
>  
> +USERADD_PACKAGES = "${PN}-bin"
> +GROUPADD_PARAM_${PN}-bin = "--system mail"
> +USERADD_PARAM_${PN}-bin = "--system --home=/var/spool/mail -g mail cyrus"
> +
>  pkg_postinst_${PN}-bin () {
> -    grep cyrus /etc/passwd || adduser --disabled-password --home=/var/spool/mail --ingroup mail -g "Cyrus sasl" cyrus
>      echo "cyrus" | saslpasswd2 -p -c cyrus
>      chgrp mail /etc/sasldb2
>  }
> diff --git a/meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch b/meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
> new file mode 100644
> index 0000000..3fa8431
> --- /dev/null
> +++ b/meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
> @@ -0,0 +1,25 @@
> +Fix hardcoded libdir.
> +
> +Upstream-Status: Pending 
> +
> +Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> +---
> + plugins/Makefile.am |    2 +-
> + 1 files changed, 1 insertions(+), 1 deletions(-)
> +
> +diff --git a/plugins/Makefile.am b/plugins/Makefile.am
> +index b00915f..25262a1 100644
> +--- a/plugins/Makefile.am
> ++++ b/plugins/Makefile.am
> +@@ -62,7 +62,7 @@ plugindir = @plugindir@
> + 
> + common_sources = plugin_common.c plugin_common.h
> + 
> +-sasldir = $(prefix)/lib/sasl2
> ++sasldir = $(libdir)/sasl2
> + sasl_LTLIBRARIES = @SASL_MECHS@
> + EXTRA_LTLIBRARIES = libplain.la libanonymous.la libkerberos4.la libcrammd5.la \
> + 	libgs2.la libgssapiv2.la libdigestmd5.la liblogin.la libsrp.la libotp.la \
> +-- 
> +1.7.4.1
> +

Patch

diff --git a/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb b/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb
index 4311540..d8cb3d9 100644
--- a/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb
+++ b/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb
@@ -5,21 +5,39 @@  LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://COPYING;md5=3f55e0974e3d6db00ca6f57f2d206396"
 
 SRC_URI = "ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-${PV}.tar.gz \
-	   file://avoid-to-call-AC_TRY_RUN.patch"
+	   file://avoid-to-call-AC_TRY_RUN.patch \
+	   file://Fix-hardcoded-libdir.patch" 
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig useradd
 
 EXTRA_OECONF += "--with-dblib=berkeley \
                  --with-bdb-libdir=${STAGING_LIBDIR} \
                  --with-bdb-incdir=${STAGING_INCDIR} \
-                 --without-pam --without-opie --without-des \
+                 --with-bdb=db-5.3 \
+                 --with-plugindir="${libdir}/sasl2/" \
                  andrew_cv_runpath_switch=none"
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG ??= "ntlm \
+        ${@base_contains('DISTRO_FEATURES', 'ldap', 'ldap', '', d)} \
+        ${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
+        "
 PACKAGECONFIG[gssapi] = "--enable-gssapi=yes,--enable-gssapi=no,krb5,"
+PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,"
+PACKAGECONFIG[opie] = "--with-opie,--without-opie,opie,"
+PACKAGECONFIG[des] = "--with-des,--without-des,,"
+PACKAGECONFIG[ldap] = "--with-ldap=${STAGING_LIBDIR} --enable-ldapdb,--without-ldap --disable-ldapdb,openldap,"
+PACKAGECONFIG[ntlm] = "--with-ntlm,--without-ntlm,,"
+
+CFLAGS += "-fPIC"
 
 do_configure_prepend () {
     rm -f acinclude.m4 config/libtool.m4
+
+    # make it be able to work with db 5.0 version
+    local sed_files="sasldb/db_berkeley.c utils/dbconverter-2.c"
+    for sed_file in $sed_files; do
+        sed -i 's#DB_VERSION_MAJOR == 4.*#(&) || DB_VERSION_MAJOR == 5#' $sed_file
+    done
 }
 
 do_compile_prepend () {
@@ -29,8 +47,11 @@  do_compile_prepend () {
     cd ..
 }
 
+USERADD_PACKAGES = "${PN}-bin"
+GROUPADD_PARAM_${PN}-bin = "--system mail"
+USERADD_PARAM_${PN}-bin = "--system --home=/var/spool/mail -g mail cyrus"
+
 pkg_postinst_${PN}-bin () {
-    grep cyrus /etc/passwd || adduser --disabled-password --home=/var/spool/mail --ingroup mail -g "Cyrus sasl" cyrus
     echo "cyrus" | saslpasswd2 -p -c cyrus
     chgrp mail /etc/sasldb2
 }
diff --git a/meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch b/meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
new file mode 100644
index 0000000..3fa8431
--- /dev/null
+++ b/meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
@@ -0,0 +1,25 @@ 
+Fix hardcoded libdir.
+
+Upstream-Status: Pending 
+
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+---
+ plugins/Makefile.am |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/plugins/Makefile.am b/plugins/Makefile.am
+index b00915f..25262a1 100644
+--- a/plugins/Makefile.am
++++ b/plugins/Makefile.am
+@@ -62,7 +62,7 @@ plugindir = @plugindir@
+ 
+ common_sources = plugin_common.c plugin_common.h
+ 
+-sasldir = $(prefix)/lib/sasl2
++sasldir = $(libdir)/sasl2
+ sasl_LTLIBRARIES = @SASL_MECHS@
+ EXTRA_LTLIBRARIES = libplain.la libanonymous.la libkerberos4.la libcrammd5.la \
+ 	libgs2.la libgssapiv2.la libdigestmd5.la liblogin.la libsrp.la libotp.la \
+-- 
+1.7.4.1
+