Patchwork [1/2] nss: New recipe

login
register
mail settings
Submitter Kim Bøndergaard
Date Nov. 6, 2013, 7:23 a.m.
Message ID <1383722634-28803-1-git-send-email-kibo@prevas.dk>
Download mbox | patch
Permalink /patch/288743/
State Changes Requested
Delegated to: Esben Haabendal
Headers show

Comments

Kim Bøndergaard - Nov. 6, 2013, 7:23 a.m.
---
 recipes/nss/files/cross-config.patch |  37 +++++++++++++
 recipes/nss/files/machine.patch      |  34 ++++++++++++
 recipes/nss/files/skip_signing.patch |  10 ++++
 recipes/nss/nss_3.15.2.oe            | 100 +++++++++++++++++++++++++++++++++++
 recipes/nss/nss_3.15.2.oe.sig        |   2 +
 5 files changed, 183 insertions(+)
 create mode 100644 recipes/nss/files/cross-config.patch
 create mode 100644 recipes/nss/files/machine.patch
 create mode 100644 recipes/nss/files/skip_signing.patch
 create mode 100644 recipes/nss/nss_3.15.2.oe
 create mode 100644 recipes/nss/nss_3.15.2.oe.sig
Esben Haabendal - Nov. 18, 2013, 7:47 p.m.
Kim Bøndergaard <kibo@prevas.dk> writes:

> ---
>  recipes/nss/files/cross-config.patch |  37 +++++++++++++
>  recipes/nss/files/machine.patch      |  34 ++++++++++++
>  recipes/nss/files/skip_signing.patch |  10 ++++
>  recipes/nss/nss_3.15.2.oe            | 100 +++++++++++++++++++++++++++++++++++
>  recipes/nss/nss_3.15.2.oe.sig        |   2 +
>  5 files changed, 183 insertions(+)
>  create mode 100644 recipes/nss/files/cross-config.patch
>  create mode 100644 recipes/nss/files/machine.patch
>  create mode 100644 recipes/nss/files/skip_signing.patch
>  create mode 100644 recipes/nss/nss_3.15.2.oe
>  create mode 100644 recipes/nss/nss_3.15.2.oe.sig
>
> diff --git a/recipes/nss/files/cross-config.patch b/recipes/nss/files/cross-config.patch
> new file mode 100644
> index 0000000..b47a07e
> --- /dev/null
> +++ b/recipes/nss/files/cross-config.patch
> @@ -0,0 +1,37 @@
> +--- nss/coreconf/Linux.org.mk	2013-08-06 12:45:47.096832931 +0200
> ++++ nss/coreconf/Linux.mk	2013-08-06 12:48:40.744827800 +0200
> +@@ -16,9 +16,9 @@
> + 	IMPL_STRATEGY = _PTH
> + endif
> + 
> +-CC			= gcc
> +-CCC			= g++
> +-RANLIB			= ranlib
> ++CC			= $(CROSS)gcc
> ++CCC			= $(CROSS)g++
> ++RANLIB			= $(CROSS)ranlib

If you look at c.oeclass and c++.oeclass, you will see that we actually
have CC, CXX, and RANLIB variables that should be used in these cases,
and not create new variables using this type of CROSS prefixing.  While
in most cases, the result will be the same, in cases where some special
setting for fx. CXX is configured, the code above will not work as
expected.

So change $(CROSS)gcc to $(CC), $(CROSS)g++, and $(CROSS)ranlib to
$(RANLIB).

> + 
> + DEFAULT_COMPILER = gcc
> + 
> +--- nss/coreconf/arch.org.mk	2013-08-06 14:10:25.528682880 +0200
> ++++ nss/coreconf/arch.mk	2013-08-06 14:11:41.140680646 +0200
> +@@ -33,7 +33,9 @@
> + # Attempt to differentiate between sparc and x86 Solaris
> + #
> + 
> +-OS_TEST := $(shell uname -m)
> ++ifeq ($(OS_TEST),)
> ++    OS_TEST := $(shell uname -m)
> ++endif
> + ifeq ($(OS_TEST),i86pc)
> +     OS_RELEASE := $(shell uname -r)_$(OS_TEST)
> + else
> +@@ -302,7 +302,7 @@
> + # IMPL_STRATEGY may be defined too.
> + #
> + 
> +-OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
> ++OBJDIR_NAME = obj
> + 
> + ifeq (,$(filter-out WIN%,$(OS_TARGET)))
> + ifndef BUILD_OPT
> diff --git a/recipes/nss/files/machine.patch b/recipes/nss/files/machine.patch
> new file mode 100644
> index 0000000..f8e80d3
> --- /dev/null
> +++ b/recipes/nss/files/machine.patch
> @@ -0,0 +1,34 @@
> +--- nss/coreconf/UNIX.mk.orig	2013-11-05 13:58:41.541566526 +0100
> ++++ nss/coreconf/UNIX.mk	2013-11-05 13:58:48.925566308 +0100
> +@@ -24,7 +24,7 @@
> + NSINSTALL      = $(BUILD_TREE)/nss/nsinstall
> + else
> + NSINSTALL_DIR  = $(CORE_DEPTH)/coreconf/nsinstall
> +-NSINSTALL      = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall
> ++NSINSTALL      = nsinstall
> + endif
> + 
> + MKDEPEND_DIR    = $(CORE_DEPTH)/coreconf/mkdepend
> +--- nss/cmd/shlibsign/sign.sh.orig	2013-11-05 14:01:29.197561573 +0100
> ++++ nss/cmd/shlibsign/sign.sh	2013-11-05 13:51:46.789578781 +0100
> +@@ -29,8 +29,8 @@
> +         PATH=${ARG1}/lib:${ARG1}/bin:${ARG4}:${PATH}
> +     fi
> +     export PATH
> +-    echo "${2}"/shlibsign -v -i "${5}"
> +-    "${2}"/shlibsign -v -i "${5}"
> ++    echo shlibsign -v -i "${5}"
> ++    shlibsign -v -i "${5}"
> +     ;;
> + *)
> +     LIBPATH=`(cd "${1}"/lib; pwd)`:`(cd "${4}"; pwd)`:$LIBPATH
> +@@ -45,7 +45,7 @@
> +     export LIBRARY_PATH
> +     ADDON_PATH=${1}/lib:${4}:$ADDON_PATH
> +     export ADDON_PATH
> +-    echo "${2}"/shlibsign -v -i "${5}"
> +-    "${2}"/shlibsign -v -i "${5}"
> ++    echo shlibsign -v -i "${5}"
> ++    shlibsign -v -i "${5}"
> +     ;;
> + esac
> diff --git a/recipes/nss/files/skip_signing.patch b/recipes/nss/files/skip_signing.patch
> new file mode 100644
> index 0000000..3fb6b93
> --- /dev/null
> +++ b/recipes/nss/files/skip_signing.patch
> @@ -0,0 +1,10 @@
> +--- nss/cmd/shlibsign/Makefile.orig	2013-11-06 07:53:45.934214799 +0100
> ++++ nss/cmd/shlibsign/Makefile	2013-11-06 07:55:13.986212198 +0100
> +@@ -95,5 +95,6 @@
> +     endif
> + endif
> + 
> ++ifndef SKIP_SHLIBSIGN
> + libs install :: $(CHECKLOC)
> +-
> ++endif
> diff --git a/recipes/nss/nss_3.15.2.oe b/recipes/nss/nss_3.15.2.oe
> new file mode 100644
> index 0000000..e25533d
> --- /dev/null
> +++ b/recipes/nss/nss_3.15.2.oe
> @@ -0,0 +1,100 @@
> +SUMMARY = "Network Security Services - provides cross platform security support"
> +DESCRIPTION = """
> +Network Security Services (NSS) comprises a set of libraries designed to support
> +cross-platform development of security-enabled client and server applications
> +with optional support for hardware SSL acceleration on the server side and
> +hardware smart cards on the client side.
> +"""
> +LICENSE = "MPL"
> +HOMEPAGE = "https://developer.mozilla.org/en/docs/NSS"
> +
> +RECIPE_TYPES = "machine native"

Mads also included RECIPE_TYPE sdk, so you should probably add that also.

> +
> +SRC_URI = "ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_15_2_RTM/src/${PN}-${PV}.tar.gz"

Maybe you should define a variable that is set to
"${@d.get('PV').replace('.','_')}" and thus "3_15_2" in this case, and
use that to make the SRC_URI version independent for sharing between
different versions when upgrading.

> +
> +SRC_URI += "http://www.linuxfromscratch.org/patches/blfs/svn/nss-3.15.2-standalone-1.patch;striplevel=2"
> +
> +SRC_URI += "file://cross-config.patch"
> +SRC_URI += "file://skip_signing.patch" # From open embedded
> +SRC_URI:>machine += " file://machine.patch"

This patch is not really a "machine" patch, but rather an "all other
than nativce" patch.  Do something like

SRC_URI_NATIVE = "file://not-native.patch"
SRC_URI_NATIVE:native = ""
SRC_URI += "${SRC_URI_NATIVE}"

> +
> +inherit c make library pkgconfig auto-package-utils auto-package-libs
> +
> +# To make cross-compile work
> +export OS_TEST = "${TARGET_CPU}"

Please use ${HOST_CPU} unless you really need ${TARGET_CPU}.

> +
> +# According to http://www.linuxfromscratch.org/blfs/view/svn/postlfs/nss.html
> +PARALLEL_MAKE = ""
> +
> +DEPENDS += "nspr nspr-dev libz libdl libpthread librt"
> +DEPENDS:>machine += " native:${PN}-nsinstall"

Again, this is not really machine specific, but rather
everything-else-than-native.  Use a DEPENDS_NATIVE variable and do
something like

DEPENDS_NATIVE = "native:${PN}-nsinstall"
DEPENDS_NATIVE:native= ""
DEPENDS += "${DEPENDS_NATIVE}"

> +
> +S = "${SRCDIR}/${PN}-${PV}/${PN}"
> +
> +EXTRA_OEMAKE_COMPILE = " \
> +	BUILD_OPT=1 \
> +	NSPR_INCLUDE_DIR=${HOST_SYSROOT}/${includedir} \
> +	USE_SYSTEM_ZLIB=1 \
> +	ZLIB_LIBS=-lz \
> +	SKIP_SHLIBSIGN=1 \
> +"
> +
> +EXTRA_OEMAKE_COMPILE:>native += " \
> +	USE_64=1 \

What is this USE_64?  Is it related to the native arch being 64 bit?

> +"
> +
> +do_install () {
> +	install -d ${D}${bindir}
> +	install -m 755 ${S}/../dist/obj/bin/* ${D}${bindir}
> +
> +	install -d ${D}${libdir}
> +	install -m 655 ${S}/../dist/obj/lib/*.a ${D}/${libdir}
> +
> +	install -d ${D}${sharedlibdir}
> +	cd ${S}/../dist/obj/lib
> +	for solib in *.so
> +	do
> +		install -m 755 ${S}/../dist/obj/lib/$solib \
> +			 ${D}/${sharedlibdir}/$solib
> +	done
> +
> +	install -d ${D}${includedir}/nss
> +	install -m 755 ${S}/../dist/public/nss/* ${D}${includedir}/nss
> +	
> +	install -d ${D}${sharedlibdir}/pkgconfig
> +	install -m 644  ${S}/../dist/obj/lib/pkgconfig/* \
> +		${D}/${sharedlibdir}/pkgconfig
> +
> +	install -m 755 ${S}/coreconf/nsinstall/obj/nsinstall ${D}${bindir}
> +}
> +
> +
> +# no *so.* files are created so use *.so
> +# Accomplish by switching SOLIBS and SOLIBSDEV
> +SOLIBSDEV = ".so.*"
> +SOLIBS = ".so"
> +
> +DEPENDLIBS = "nspr libz libdl libpthread librt"
> +
> +AUTO_PACKAGE_UTILS = "addbuiltin conflict listsuites oidcalc pp ssltap \
> +                      atob crlutil lowhashtest p7content pwdecrypt strsclnt \
> +		      baddbdir crmftest makepqg p7env remtest symkeyutil \
> +		      bltest dbtest mangle p7sign rsaperf tstclnt \
> +		      btoa derdump modutil p7verify sdrtest vfychain \
> +		      certcgi dertimetest multinit pk11gcmtest secmodtest vfyserv \
> +		      certutil digest nonspr10 pk11mode  selfserv \
> +		      checkcert encodeinttest nss-config pk12util shlibsign \
> +		      chktest fipstest ocspclnt pk1sign signtool \
> +		      cmsutil httpserv ocspresp pkix-errcodes signver \
> +                      nsinstall \
> +"
> +
> +AUTO_PACKAGE_UTILS_DEPENDS = "${DEPENDLIBS} libnss"
> +
> +AUTO_PACKAGE_LIBS = "freebl3 nss3 nssckbi nssdbm3 nsssysinit nssutil3 \
> +		     smime3 softokn3 sqlite3 ssl3 \
> +"
> +
> +PACKAGES += "${PN}-utils"
> +RDEPENDS_${PN}-utils = "${AUTO_PACKAGE_UTILS_PACKAGES}"
> +
> diff --git a/recipes/nss/nss_3.15.2.oe.sig b/recipes/nss/nss_3.15.2.oe.sig
> new file mode 100644
> index 0000000..cb04120
> --- /dev/null
> +++ b/recipes/nss/nss_3.15.2.oe.sig
> @@ -0,0 +1,2 @@
> +767a423db66948c55c04c2a31a9626b7a95040e9  nss-3.15.2-standalone-1.patch
> +2d900c296bf11deabbf833ebd6ecdea549c97a5f  nss-3.15.2.tar.gz

/Esben

Patch

diff --git a/recipes/nss/files/cross-config.patch b/recipes/nss/files/cross-config.patch
new file mode 100644
index 0000000..b47a07e
--- /dev/null
+++ b/recipes/nss/files/cross-config.patch
@@ -0,0 +1,37 @@ 
+--- nss/coreconf/Linux.org.mk	2013-08-06 12:45:47.096832931 +0200
++++ nss/coreconf/Linux.mk	2013-08-06 12:48:40.744827800 +0200
+@@ -16,9 +16,9 @@
+ 	IMPL_STRATEGY = _PTH
+ endif
+ 
+-CC			= gcc
+-CCC			= g++
+-RANLIB			= ranlib
++CC			= $(CROSS)gcc
++CCC			= $(CROSS)g++
++RANLIB			= $(CROSS)ranlib
+ 
+ DEFAULT_COMPILER = gcc
+ 
+--- nss/coreconf/arch.org.mk	2013-08-06 14:10:25.528682880 +0200
++++ nss/coreconf/arch.mk	2013-08-06 14:11:41.140680646 +0200
+@@ -33,7 +33,9 @@
+ # Attempt to differentiate between sparc and x86 Solaris
+ #
+ 
+-OS_TEST := $(shell uname -m)
++ifeq ($(OS_TEST),)
++    OS_TEST := $(shell uname -m)
++endif
+ ifeq ($(OS_TEST),i86pc)
+     OS_RELEASE := $(shell uname -r)_$(OS_TEST)
+ else
+@@ -302,7 +302,7 @@
+ # IMPL_STRATEGY may be defined too.
+ #
+ 
+-OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
++OBJDIR_NAME = obj
+ 
+ ifeq (,$(filter-out WIN%,$(OS_TARGET)))
+ ifndef BUILD_OPT
diff --git a/recipes/nss/files/machine.patch b/recipes/nss/files/machine.patch
new file mode 100644
index 0000000..f8e80d3
--- /dev/null
+++ b/recipes/nss/files/machine.patch
@@ -0,0 +1,34 @@ 
+--- nss/coreconf/UNIX.mk.orig	2013-11-05 13:58:41.541566526 +0100
++++ nss/coreconf/UNIX.mk	2013-11-05 13:58:48.925566308 +0100
+@@ -24,7 +24,7 @@
+ NSINSTALL      = $(BUILD_TREE)/nss/nsinstall
+ else
+ NSINSTALL_DIR  = $(CORE_DEPTH)/coreconf/nsinstall
+-NSINSTALL      = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall
++NSINSTALL      = nsinstall
+ endif
+ 
+ MKDEPEND_DIR    = $(CORE_DEPTH)/coreconf/mkdepend
+--- nss/cmd/shlibsign/sign.sh.orig	2013-11-05 14:01:29.197561573 +0100
++++ nss/cmd/shlibsign/sign.sh	2013-11-05 13:51:46.789578781 +0100
+@@ -29,8 +29,8 @@
+         PATH=${ARG1}/lib:${ARG1}/bin:${ARG4}:${PATH}
+     fi
+     export PATH
+-    echo "${2}"/shlibsign -v -i "${5}"
+-    "${2}"/shlibsign -v -i "${5}"
++    echo shlibsign -v -i "${5}"
++    shlibsign -v -i "${5}"
+     ;;
+ *)
+     LIBPATH=`(cd "${1}"/lib; pwd)`:`(cd "${4}"; pwd)`:$LIBPATH
+@@ -45,7 +45,7 @@
+     export LIBRARY_PATH
+     ADDON_PATH=${1}/lib:${4}:$ADDON_PATH
+     export ADDON_PATH
+-    echo "${2}"/shlibsign -v -i "${5}"
+-    "${2}"/shlibsign -v -i "${5}"
++    echo shlibsign -v -i "${5}"
++    shlibsign -v -i "${5}"
+     ;;
+ esac
diff --git a/recipes/nss/files/skip_signing.patch b/recipes/nss/files/skip_signing.patch
new file mode 100644
index 0000000..3fb6b93
--- /dev/null
+++ b/recipes/nss/files/skip_signing.patch
@@ -0,0 +1,10 @@ 
+--- nss/cmd/shlibsign/Makefile.orig	2013-11-06 07:53:45.934214799 +0100
++++ nss/cmd/shlibsign/Makefile	2013-11-06 07:55:13.986212198 +0100
+@@ -95,5 +95,6 @@
+     endif
+ endif
+ 
++ifndef SKIP_SHLIBSIGN
+ libs install :: $(CHECKLOC)
+-
++endif
diff --git a/recipes/nss/nss_3.15.2.oe b/recipes/nss/nss_3.15.2.oe
new file mode 100644
index 0000000..e25533d
--- /dev/null
+++ b/recipes/nss/nss_3.15.2.oe
@@ -0,0 +1,100 @@ 
+SUMMARY = "Network Security Services - provides cross platform security support"
+DESCRIPTION = """
+Network Security Services (NSS) comprises a set of libraries designed to support
+cross-platform development of security-enabled client and server applications
+with optional support for hardware SSL acceleration on the server side and
+hardware smart cards on the client side.
+"""
+LICENSE = "MPL"
+HOMEPAGE = "https://developer.mozilla.org/en/docs/NSS"
+
+RECIPE_TYPES = "machine native"
+
+SRC_URI = "ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_15_2_RTM/src/${PN}-${PV}.tar.gz"
+
+SRC_URI += "http://www.linuxfromscratch.org/patches/blfs/svn/nss-3.15.2-standalone-1.patch;striplevel=2"
+
+SRC_URI += "file://cross-config.patch"
+SRC_URI += "file://skip_signing.patch" # From open embedded
+SRC_URI:>machine += " file://machine.patch"
+
+inherit c make library pkgconfig auto-package-utils auto-package-libs
+
+# To make cross-compile work
+export OS_TEST = "${TARGET_CPU}"
+
+# According to http://www.linuxfromscratch.org/blfs/view/svn/postlfs/nss.html
+PARALLEL_MAKE = ""
+
+DEPENDS += "nspr nspr-dev libz libdl libpthread librt"
+DEPENDS:>machine += " native:${PN}-nsinstall"
+
+S = "${SRCDIR}/${PN}-${PV}/${PN}"
+
+EXTRA_OEMAKE_COMPILE = " \
+	BUILD_OPT=1 \
+	NSPR_INCLUDE_DIR=${HOST_SYSROOT}/${includedir} \
+	USE_SYSTEM_ZLIB=1 \
+	ZLIB_LIBS=-lz \
+	SKIP_SHLIBSIGN=1 \
+"
+
+EXTRA_OEMAKE_COMPILE:>native += " \
+	USE_64=1 \
+"
+
+do_install () {
+	install -d ${D}${bindir}
+	install -m 755 ${S}/../dist/obj/bin/* ${D}${bindir}
+
+	install -d ${D}${libdir}
+	install -m 655 ${S}/../dist/obj/lib/*.a ${D}/${libdir}
+
+	install -d ${D}${sharedlibdir}
+	cd ${S}/../dist/obj/lib
+	for solib in *.so
+	do
+		install -m 755 ${S}/../dist/obj/lib/$solib \
+			 ${D}/${sharedlibdir}/$solib
+	done
+
+	install -d ${D}${includedir}/nss
+	install -m 755 ${S}/../dist/public/nss/* ${D}${includedir}/nss
+	
+	install -d ${D}${sharedlibdir}/pkgconfig
+	install -m 644  ${S}/../dist/obj/lib/pkgconfig/* \
+		${D}/${sharedlibdir}/pkgconfig
+
+	install -m 755 ${S}/coreconf/nsinstall/obj/nsinstall ${D}${bindir}
+}
+
+
+# no *so.* files are created so use *.so
+# Accomplish by switching SOLIBS and SOLIBSDEV
+SOLIBSDEV = ".so.*"
+SOLIBS = ".so"
+
+DEPENDLIBS = "nspr libz libdl libpthread librt"
+
+AUTO_PACKAGE_UTILS = "addbuiltin conflict listsuites oidcalc pp ssltap \
+                      atob crlutil lowhashtest p7content pwdecrypt strsclnt \
+		      baddbdir crmftest makepqg p7env remtest symkeyutil \
+		      bltest dbtest mangle p7sign rsaperf tstclnt \
+		      btoa derdump modutil p7verify sdrtest vfychain \
+		      certcgi dertimetest multinit pk11gcmtest secmodtest vfyserv \
+		      certutil digest nonspr10 pk11mode  selfserv \
+		      checkcert encodeinttest nss-config pk12util shlibsign \
+		      chktest fipstest ocspclnt pk1sign signtool \
+		      cmsutil httpserv ocspresp pkix-errcodes signver \
+                      nsinstall \
+"
+
+AUTO_PACKAGE_UTILS_DEPENDS = "${DEPENDLIBS} libnss"
+
+AUTO_PACKAGE_LIBS = "freebl3 nss3 nssckbi nssdbm3 nsssysinit nssutil3 \
+		     smime3 softokn3 sqlite3 ssl3 \
+"
+
+PACKAGES += "${PN}-utils"
+RDEPENDS_${PN}-utils = "${AUTO_PACKAGE_UTILS_PACKAGES}"
+
diff --git a/recipes/nss/nss_3.15.2.oe.sig b/recipes/nss/nss_3.15.2.oe.sig
new file mode 100644
index 0000000..cb04120
--- /dev/null
+++ b/recipes/nss/nss_3.15.2.oe.sig
@@ -0,0 +1,2 @@ 
+767a423db66948c55c04c2a31a9626b7a95040e9  nss-3.15.2-standalone-1.patch
+2d900c296bf11deabbf833ebd6ecdea549c97a5f  nss-3.15.2.tar.gz