Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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/COPYING;md5=3b1e88e1b9c0b5a4b2881d46cce06a18 \ |
| 14 | file://nss/lib/freebl/mpi/doc/LICENSE;md5=491f158d09d948466afce85d6f1fe18f \ |
| 15 | file://nss/lib/freebl/mpi/doc/LICENSE-MPL;md5=5d425c8f3157dbf212db2ec53d9e5132" |
| 16 | |
| 17 | SRC_URI = "\ |
| 18 | http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_19_2_RTM/src/${BP}.tar.gz \ |
| 19 | file://nss-fix-support-cross-compiling.patch \ |
| 20 | file://nss-no-rpath-for-cross-compiling.patch \ |
| 21 | file://nss-fix-incorrect-shebang-of-perl.patch \ |
| 22 | file://nss-fix-nsinstall-build.patch \ |
| 23 | file://nss.pc.in \ |
| 24 | file://signlibs.sh \ |
| 25 | " |
| 26 | |
| 27 | SRC_URI[md5sum] = "b02ffd1e8e8ef5f8512fa02d8ca9db3d" |
| 28 | SRC_URI[sha256sum] = "1306663e8f61d8449ad8cbcffab743a604dcd9f6f34232c210847c51dce2c9ae" |
| 29 | |
| 30 | inherit siteinfo |
| 31 | |
| 32 | DEPENDS = "sqlite3 nspr zlib nss-native" |
| 33 | DEPENDS_class-native = "sqlite3-native nspr-native zlib-native" |
| 34 | RDEPENDS_${PN}-smime = "perl" |
| 35 | |
| 36 | TD = "${S}/tentative-dist" |
| 37 | TDS = "${S}/tentative-dist-staging" |
| 38 | |
| 39 | TARGET_CC_ARCH += "${LDFLAGS}" |
| 40 | |
| 41 | do_compile_prepend_class-native() { |
| 42 | export NSPR_INCLUDE_DIR=${STAGING_INCDIR_NATIVE} |
| 43 | export NSPR_LIB_DIR=${STAGING_LIBDIR_NATIVE} |
| 44 | } |
| 45 | |
| 46 | do_compile_prepend_class-nativesdk() { |
| 47 | export LDFLAGS="" |
| 48 | } |
| 49 | |
| 50 | do_compile() { |
| 51 | export CROSS_COMPILE=1 |
| 52 | export NATIVE_CC="gcc" |
| 53 | export BUILD_OPT=1 |
| 54 | |
| 55 | export FREEBL_NO_DEPEND=1 |
| 56 | export FREEBL_LOWHASH=1 |
| 57 | |
| 58 | export LIBDIR=${libdir} |
| 59 | export MOZILLA_CLIENT=1 |
| 60 | export NS_USE_GCC=1 |
| 61 | export NSS_USE_SYSTEM_SQLITE=1 |
| 62 | export NSS_ENABLE_ECC=1 |
| 63 | |
| 64 | export OS_RELEASE=3.4 |
| 65 | export OS_TARGET=Linux |
| 66 | export OS_ARCH=Linux |
| 67 | |
| 68 | if [ "${TARGET_ARCH}" = "powerpc" ]; then |
| 69 | OS_TEST=ppc |
| 70 | elif [ "${TARGET_ARCH}" = "powerpc64" ]; then |
| 71 | OS_TEST=ppc64 |
| 72 | elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then |
| 73 | OS_TEST=mips |
| 74 | else |
| 75 | OS_TEST="${TARGET_ARCH}" |
| 76 | fi |
| 77 | |
| 78 | if [ "${SITEINFO_BITS}" = "64" ]; then |
| 79 | export USE_64=1 |
| 80 | elif [ "${TARGET_ARCH}" = "x86_64" -a "${SITEINFO_BITS}" = "32" ]; then |
| 81 | export USE_X32=1 |
| 82 | fi |
| 83 | |
| 84 | # We can modify CC in the environment, but if we set it via an |
| 85 | # argument to make, nsinstall, a host program, will also build with it! |
| 86 | # |
| 87 | export CC="${CC} -g" |
| 88 | make -C ./nss CCC="${CXX} -g" \ |
| 89 | OS_TEST=${OS_TEST} |
| 90 | } |
| 91 | |
| 92 | |
| 93 | do_install_prepend_class-nativesdk() { |
| 94 | export LDFLAGS="" |
| 95 | } |
| 96 | |
| 97 | do_install() { |
| 98 | export CROSS_COMPILE=1 |
| 99 | export NATIVE_CC="gcc" |
| 100 | export BUILD_OPT=1 |
| 101 | |
| 102 | export FREEBL_NO_DEPEND=1 |
| 103 | |
| 104 | export LIBDIR=${libdir} |
| 105 | export MOZILLA_CLIENT=1 |
| 106 | export NS_USE_GCC=1 |
| 107 | export NSS_USE_SYSTEM_SQLITE=1 |
| 108 | export NSS_ENABLE_ECC=1 |
| 109 | |
| 110 | export OS_RELEASE=3.4 |
| 111 | export OS_TARGET=Linux |
| 112 | export OS_ARCH=Linux |
| 113 | |
| 114 | if [ "${TARGET_ARCH}" = "powerpc" ]; then |
| 115 | OS_TEST=ppc |
| 116 | elif [ "${TARGET_ARCH}" = "powerpc64" ]; then |
| 117 | OS_TEST=ppc64 |
| 118 | elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then |
| 119 | OS_TEST=mips |
| 120 | else |
| 121 | OS_TEST="${TARGET_ARCH}" |
| 122 | fi |
| 123 | if [ "${SITEINFO_BITS}" = "64" ]; then |
| 124 | export USE_64=1 |
| 125 | elif [ "${TARGET_ARCH}" = "x86_64" -a "${SITEINFO_BITS}" = "32" ]; then |
| 126 | export USE_X32=1 |
| 127 | fi |
| 128 | |
| 129 | make -C ./nss \ |
| 130 | CCC="${CXX}" \ |
| 131 | OS_TEST=${OS_TEST} \ |
| 132 | SOURCE_LIB_DIR="${TD}/${libdir}" \ |
| 133 | SOURCE_BIN_DIR="${TD}/${bindir}" \ |
| 134 | install |
| 135 | |
| 136 | install -d ${D}/${libdir}/ |
| 137 | for file in ${S}/dist/*.OBJ/lib/*.so; do |
| 138 | echo "Installing `basename $file`..." |
| 139 | cp $file ${D}/${libdir}/ |
| 140 | done |
| 141 | |
| 142 | for shared_lib in ${TD}/${libdir}/*.so.*; do |
| 143 | if [ -f $shared_lib ]; then |
| 144 | cp $shared_lib ${D}/${libdir} |
| 145 | ln -sf $(basename $shared_lib) ${D}/${libdir}/$(basename $shared_lib .1oe) |
| 146 | fi |
| 147 | done |
| 148 | for shared_lib in ${TD}/${libdir}/*.so; do |
| 149 | if [ -f $shared_lib -a ! -e ${D}/${libdir}/$shared_lib ]; then |
| 150 | cp $shared_lib ${D}/${libdir} |
| 151 | fi |
| 152 | done |
| 153 | |
| 154 | install -d ${D}/${includedir}/nss3 |
| 155 | install -m 644 -t ${D}/${includedir}/nss3 dist/public/nss/* |
| 156 | |
| 157 | install -d ${D}/${bindir} |
| 158 | for binary in ${TD}/${bindir}/*; do |
| 159 | install -m 755 -t ${D}/${bindir} $binary |
| 160 | done |
| 161 | } |
| 162 | |
| 163 | do_install_append() { |
| 164 | # Create empty .chk files for the NSS libraries at build time. They could |
| 165 | # be regenerated at target's boot time. |
| 166 | for file in libsoftokn3.chk libfreebl3.chk libnssdbm3.chk; do |
| 167 | touch ${D}/${libdir}/$file |
| 168 | chmod 755 ${D}/${libdir}/$file |
| 169 | done |
| 170 | install -D -m 755 ${WORKDIR}/signlibs.sh ${D}/${bindir}/signlibs.sh |
| 171 | |
| 172 | install -d ${D}${libdir}/pkgconfig/ |
| 173 | sed 's/%NSS_VERSION%/${PV}/' ${WORKDIR}/nss.pc.in | sed 's/%NSPR_VERSION%/4.9.2/' > ${D}${libdir}/pkgconfig/nss.pc |
| 174 | sed -i s:OEPREFIX:${prefix}:g ${D}${libdir}/pkgconfig/nss.pc |
| 175 | sed -i s:OEEXECPREFIX:${exec_prefix}:g ${D}${libdir}/pkgconfig/nss.pc |
| 176 | sed -i s:OELIBDIR:${libdir}:g ${D}${libdir}/pkgconfig/nss.pc |
| 177 | sed -i s:OEINCDIR:${includedir}/nss3:g ${D}${libdir}/pkgconfig/nss.pc |
| 178 | } |
| 179 | |
| 180 | do_install_append_class-target() { |
| 181 | # Create a blank certificate |
| 182 | mkdir -p ${D}${sysconfdir}/pki/nssdb/ |
| 183 | touch ./empty_password |
| 184 | certutil -N -d ${D}${sysconfdir}/pki/nssdb/ -f ./empty_password |
| 185 | chmod 644 ${D}${sysconfdir}/pki/nssdb/*.db |
| 186 | rm ./empty_password |
| 187 | } |
| 188 | |
| 189 | pkg_postinst_${PN} () { |
| 190 | if [ -n "$D" ]; then |
| 191 | for I in $D/${libdir}/lib*.chk; do |
| 192 | DN=`dirname $I` |
| 193 | BN=`basename $I .chk` |
| 194 | FN=$DN/$BN.so |
| 195 | shlibsign -i $FN |
| 196 | if [ $? -ne 0 ]; then |
| 197 | exit 1 |
| 198 | fi |
| 199 | done |
| 200 | exit 0 |
| 201 | fi |
| 202 | signlibs.sh |
| 203 | } |
| 204 | |
| 205 | PACKAGES =+ "${PN}-smime" |
| 206 | FILES_${PN}-smime = "\ |
| 207 | ${bindir}/smime \ |
| 208 | " |
| 209 | FILES_${PN} = "\ |
| 210 | ${sysconfdir} \ |
| 211 | ${bindir} \ |
| 212 | ${libdir}/lib*.chk \ |
| 213 | ${libdir}/lib*.so \ |
| 214 | " |
| 215 | FILES_${PN}-dev = "\ |
| 216 | ${libdir}/nss \ |
| 217 | ${libdir}/pkgconfig/* \ |
| 218 | ${includedir}/* \ |
| 219 | " |
| 220 | # FILES_${PN}-dbg is populated automatically |
| 221 | |
| 222 | BBCLASSEXTEND = "native nativesdk" |
| 223 | |