From e0697ba4c99455f3d7ff27129c6229d90062c298 Mon Sep 17 00:00:00 2001 From: landry Date: Thu, 9 Nov 2017 18:45:24 +0000 Subject: [PATCH] Instead of providing old versions of nss-config & nss.pc shoplifted ages ago from Debian, just patch & use the ones added upstream in bug #1277852. This way, we properly list the right libs when linking, including nssutil3 (which should fix linking chrome with lld) - and while here fix includedir to be consistent with cflags. Prompted by an original diff from espie@ Tested in bulks by ajacoutot@ and myself WANTLIB fixes removing softokn3 to come --- security/nss/Makefile | 17 +- security/nss/files/nss-config | 147 ------------------ security/nss/files/nss.pc | 13 -- .../patch-nss_pkg_pkg-config_nss-config_in | 20 +++ .../patch-nss_pkg_pkg-config_nss_pc_in | 23 +++ 5 files changed, 52 insertions(+), 168 deletions(-) delete mode 100644 security/nss/files/nss-config delete mode 100644 security/nss/files/nss.pc create mode 100644 security/nss/patches/patch-nss_pkg_pkg-config_nss-config_in create mode 100644 security/nss/patches/patch-nss_pkg_pkg-config_nss_pc_in diff --git a/security/nss/Makefile b/security/nss/Makefile index bfcac1b1857..1ff7cb5e29e 100644 --- a/security/nss/Makefile +++ b/security/nss/Makefile @@ -1,9 +1,11 @@ -# $OpenBSD: Makefile,v 1.80 2017/09/27 06:45:19 landry Exp $ +# $OpenBSD: Makefile,v 1.81 2017/11/09 18:45:24 landry Exp $ COMMENT= libraries to support development of security-enabled apps VERSION= 3.33 +NSPR_VERSION= 4.17 DISTNAME= nss-${VERSION} +REVISION= 0 SO_VERSION= 49.1 .for _lib in freebl3 nss3 nssckbi nssdbm3 nssutil3 smime3 softokn3 ssl3 @@ -21,7 +23,7 @@ PERMIT_PACKAGE_CDROM= Yes MASTER_SITES= https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${DISTNAME:U:C/[-.]/_/g}_RTM/src/ LIB_DEPENDS= databases/sqlite3 \ - devel/nspr>=4.12 + devel/nspr>=${NSPR_VERSION} WANTLIB += c pthread z nspr4 plc4 plds4 sqlite3>=22 MAKE_ENV= BUILD_OPT=1 \ @@ -42,7 +44,7 @@ NSSDIST= ${WRKDIST}/dist NSSOBJ= ${NSSDIST}/OpenBSD`uname -r`${OBJ64}_OPT.OBJ ALL_TARGET= nss_build_all -SUBST_VARS += VERSION +SUBST_VARS += VERSION NSPR_VERSION # Don't forget to sync these with http://wiki.mozilla.org/NSS:ToolsToShip MAIN_TOOLS= certutil modutil pk12util signtool ssltap crlutil \ @@ -55,11 +57,10 @@ do-install: ${INSTALL_DATA} ${NSSOBJ}/lib/*.so.${SO_VERSION} ${PREFIX}/lib/ ${INSTALL_DATA} ${NSSOBJ}/lib/{libcrmf.a,*.chk} ${PREFIX}/lib/ cd ${NSSOBJ}/bin && ${INSTALL_PROGRAM} ${MAIN_TOOLS} ${PREFIX}/bin/ - ${SUBST_CMD} -m 0644 -c ${FILESDIR}/nss.pc \ - ${PREFIX}/lib/pkgconfig/nss.pc \ - ${FILESDIR}/nss-config ${PREFIX}/bin/nss-config - chown ${BINOWN}:${BINGRP} ${PREFIX}/{bin/nss-config,lib/pkgconfig/nss.pc} - chmod +x ${PREFIX}/bin/nss-config + ${SUBST_CMD} -m 644 -o ${BINOWN} -g ${BINGRP} \ + -c ${WRKSRC}/pkg/pkg-config/nss.pc.in ${PREFIX}/lib/pkgconfig/nss.pc + ${SUBST_CMD} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} \ + -c ${WRKSRC}/pkg/pkg-config/nss-config.in ${PREFIX}/bin/nss-config do-test: cd ${WRKSRC}/tests && ${SETENV} ${MAKE_ENV} \ diff --git a/security/nss/files/nss-config b/security/nss/files/nss-config deleted file mode 100644 index e2bb8eac2f0..00000000000 --- a/security/nss/files/nss-config +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/sh -# taken from debian/nss-config.in -# adapted for OpenBSD's prefix/version substs -prefix=${TRUEPREFIX} - -# inspired from debian Makefile -major_version=$(awk '/NSS_VMAJOR/ {print $3}' ${TRUEPREFIX}/include/nss/nss.h) -minor_version=$(awk '/NSS_VMINOR/ {print $3}' ${TRUEPREFIX}/include/nss/nss.h) -patch_version=$(awk '/NSS_VPATCH/ {print $3}' ${TRUEPREFIX}/include/nss/nss.h) - -usage() -{ - cat <&2 -fi - -lib_ssl=yes -lib_smime=yes -lib_nss=yes -lib_nssutil=yes - -while test $# -gt 0; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --prefix=*) - prefix=$optarg - ;; - --prefix) - echo_prefix=yes - ;; - --exec-prefix=*) - exec_prefix=$optarg - ;; - --exec-prefix) - echo_exec_prefix=yes - ;; - --includedir=*) - includedir=$optarg - ;; - --includedir) - echo_includedir=yes - ;; - --libdir=*) - libdir=$optarg - ;; - --libdir) - echo_libdir=yes - ;; - --version) - echo ${major_version}.${minor_version}.${patch_version} - ;; - --cflags) - echo_cflags=yes - ;; - --libs) - echo_libs=yes - ;; - ssl) - lib_ssl=yes - ;; - smime) - lib_smime=yes - ;; - nss) - lib_nss=yes - ;; - nssutil) - lib_nssutil=yes - ;; - *) - usage 1 1>&2 - ;; - esac - shift -done - -# Set variables that may be dependent upon other variables -if test -z "$exec_prefix"; then - exec_prefix=${prefix} -fi -if test -z "$includedir"; then - includedir=${prefix}/include/nss -fi -if test -z "$libdir"; then - libdir=${exec_prefix}/lib -fi - -if test "$echo_prefix" = "yes"; then - echo $prefix -fi - -if test "$echo_exec_prefix" = "yes"; then - echo $exec_prefix -fi - -if test "$echo_includedir" = "yes"; then - echo $includedir -fi - -if test "$echo_libdir" = "yes"; then - echo $libdir -fi - -if test "$echo_cflags" = "yes"; then - echo -I$includedir -fi - -if test "$echo_libs" = "yes"; then - libdirs="-L$libdir" - if test -n "$lib_ssl"; then - libdirs="$libdirs -lssl${major_version}" - fi - if test -n "$lib_smime"; then - libdirs="$libdirs -lsmime${major_version}" - fi - if test -n "$lib_nss"; then - libdirs="$libdirs -lnss${major_version}" - fi - if test -n "$lib_nssutil"; then - libdirs="$libdirs -lnssutil${major_version}" - fi - echo $libdirs -fi - diff --git a/security/nss/files/nss.pc b/security/nss/files/nss.pc deleted file mode 100644 index 675689a7cc0..00000000000 --- a/security/nss/files/nss.pc +++ /dev/null @@ -1,13 +0,0 @@ -# $OpenBSD: nss.pc,v 1.2 2012/11/12 20:43:09 landry Exp $ - -prefix=${TRUEPREFIX} -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: NSS -Description: Mozilla Network Security Services -Version: ${VERSION} -Requires: nspr >= 4.6.4 -Libs: -L${libdir} -lnss3 -lsmime3 -lsoftokn3 -lssl3 -Cflags: -I${includedir}/nss diff --git a/security/nss/patches/patch-nss_pkg_pkg-config_nss-config_in b/security/nss/patches/patch-nss_pkg_pkg-config_nss-config_in new file mode 100644 index 00000000000..441986f3a5c --- /dev/null +++ b/security/nss/patches/patch-nss_pkg_pkg-config_nss-config_in @@ -0,0 +1,20 @@ +$OpenBSD: patch-nss_pkg_pkg-config_nss-config_in,v 1.1 2017/11/09 18:45:24 landry Exp $ + +Index: nss/pkg/pkg-config/nss-config.in +--- nss/pkg/pkg-config/nss-config.in.orig ++++ nss/pkg/pkg-config/nss-config.in +@@ -1,10 +1,10 @@ + #!/bin/sh + +-prefix=@prefix@ ++prefix=${TRUEPREFIX} + +-major_version=@MOD_MAJOR_VERSION@ +-minor_version=@MOD_MINOR_VERSION@ +-patch_version=@MOD_PATCH_VERSION@ ++major_version=$(awk '/NSS_VMAJOR/ {print $3}' ${TRUEPREFIX}/include/nss/nss.h) ++minor_version=$(awk '/NSS_VMINOR/ {print $3}' ${TRUEPREFIX}/include/nss/nss.h) ++patch_version=$(awk '/NSS_VPATCH/ {print $3}' ${TRUEPREFIX}/include/nss/nss.h) + + usage() + { diff --git a/security/nss/patches/patch-nss_pkg_pkg-config_nss_pc_in b/security/nss/patches/patch-nss_pkg_pkg-config_nss_pc_in new file mode 100644 index 00000000000..5217a6689c7 --- /dev/null +++ b/security/nss/patches/patch-nss_pkg_pkg-config_nss_pc_in @@ -0,0 +1,23 @@ +$OpenBSD: patch-nss_pkg_pkg-config_nss_pc_in,v 1.1 2017/11/09 18:45:24 landry Exp $ + +Index: nss/pkg/pkg-config/nss.pc.in +--- nss/pkg/pkg-config/nss.pc.in.orig ++++ nss/pkg/pkg-config/nss.pc.in +@@ -1,11 +1,11 @@ +-prefix=%prefix% +-exec_prefix=%exec_prefix% +-libdir=%libdir% +-includedir=%includedir% ++prefix=${TRUEPREFIX} ++exec_prefix=${prefix} ++libdir=${exec_prefix}/lib ++includedir=${prefix}/include/nss + + Name: NSS + Description: Network Security Services +-Version: %NSS_VERSION% +-Requires: nspr >= %NSPR_VERSION% ++Version: ${VERSION} ++Requires: nspr >= ${NSPR_VERSION} + Libs: -L${libdir} -lssl3 -lsmime3 -lnss3 -lnssutil3 + Cflags: -I${includedir}