Skip to contentSkip to conversation

cyrus-sasl: several fixes

PATCH In review [email protected] 2 participants 3 messages Jul 17, 2013 – Jul 19, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cyrus-sasl: several fixes

From: "Roy.Li" <[email protected]>

1. Fix hardcoded libdir
2. configure cyrus-sasl based on PACKAGECONFIG
3. create user by inherit useradd
4. add -fPIC to CFLAG to fix a building failure, the cause as below:
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

Further investigation shows Upstream chose a strange way to keep compatible with certain versions of automake.

--- a/sasldb/Makefile.am
+++ b/sasldb/Makefile.am
@@ -1,6 +1,6 @@
# Makefile.am for the SASLdb library
# Rob Siemborski
-# $Id: Makefile.am,v 1.28 2005/04/11 05:09:31 shadow Exp $ +# $Id: Makefile.am,v 1.29 2005/05/07 04:14:56 shadow Exp $
# Copyright (c) 2000 Carnegie Mellon University. All rights reserved. #
# Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@ libsasldb_la_LIBADD = $(SASL_DB_BACKEND)
libsasldb_a_SOURCES =
EXTRA_libsasldb_a_SOURCES =

-libsasldb.a: libsasldb.la $(LOCAL_SASL_DB_BACKEND_STATIC)
- $(AR) cru .libs/$@ $(LOCAL_SASL_DB_BACKEND_STATIC)
+libsasldb.a: libsasldb.la $(SASL_DB_BACKEND_STATIC)
+ $(AR) cru .libs/$@ $(SASL_DB_BACKEND_STATIC)

that snippet of Makefile rule made libsasldb.a built twice, one with -fPIC, other without -fPIC. if no -fPIC library follow behind, this error will appear. so we enable -fPIC no matter whatever objects are built.

---
 .../cyrus-sasl/cyrus-sasl_2.1.26.bb                |   32 +++++++++++++++++---
 .../cyrus-sasl/files/Fix-hardcoded-libdir.patch    |   25 +++++++++++++++
 2 files changed, 52 insertions(+), 5 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +27 -5
index 4311540..4dac450 100644
@@ -5,21 +5,40 @@ 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 \
+                 --enable-login \
+                 --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 +48,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
 }
meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch new file +25 -0
new file mode 100644
index 0000000..3fa8431
@@ -0,0 +1,25 @@
+Fix hardcoded libdir.
+
+Upstream-Status: Pending 
+
+Signed-off-by: Roy.Li <[email protected]>
+---
+ 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
+
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 27 lines · [[PATCH] cyrus-sasl: several fixes] On 13.07.17 (Wed 14:24)…

From: "Roy.Li" <[email protected]>

1. Fix hardcoded libdir
2. configure cyrus-sasl based on PACKAGECONFIG
3. create user by inherit useradd
4. add -fPIC to CFLAG to fix a building failure, the cause as below:
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

Further investigation shows Upstream chose a strange way to keep compatible with certain versions of automake.

--- a/sasldb/Makefile.am
+++ b/sasldb/Makefile.am
@@ -1,6 +1,6 @@
# Makefile.am for the SASLdb library
# Rob Siemborski
-# $Id: Makefile.am,v 1.28 2005/04/11 05:09:31 shadow Exp $ +# $Id: Makefile.am,v 1.29 2005/05/07 04:14:56 shadow Exp $
# Copyright (c) 2000 Carnegie Mellon University. All rights reserved. #
# Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@ libsasldb_la_LIBADD = $(SASL_DB_BACKEND)
libsasldb_a_SOURCES =
EXTRA_libsasldb_a_SOURCES =

Quoted 4 lines

-libsasldb.a: libsasldb.la $(LOCAL_SASL_DB_BACKEND_STATIC)
- $(AR) cru .libs/$@ $(LOCAL_SASL_DB_BACKEND_STATIC)
+libsasldb.a: libsasldb.la $(SASL_DB_BACKEND_STATIC)
+ $(AR) cru .libs/$@ $(SASL_DB_BACKEND_STATIC)

This is ... odd. I'm not sure how this relates to the comment below, but your solution seems sound.

Quoted 24 lines

that snippet of Makefile rule made libsasldb.a built twice, one with -fPIC, other without -fPIC. if no -fPIC library follow behind, this error will appear. so we enable -fPIC no matter whatever objects are built.

---
 .../cyrus-sasl/cyrus-sasl_2.1.26.bb                |   32 +++++++++++++++++---
 .../cyrus-sasl/files/Fix-hardcoded-libdir.patch    |   25 +++++++++++++++
 2 files changed, 52 insertions(+), 5 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +2 -1
index 4311540..4dac450 100644
@@ -5,21 +5,40 @@ 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" 
 

meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb LICENSE = "BSD" · line 18

Quoted 10 lines
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +4 -2
-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 \
+                 --enable-login \
+                 --with-plugindir="${libdir}/sasl2/" \

I'm not sure I expected any of these changes based on your commit log, though. Well, moving --with/out-pam/opie/des into PACKAGECONFIG variables, yes, but not --with-bdb/--enable-login/--with-plugindir. Can you comment on those as well?

meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb LICENSE = "BSD" · line 24

Quoted 7 lines
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +4 -1
                  andrew_cv_runpath_switch=none"
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG = "ntlm \
+        ${@base_contains('DISTRO_FEATURES', 'ldap', 'ldap', '', d)} \
+        ${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
+        "

Shouldn't you be checking the other values in DISTRO_FEATURES as well? And is ntlm a given? I'm thinking you didn't necessarily mean to drop the ?? here.

-J.

Quoted 64 lines
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +17 -1
 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 +48,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
 }
meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch new file +25 -0
new file mode 100644
index 0000000..3fa8431
@@ -0,0 +1,25 @@
+Fix hardcoded libdir.
+
+Upstream-Status: Pending 
+
+Signed-off-by: Roy.Li <[email protected]>
+---
+ 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
+
Signature · 2 lines
-Joe MacDonald.
:wq
#2 lore raw
Quoted 29 lines · Joe MacDonald
Quoted 27 lines · [[PATCH] cyrus-sasl: several fixes] On 13.07.17 (Wed 14:24)…

From: "Roy.Li" <[email protected]>

1. Fix hardcoded libdir
2. configure cyrus-sasl based on PACKAGECONFIG
3. create user by inherit useradd
4. add -fPIC to CFLAG to fix a building failure, the cause as below:
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

Further investigation shows Upstream chose a strange way to keep compatible with certain versions of automake.

--- a/sasldb/Makefile.am
+++ b/sasldb/Makefile.am
@@ -1,6 +1,6 @@
# Makefile.am for the SASLdb library
# Rob Siemborski
-# $Id: Makefile.am,v 1.28 2005/04/11 05:09:31 shadow Exp $ +# $Id: Makefile.am,v 1.29 2005/05/07 04:14:56 shadow Exp $
# Copyright (c) 2000 Carnegie Mellon University. All rights reserved. #
# Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@ libsasldb_la_LIBADD = $(SASL_DB_BACKEND)
libsasldb_a_SOURCES =
EXTRA_libsasldb_a_SOURCES =

Quoted 7 lines
Quoted 4 lines

-libsasldb.a: libsasldb.la $(LOCAL_SASL_DB_BACKEND_STATIC)
- $(AR) cru .libs/$@ $(LOCAL_SASL_DB_BACKEND_STATIC)
+libsasldb.a: libsasldb.la $(SASL_DB_BACKEND_STATIC)
+ $(AR) cru .libs/$@ $(SASL_DB_BACKEND_STATIC)

This is ... odd. I'm not sure how this relates to the comment below, but your solution seems sound.

I make a wrong reference, it should be Makefile has to two rule;

.c.o:
.c.lo:

the objection of libsasldb.la will trigger ".c.lo:" to work, so allockey.c and db_berkeley.c are compiled two times.

Quoted 28 lines
Quoted 28 lines

that snippet of Makefile rule made libsasldb.a built twice, one with -fPIC, other without -fPIC. if no -fPIC library follow behind, this error will appear. so we enable -fPIC no matter whatever objects are built.

---
  .../cyrus-sasl/cyrus-sasl_2.1.26.bb                |   32 +++++++++++++++++---
  .../cyrus-sasl/files/Fix-hardcoded-libdir.patch    |   25 +++++++++++++++
  2 files changed, 52 insertions(+), 5 deletions(-)

create mode 100644 meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch

meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +3 -2
index 4311540..4dac450 100644
@@ -5,21 +5,40 @@ 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
 
Quoted 12 lines

meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb LICENSE = "BSD" · line 18

Quoted 7 lines
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +3 -1
  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 \
+                 --enable-login \
+                 --with-plugindir="${libdir}/sasl2/" \

I'm not sure I expected any of these changes based on your commit log, though. Well, moving --with/out-pam/opie/des into PACKAGECONFIG variables, yes, but not --with-bdb/--enable-login/--with-plugindir. Can you comment on those as well?

Ok, I will add comments on it.

Quoted 13 lines

meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb LICENSE = "BSD" · line 24

Quoted 8 lines
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +4 -1
                   andrew_cv_runpath_switch=none"
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG = "ntlm \
+        ${@base_contains('DISTRO_FEATURES', 'ldap', 'ldap', '', d)} \
+        ${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
+        "

Shouldn't you be checking the other values in DISTRO_FEATURES as well? And is ntlm a given? I'm thinking you didn't necessarily mean to drop the ?? here.

Quoted 1 line

-J.

since other values seem no plan to be implemented as DISTRO_FEATURES or other, so I keep them disabled directly.

Ok, I forget the default value, I will fix it by ??

-Roy

Quoted 65 lines
Quoted 65 lines
meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl_2.1.26.bb +17 -1
  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 +48,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
  }
meta-networking/recipes-daemons/cyrus-sasl/files/Fix-hardcoded-libdir.patch new file +25 -0
new file mode 100644
index 0000000..3fa8431
@@ -0,0 +1,25 @@
+Fix hardcoded libdir.
+
+Upstream-Status: Pending
+
+Signed-off-by: Roy.Li <[email protected]>
+---
+ 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
+
Signature · 2 lines
Best Reagrds,
Roy | RongQing Li