diff options
Diffstat (limited to 'meta/recipes-support/nss/nss.inc')
| -rw-r--r-- | meta/recipes-support/nss/nss.inc | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/meta/recipes-support/nss/nss.inc b/meta/recipes-support/nss/nss.inc new file mode 100644 index 0000000000..008bdad5c7 --- /dev/null +++ b/meta/recipes-support/nss/nss.inc | |||
| @@ -0,0 +1,215 @@ | |||
| 1 | SUMMARY = "Mozilla's SSL and TLS implementation" | ||
| 2 | DESCRIPTION = "Network Security Services (NSS) is a set of libraries \ | ||
| 3 | designed to support cross-platform development of \ | ||
| 4 | security-enabled client and server applications. \ | ||
| 5 | Applications built with NSS can support SSL v2 and v3, \ | ||
| 6 | TLS, PKCS 5, PKCS 7, PKCS 11, PKCS 12, S/MIME, X.509 \ | ||
| 7 | v3 certificates, and other security standards." | ||
| 8 | HOMEPAGE = "http://www.mozilla.org/projects/security/pki/nss/" | ||
| 9 | SECTION = "libs" | ||
| 10 | |||
| 11 | LICENSE = "MPL-2.0 | (MPL-2.0 & GPL-2.0+) | (MPL-2.0 & LGPL-2.1+)" | ||
| 12 | |||
| 13 | LIC_FILES_CHKSUM = "file://nss/lib/freebl/mpi/doc/LICENSE;md5=491f158d09d948466afce85d6f1fe18f \ | ||
| 14 | file://nss/lib/freebl/mpi/doc/LICENSE-MPL;md5=6bf96825e3d7ce4de25621ae886cc859" | ||
| 15 | SRC_URI = "\ | ||
| 16 | file://nss-fix-support-cross-compiling.patch \ | ||
| 17 | file://nss-no-rpath-for-cross-compiling.patch \ | ||
| 18 | file://nss-fix-incorrect-shebang-of-perl.patch \ | ||
| 19 | file://nss-3.15.1-fix-CVE-2013-1741.patch \ | ||
| 20 | file://nss-3.15.1-fix-CVE-2013-5605.patch \ | ||
| 21 | file://nss-CVE-2014-1492.patch \ | ||
| 22 | file://nss-CVE-2013-1740.patch \ | ||
| 23 | file://nss-3.15.1-fix-CVE-2013-1739.patch \ | ||
| 24 | file://nss-CVE-2013-5606.patch \ | ||
| 25 | file://nss-CVE-2014-1544.patch \ | ||
| 26 | file://nss-CVE-2014-1568.patch \ | ||
| 27 | " | ||
| 28 | SRC_URI_append = "\ | ||
| 29 | file://nss.pc.in \ | ||
| 30 | file://signlibs.sh \ | ||
| 31 | " | ||
| 32 | inherit siteinfo | ||
| 33 | PR = "r0" | ||
| 34 | DEPENDS = "sqlite3 nspr zlib nss-native" | ||
| 35 | DEPENDS_class-native = "sqlite3-native nspr-native zlib-native" | ||
| 36 | RDEPENDS_${PN} = "perl" | ||
| 37 | |||
| 38 | TD = "${S}/tentative-dist" | ||
| 39 | TDS = "${S}/tentative-dist-staging" | ||
| 40 | |||
| 41 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
| 42 | |||
| 43 | do_compile_prepend_class-native() { | ||
| 44 | export NSPR_INCLUDE_DIR=${STAGING_INCDIR_NATIVE} | ||
| 45 | export NSPR_LIB_DIR=${STAGING_LIBDIR_NATIVE} | ||
| 46 | } | ||
| 47 | |||
| 48 | do_compile_prepend_class-nativesdk() { | ||
| 49 | export LDFLAGS="" | ||
| 50 | } | ||
| 51 | |||
| 52 | do_compile() { | ||
| 53 | export CROSS_COMPILE=1 | ||
| 54 | export NATIVE_CC="gcc" | ||
| 55 | export BUILD_OPT=1 | ||
| 56 | |||
| 57 | export FREEBL_NO_DEPEND=1 | ||
| 58 | export FREEBL_LOWHASH=1 | ||
| 59 | |||
| 60 | export LIBDIR=${libdir} | ||
| 61 | export MOZILLA_CLIENT=1 | ||
| 62 | export NS_USE_GCC=1 | ||
| 63 | export NSS_USE_SYSTEM_SQLITE=1 | ||
| 64 | export NSS_ENABLE_ECC=1 | ||
| 65 | |||
| 66 | export OS_RELEASE=3.4 | ||
| 67 | export OS_TARGET=Linux | ||
| 68 | export OS_ARCH=Linux | ||
| 69 | |||
| 70 | if [ "${TARGET_ARCH}" = "powerpc" ]; then | ||
| 71 | OS_TEST=ppc | ||
| 72 | elif [ "${TARGET_ARCH}" = "powerpc64" ]; then | ||
| 73 | OS_TEST=ppc64 | ||
| 74 | elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then | ||
| 75 | OS_TEST=mips | ||
| 76 | else | ||
| 77 | OS_TEST="${TARGET_ARCH}" | ||
| 78 | fi | ||
| 79 | |||
| 80 | if [ "${SITEINFO_BITS}" = "64" ]; then | ||
| 81 | export USE_64=1 | ||
| 82 | fi | ||
| 83 | |||
| 84 | make -C ./nss CCC="${CXX}" \ | ||
| 85 | OS_TEST=${OS_TEST} \ | ||
| 86 | } | ||
| 87 | |||
| 88 | |||
| 89 | do_install_prepend_class-nativesdk() { | ||
| 90 | export LDFLAGS="" | ||
| 91 | } | ||
| 92 | |||
| 93 | do_install() { | ||
| 94 | export CROSS_COMPILE=1 | ||
| 95 | export NATIVE_CC="gcc" | ||
| 96 | export BUILD_OPT=1 | ||
| 97 | |||
| 98 | export FREEBL_NO_DEPEND=1 | ||
| 99 | |||
| 100 | export LIBDIR=${libdir} | ||
| 101 | export MOZILLA_CLIENT=1 | ||
| 102 | export NS_USE_GCC=1 | ||
| 103 | export NSS_USE_SYSTEM_SQLITE=1 | ||
| 104 | export NSS_ENABLE_ECC=1 | ||
| 105 | |||
| 106 | export OS_RELEASE=3.4 | ||
| 107 | export OS_TARGET=Linux | ||
| 108 | export OS_ARCH=Linux | ||
| 109 | |||
| 110 | if [ "${TARGET_ARCH}" = "powerpc" ]; then | ||
| 111 | OS_TEST=ppc | ||
| 112 | elif [ "${TARGET_ARCH}" = "powerpc64" ]; then | ||
| 113 | OS_TEST=ppc64 | ||
| 114 | elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then | ||
| 115 | OS_TEST=mips | ||
| 116 | else | ||
| 117 | OS_TEST="${TARGET_ARCH}" | ||
| 118 | fi | ||
| 119 | if [ "${SITEINFO_BITS}" = "64" ]; then | ||
| 120 | export USE_64=1 | ||
| 121 | fi | ||
| 122 | |||
| 123 | make -C ./nss \ | ||
| 124 | CCC="${CXX}" \ | ||
| 125 | OS_TEST=${OS_TEST} \ | ||
| 126 | SOURCE_LIB_DIR="${TD}/${libdir}" \ | ||
| 127 | SOURCE_BIN_DIR="${TD}/${bindir}" \ | ||
| 128 | install | ||
| 129 | |||
| 130 | install -d ${D}/${libdir}/ | ||
| 131 | for file in ${S}/dist/*.OBJ/lib/*.so; do | ||
| 132 | echo "Installing `basename $file`..." | ||
| 133 | cp $file ${D}/${libdir}/ | ||
| 134 | done | ||
| 135 | |||
| 136 | for shared_lib in ${TD}/${libdir}/*.so.*; do | ||
| 137 | if [ -f $shared_lib ]; then | ||
| 138 | cp $shared_lib ${D}/${libdir} | ||
| 139 | ln -sf $(basename $shared_lib) ${D}/${libdir}/$(basename $shared_lib .1oe) | ||
| 140 | fi | ||
| 141 | done | ||
| 142 | for shared_lib in ${TD}/${libdir}/*.so; do | ||
| 143 | if [ -f $shared_lib -a ! -e ${D}/${libdir}/$shared_lib ]; then | ||
| 144 | cp $shared_lib ${D}/${libdir} | ||
| 145 | fi | ||
| 146 | done | ||
| 147 | |||
| 148 | install -d ${D}/${includedir}/nss3 | ||
| 149 | install -m 644 -t ${D}/${includedir}/nss3 dist/public/nss/* | ||
| 150 | |||
| 151 | install -d ${D}/${bindir} | ||
| 152 | for binary in ${TD}/${bindir}/*; do | ||
| 153 | install -m 755 -t ${D}/${bindir} $binary | ||
| 154 | done | ||
| 155 | } | ||
| 156 | |||
| 157 | do_install_append() { | ||
| 158 | # Create empty .chk files for the NSS libraries at build time. They could | ||
| 159 | # be regenerated at target's boot time. | ||
| 160 | for file in libsoftokn3.chk libfreebl3.chk libnssdbm3.chk; do | ||
| 161 | touch ${D}/${libdir}/$file | ||
| 162 | chmod 755 ${D}/${libdir}/$file | ||
| 163 | done | ||
| 164 | install -D -m 755 ${WORKDIR}/signlibs.sh ${D}/${bindir}/signlibs.sh | ||
| 165 | |||
| 166 | install -d ${D}${libdir}/pkgconfig/ | ||
| 167 | sed 's/%NSS_VERSION%/${PV}/' ${WORKDIR}/nss.pc.in | sed 's/%NSPR_VERSION%/4.9.2/' > ${D}${libdir}/pkgconfig/nss.pc | ||
| 168 | sed -i s:OEPREFIX:${prefix}:g ${D}${libdir}/pkgconfig/nss.pc | ||
| 169 | sed -i s:OEEXECPREFIX:${exec_prefix}:g ${D}${libdir}/pkgconfig/nss.pc | ||
| 170 | sed -i s:OELIBDIR:${libdir}:g ${D}${libdir}/pkgconfig/nss.pc | ||
| 171 | sed -i s:OEINCDIR:${includedir}/nss3:g ${D}${libdir}/pkgconfig/nss.pc | ||
| 172 | } | ||
| 173 | |||
| 174 | do_install_append_class-target() { | ||
| 175 | # Create a blank certificate | ||
| 176 | mkdir -p ${D}${sysconfdir}/pki/nssdb/ | ||
| 177 | touch ./empty_password | ||
| 178 | certutil -N -d ${D}${sysconfdir}/pki/nssdb/ -f ./empty_password | ||
| 179 | chmod 644 ${D}${sysconfdir}/pki/nssdb/*.db | ||
| 180 | rm ./empty_password | ||
| 181 | } | ||
| 182 | |||
| 183 | pkg_postinst_${PN} () { | ||
| 184 | if [ -n "$D" ]; then | ||
| 185 | for I in $D/${libdir}/lib*.chk; do | ||
| 186 | DN=`dirname $I` | ||
| 187 | BN=`basename $I .chk` | ||
| 188 | FN=$DN/$BN.so | ||
| 189 | shlibsign -i $FN | ||
| 190 | if [ $? -ne 0 ]; then | ||
| 191 | exit 1 | ||
| 192 | fi | ||
| 193 | done | ||
| 194 | exit 0 | ||
| 195 | fi | ||
| 196 | signlibs.sh | ||
| 197 | } | ||
| 198 | |||
| 199 | FILES_${PN} = "\ | ||
| 200 | ${sysconfdir} \ | ||
| 201 | ${bindir} \ | ||
| 202 | ${libdir}/lib*.chk \ | ||
| 203 | ${libdir}/lib*.so \ | ||
| 204 | " | ||
| 205 | FILES_${PN}-dev = "\ | ||
| 206 | ${libdir}/nss \ | ||
| 207 | ${libdir}/pkgconfig/* \ | ||
| 208 | ${includedir}/* \ | ||
| 209 | " | ||
| 210 | FILES_${PN}-dbg = "\ | ||
| 211 | ${bindir}/.debug/* \ | ||
| 212 | ${libdir}/.debug/* \ | ||
| 213 | " | ||
| 214 | |||
| 215 | BBCLASSEXTEND = "native nativesdk" | ||
