From ffec5a2b2e4ac28c238b47b96a9f92f03a69241c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 4 Jan 2012 14:45:11 -0500 Subject: [PATCH] libp11: import latest from Gentoo This version no longer needs libtool at runtime. BUG=chromium-os:20376 TEST=`emerge-x86-alex libp11` still works, and doesn't link against libtool TEST=`emerge-x86-alex opensc engine_pkcs11` still works TEST=cbuildbot x86-generic-full passed Change-Id: If3d7df287f903b6fd03c1631bb923c1861ebb891 Reviewed-on: https://gerrit.chromium.org/gerrit/13660 Reviewed-by: Matt Tennant Tested-by: Mike Frysinger Commit-Ready: Mike Frysinger --- .../portage-stable/dev-libs/libp11/Manifest | 2 +- .../libp11/files/libp11-0.2.8-no-ltdl.patch | 196 ++++++++++++++++++ ...11-0.2.7.ebuild => libp11-0.2.8-r1.ebuild} | 24 ++- 3 files changed, 210 insertions(+), 12 deletions(-) create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch rename sdk_container/src/third_party/portage-stable/dev-libs/libp11/{libp11-0.2.7.ebuild => libp11-0.2.8-r1.ebuild} (71%) diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libp11/Manifest b/sdk_container/src/third_party/portage-stable/dev-libs/libp11/Manifest index 70e964cfc4..9cea253553 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libp11/Manifest +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libp11/Manifest @@ -1 +1 @@ -DIST libp11-0.2.7.tar.gz 376422 RMD160 f3988b4c32c7d0fe19c16ebe3aa92d7a16df46a2 SHA1 aa794f4c114eb41f03b9c844ec31fb932b1aed02 SHA256 b741e2fea57d692c070111ad843e4bd025c18c0954aaca3df3a076e5142e5f4d +DIST libp11-0.2.8.tar.gz 377508 RMD160 6cda5a5b456aa46dd8f10021f606b86393a88465 SHA1 2d1f6dc4200038f55a0cb7e22858f93e484b0724 SHA256 a4121015503ade98074b5e2a2517fc8a139f8b28aed10021db2bb77283f40691 diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch new file mode 100644 index 0000000000..f3997ba65b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch @@ -0,0 +1,196 @@ +patch from upstream + +From 1c872a3e9c4cbf3cbd485168a7e98b589bbad57a Mon Sep 17 00:00:00 2001 +From: alonbl +Date: Wed, 14 Dec 2011 10:46:45 +0000 +Subject: [PATCH] Remove ltdl usage + +Use native POSIX/Windows + + +git-svn-id: http://www.opensc-project.org/svn/libp11/trunk@202 6d86ddd8-19ff-0310-a323-aa2ba648d307 +--- + configure.ac | 23 +++++------------------ + src/Makefile.am | 4 ++-- + src/Makefile.mak | 7 ++----- + src/libpkcs11.c | 52 +++++++++++++++++++++++++++++++++++++++------------- + 4 files changed, 48 insertions(+), 38 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 679b8da..9fa96bf 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -180,25 +180,14 @@ if test "${svn_checkout}" = "yes"; then + fi + fi + +-AC_ARG_VAR([LTLIB_CFLAGS], [C compiler flags for libltdl]) +-AC_ARG_VAR([LTLIB_LIBS], [linker flags for libltdl]) +-if test -z "${LTLIB_LIBS}"; then ++if test "${WIN32}" != "yes"; then + AC_CHECK_LIB( +- [ltdl], +- [lt_dlopen], +- [LTLIB_LIBS="-lltdl"], +- [AC_MSG_ERROR([ltdl not found, please install libltdl and/or libtool])] ++ [dl], ++ [dlopen], ++ , ++ [AC_MSG_ERROR([libdl required])] + ) +- + fi +-saved_CFLAGS="${CFLAGS}" +-CFLAGS="${CFLAGS} ${LTLIB_CFLAGS}" +-AC_CHECK_HEADER( +- [ltdl.h], +- , +- [AC_MSG_ERROR([ltdl.h not found, please install libltdl and/or libtool])] +-) +-CFLAGS="${saved_CFLAGS}" + + PKG_CHECK_MODULES( + [OPENSSL], +@@ -273,8 +262,6 @@ Compiler flags: ${CFLAGS} + Linker flags: ${LDFLAGS} + Libraries: ${LIBS} + +-LTLIB_CFLAGS: ${LTLIB_CFLAGS} +-LTLIB_LIBS: ${LTLIB_LIBS} + OPENSSL_CFLAGS: ${OPENSSL_CFLAGS} + OPENSSL_LIBS: ${OPENSSL_LIBS} + +diff --git a/src/Makefile.am b/src/Makefile.am +index c66a8cd..0910f44 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -16,8 +16,8 @@ libp11_la_SOURCES += versioninfo.rc + else + dist_noinst_DATA = versioninfo.rc + endif +-libp11_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS) $(LTLIB_CFLAGS) +-libp11_la_LIBADD = $(OPENSSL_LIBS) $(LTLIB_LIBS) ++libp11_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS) ++libp11_la_LIBADD = $(OPENSSL_LIBS) + libp11_la_LDFLAGS = $(AM_LDFLAGS) \ + -version-info @LIBP11_LT_CURRENT@:@LIBP11_LT_REVISION@:@LIBP11_LT_AGE@ \ + -export-symbols "$(srcdir)/libp11.exports" \ +diff --git a/src/Makefile.mak b/src/Makefile.mak +index 73b5428..fa0809c 100644 +--- a/src/Makefile.mak ++++ b/src/Makefile.mak +@@ -1,10 +1,7 @@ +-LIBLTDL_INC = # E.g. /IC:\libtool-1.5.8-lib\include +-LIBLTDL_LIB = # E.g. C:\libtool-1.5.8-lib\lib\libltdl.lib +- + OPENSSL_INC = /IC:\openssl\include + OPENSSL_LIB = C:\openssl\out32dll\libeay32.lib + +-COPTS = /Zi /MD /nologo /I..\ /I. $(OPENSSL_INC) $(LIBLTDL_INC) /D_WIN32_WINNT=0x0400 /DWIN32 /DWIN32_LEAN_AND_MEAN ++COPTS = /Zi /MD /nologo /I..\ /I. $(OPENSSL_INC) /D_WIN32_WINNT=0x0400 /DWIN32 /DWIN32_LEAN_AND_MEAN + LINKFLAGS = /DEBUG /NOLOGO /INCREMENTAL:NO /MACHINE:IX86 + + TARGET = libp11.dll +@@ -28,6 +25,6 @@ $(TARGET): $(OBJECTS) versioninfo.res + echo EXPORTS >> $*.def + type $*.exports >> $*.def + link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) \ +- $(OBJECTS) $(OPENSSL_LIB) $(LIBLTDL_LIB) versioninfo.res ++ $(OBJECTS) $(OPENSSL_LIB) versioninfo.res + if EXIST $*.dll.manifest mt -manifest $*.dll.manifest -outputresource:$*.dll;2 + +diff --git a/src/libpkcs11.c b/src/libpkcs11.c +index a146361..93584d9 100644 +--- a/src/libpkcs11.c ++++ b/src/libpkcs11.c +@@ -27,14 +27,18 @@ + #include + #include + #include +-#include ++#ifdef WIN32 ++#include ++#else ++#include ++#endif + #include "libp11-int.h" + + #define MAGIC 0xd00bed00 + + struct sc_pkcs11_module { + unsigned int _magic; +- lt_dlhandle handle; ++ void *handle; + }; + typedef struct sc_pkcs11_module sc_pkcs11_module_t; + +@@ -52,19 +56,40 @@ C_LoadModule(const char *mspec, CK_FUNCTION_LIST_PTR_PTR funcs) + if (mspec == NULL) + return NULL; + +- if (lt_dlinit() != 0) +- return NULL; +- + mod = (sc_pkcs11_module_t *) calloc(1, sizeof(*mod)); + mod->_magic = MAGIC; + +- mod->handle = lt_dlopen(mspec); ++#ifdef WIN32 ++ mod->handle = LoadLibraryA(mspec); ++#else ++ mod->handle = dlopen(mspec, RTLD_NOW); ++#endif ++ + if (mod->handle == NULL) + goto failed; + +- /* Get the list of function pointers */ +- c_get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR)) +- lt_dlsym(mod->handle, "C_GetFunctionList"); ++#ifdef WIN32 ++ c_get_function_list = (CK_C_GetFunctionList)GetProcAddress ( ++ mod->handle, ++ "C_GetFunctionList" ++ ); ++#else ++ { ++ /* ++ * Make compiler happy! ++ */ ++ void *p = dlsym( ++ mod->handle, ++ "C_GetFunctionList" ++ ); ++ memmove( ++ &c_get_function_list, ++ &p, ++ sizeof(void *) ++ ); ++ } ++#endif ++ + if (!c_get_function_list) + goto failed; + rv = c_get_function_list(funcs); +@@ -89,13 +114,14 @@ C_UnloadModule(void *module) + if (!mod || mod->_magic != MAGIC) + return CKR_ARGUMENTS_BAD; + +- if (lt_dlclose(mod->handle) < 0) +- return CKR_FUNCTION_FAILED; ++#ifdef WIN32 ++ FreeLibrary(mod->handle); ++#else ++ dlclose(mod->handle); ++#endif + + memset(mod, 0, sizeof(*mod)); + free(mod); + +- lt_dlexit(); +- + return CKR_OK; + } +-- +1.7.6.1 + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libp11/libp11-0.2.7.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/libp11/libp11-0.2.8-r1.ebuild similarity index 71% rename from sdk_container/src/third_party/portage-stable/dev-libs/libp11/libp11-0.2.7.ebuild rename to sdk_container/src/third_party/portage-stable/dev-libs/libp11/libp11-0.2.8-r1.ebuild index e767d21664..512d91ab3d 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libp11/libp11-0.2.7.ebuild +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libp11/libp11-0.2.8-r1.ebuild @@ -1,8 +1,9 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/libp11/libp11-0.2.7.ebuild,v 1.8 2011/04/03 22:29:33 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/libp11/libp11-0.2.8-r1.ebuild,v 1.1 2012/01/02 19:40:31 vapier Exp $ -EAPI="2" +EAPI="4" +inherit eutils autotools DESCRIPTION="A library implementing a layer on top of PKCS#11 API to make using PKCS#11 implementations easier." HOMEPAGE="http://www.opensc-project.org/libp11/" @@ -19,9 +20,7 @@ SLOT="0" KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86" IUSE="doc" -# libtool is required at runtime as it uses libltdl. -RDEPEND="dev-libs/openssl - sys-devel/libtool" +RDEPEND="dev-libs/openssl" DEPEND="${RDEPEND} dev-util/pkgconfig doc? ( app-doc/doxygen )" @@ -30,20 +29,23 @@ if [[ "${PV}" = "9999" ]]; then DEPEND="${DEPEND} app-text/docbook-xsl-stylesheets dev-libs/libxslt" - - src_prepare() { - eautoreconf - } fi +src_prepare() { + epatch "${FILESDIR}"/${P}-no-ltdl.patch + eautoreconf +} + src_configure() { econf \ --docdir="/usr/share/doc/${PF}" \ --htmldir="/usr/share/doc/${PF}/html" \ - $(use_enable doc) \ + --enable-shared --disable-static \ + --enable-doc \ $(use_enable doc api-doc) } src_install() { emake install DESTDIR="${D}" || die "emake install failed" + find "${D}" -name '*.la' -delete }