From f1d3d052ea467d88ed0563a2449fac7c4972e56a Mon Sep 17 00:00:00 2001 From: Franziskus Kiefer Date: Fri, 9 Jun 2017 19:22:05 +0200 Subject: [PATCH] Bug 1372515 - allow enabling libpkix in gyp builds, r=ttaubert Differential Revision: https://nss-review.dev.mozaws.net/D350 --HG-- extra : rebase_source : 0681eb9be3886a8832d70ffac5f6aa56e48d4a90 extra : histedit_source : ea1472a1175adbf6dc293151ea21776ed3467a23%2C6517c85322d5b1c39faff8290a8e3c46a0437c52 --- build.sh | 1 + cmd/platlibs.gypi | 16 +------------ gtests/freebl_gtest/freebl_gtest.gyp | 1 + gtests/nss_bogo_shim/nss_bogo_shim.gyp | 18 ++------------- gtests/ssl_gtest/ssl_gtest.gyp | 16 +------------ gtests/util_gtest/util_gtest.gyp | 1 + help.txt | 3 ++- lib/libpkix/libpkix.gyp | 31 ++++++++++++++++++++++++++ lib/nss/nss.gyp | 18 +-------------- mach | 10 +++++++-- nss.gyp | 18 ++------------- readme.md | 16 ++++++++++--- 12 files changed, 64 insertions(+), 85 deletions(-) create mode 100644 lib/libpkix/libpkix.gyp diff --git a/build.sh b/build.sh index 0a9ce762ed..2b377dec57 100755 --- a/build.sh +++ b/build.sh @@ -93,6 +93,7 @@ while [ $# -gt 0 ]; do --system-sqlite) gyp_params+=(-Duse_system_sqlite=1) ;; --with-nspr=?*) set_nspr_path "${1#*=}"; no_local_nspr=1 ;; --system-nspr) set_nspr_path "/usr/include/nspr/:"; no_local_nspr=1 ;; + --enable-libpkix) gyp_params+=(-Ddisable_libpkix=0) ;; *) show_help; exit 2 ;; esac shift diff --git a/cmd/platlibs.gypi b/cmd/platlibs.gypi index a945ab20f1..9963bdd336 100644 --- a/cmd/platlibs.gypi +++ b/cmd/platlibs.gypi @@ -33,6 +33,7 @@ '<(DEPTH)/lib/base/base.gyp:nssb', '<(DEPTH)/lib/freebl/freebl.gyp:freebl', '<(DEPTH)/lib/sqlite/sqlite.gyp:sqlite3', + '<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix', ], 'conditions': [ [ 'disable_dbm==0', { @@ -41,21 +42,6 @@ '<(DEPTH)/lib/softoken/legacydb/legacydb.gyp:nssdbm', ], }], - [ 'disable_libpkix==0', { - 'dependencies': [ - '<(DEPTH)/lib/libpkix/pkix/certsel/certsel.gyp:pkixcertsel', - '<(DEPTH)/lib/libpkix/pkix/checker/checker.gyp:pkixchecker', - '<(DEPTH)/lib/libpkix/pkix/params/params.gyp:pkixparams', - '<(DEPTH)/lib/libpkix/pkix/results/results.gyp:pkixresults', - '<(DEPTH)/lib/libpkix/pkix/top/top.gyp:pkixtop', - '<(DEPTH)/lib/libpkix/pkix/util/util.gyp:pkixutil', - '<(DEPTH)/lib/libpkix/pkix/crlsel/crlsel.gyp:pkixcrlsel', - '<(DEPTH)/lib/libpkix/pkix/store/store.gyp:pkixstore', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/pki/pki.gyp:pkixpki', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/system/system.gyp:pkixsystem', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/module/module.gyp:pkixmodule' - ], - }], ]},{ # !use_static_libs 'conditions': [ ['moz_fold_libs==0', { diff --git a/gtests/freebl_gtest/freebl_gtest.gyp b/gtests/freebl_gtest/freebl_gtest.gyp index fa3c9fb2c3..7e11cd1036 100644 --- a/gtests/freebl_gtest/freebl_gtest.gyp +++ b/gtests/freebl_gtest/freebl_gtest.gyp @@ -51,6 +51,7 @@ '<(DEPTH)/lib/dev/dev.gyp:nssdev', '<(DEPTH)/lib/pki/pki.gyp:nsspki', '<(DEPTH)/lib/ssl/ssl.gyp:ssl', + '<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix', ], 'conditions': [ [ 'OS=="win"', { diff --git a/gtests/nss_bogo_shim/nss_bogo_shim.gyp b/gtests/nss_bogo_shim/nss_bogo_shim.gyp index 7f7131125f..b8f71f95f5 100644 --- a/gtests/nss_bogo_shim/nss_bogo_shim.gyp +++ b/gtests/nss_bogo_shim/nss_bogo_shim.gyp @@ -35,7 +35,8 @@ '<(DEPTH)/lib/dev/dev.gyp:nssdev', '<(DEPTH)/lib/base/base.gyp:nssb', '<(DEPTH)/lib/freebl/freebl.gyp:freebl', - '<(DEPTH)/lib/zlib/zlib.gyp:nss_zlib' + '<(DEPTH)/lib/zlib/zlib.gyp:nss_zlib', + '<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix', ], 'conditions': [ [ 'disable_dbm==0', { @@ -43,21 +44,6 @@ '<(DEPTH)/lib/dbm/src/src.gyp:dbm', ], }], - [ 'disable_libpkix==0', { - 'dependencies': [ - '<(DEPTH)/lib/libpkix/pkix/certsel/certsel.gyp:pkixcertsel', - '<(DEPTH)/lib/libpkix/pkix/checker/checker.gyp:pkixchecker', - '<(DEPTH)/lib/libpkix/pkix/crlsel/crlsel.gyp:pkixcrlsel', - '<(DEPTH)/lib/libpkix/pkix/params/params.gyp:pkixparams', - '<(DEPTH)/lib/libpkix/pkix/results/results.gyp:pkixresults', - '<(DEPTH)/lib/libpkix/pkix/store/store.gyp:pkixstore', - '<(DEPTH)/lib/libpkix/pkix/top/top.gyp:pkixtop', - '<(DEPTH)/lib/libpkix/pkix/util/util.gyp:pkixutil', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/system/system.gyp:pkixsystem', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/module/module.gyp:pkixmodule', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/pki/pki.gyp:pkixpki', - ], - }], ], } ], diff --git a/gtests/ssl_gtest/ssl_gtest.gyp b/gtests/ssl_gtest/ssl_gtest.gyp index 5dbe4cba5d..8cd7d10096 100644 --- a/gtests/ssl_gtest/ssl_gtest.gyp +++ b/gtests/ssl_gtest/ssl_gtest.gyp @@ -62,6 +62,7 @@ '<(DEPTH)/lib/base/base.gyp:nssb', '<(DEPTH)/lib/zlib/zlib.gyp:nss_zlib', '<(DEPTH)/cpputil/cpputil.gyp:cpputil', + '<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix', ], 'conditions': [ [ 'test_build==1', { @@ -81,21 +82,6 @@ '<(DEPTH)/lib/dbm/src/src.gyp:dbm', ], }], - [ 'disable_libpkix==0', { - 'dependencies': [ - '<(DEPTH)/lib/libpkix/pkix/certsel/certsel.gyp:pkixcertsel', - '<(DEPTH)/lib/libpkix/pkix/checker/checker.gyp:pkixchecker', - '<(DEPTH)/lib/libpkix/pkix/crlsel/crlsel.gyp:pkixcrlsel', - '<(DEPTH)/lib/libpkix/pkix/params/params.gyp:pkixparams', - '<(DEPTH)/lib/libpkix/pkix/results/results.gyp:pkixresults', - '<(DEPTH)/lib/libpkix/pkix/store/store.gyp:pkixstore', - '<(DEPTH)/lib/libpkix/pkix/top/top.gyp:pkixtop', - '<(DEPTH)/lib/libpkix/pkix/util/util.gyp:pkixutil', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/system/system.gyp:pkixsystem', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/module/module.gyp:pkixmodule', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/pki/pki.gyp:pkixpki', - ], - }], ], } ], diff --git a/gtests/util_gtest/util_gtest.gyp b/gtests/util_gtest/util_gtest.gyp index d0ea99e5d2..7abd71b2f6 100644 --- a/gtests/util_gtest/util_gtest.gyp +++ b/gtests/util_gtest/util_gtest.gyp @@ -29,6 +29,7 @@ '<(DEPTH)/lib/dev/dev.gyp:nssdev', '<(DEPTH)/lib/pki/pki.gyp:nsspki', '<(DEPTH)/lib/ssl/ssl.gyp:ssl', + '<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix', ], 'conditions': [ [ 'OS=="win"', { diff --git a/help.txt b/help.txt index ba41f94ac3..30ebef6b19 100644 --- a/help.txt +++ b/help.txt @@ -2,7 +2,7 @@ Usage: build.sh [-hcv] [-j ] [--nspr] [--gyp|-g] [--opt|-o] [-m32] [--test] [--pprof] [--scan-build[=output]] [--ct-verif] [--asan] [--ubsan] [--msan] [--sancov[=edge|bb|func|...]] [--disable-tests] [--fuzz[=tls|oss]] [--system-sqlite] - [--no-zdefs] [--with-nspr] [--system-nspr] + [--no-zdefs] [--with-nspr] [--system-nspr] [--enable-libpkix] This script builds NSS with gyp and ninja. @@ -40,3 +40,4 @@ NSS build tool options: --with-nspr=/path/to/nspr/include:/path/to/nspr/lib --system-nspr use system nspr. This requires an installation of NSPR and might not work on all systems. + --enable-libpkix make libpkix part of the build. diff --git a/lib/libpkix/libpkix.gyp b/lib/libpkix/libpkix.gyp new file mode 100644 index 0000000000..ec6e006179 --- /dev/null +++ b/lib/libpkix/libpkix.gyp @@ -0,0 +1,31 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +{ + 'includes': [ + '../../coreconf/config.gypi' + ], + 'targets': [ + { + 'target_name': 'libpkix', + 'type': 'none', + 'conditions': [ + [ 'disable_libpkix==0', { + 'dependencies': [ + 'pkix/certsel/certsel.gyp:pkixcertsel', + 'pkix/checker/checker.gyp:pkixchecker', + 'pkix/crlsel/crlsel.gyp:pkixcrlsel', + 'pkix/params/params.gyp:pkixparams', + 'pkix/results/results.gyp:pkixresults', + 'pkix/store/store.gyp:pkixstore', + 'pkix/top/top.gyp:pkixtop', + 'pkix/util/util.gyp:pkixutil', + 'pkix_pl_nss/module/module.gyp:pkixmodule', + 'pkix_pl_nss/pki/pki.gyp:pkixpki', + 'pkix_pl_nss/system/system.gyp:pkixsystem', + ], + }], + ], + }, + ], +} \ No newline at end of file diff --git a/lib/nss/nss.gyp b/lib/nss/nss.gyp index 56984d9f14..8f4415701b 100644 --- a/lib/nss/nss.gyp +++ b/lib/nss/nss.gyp @@ -33,24 +33,8 @@ '<(DEPTH)/lib/pki/pki.gyp:nsspki', '<(DEPTH)/lib/dev/dev.gyp:nssdev', '<(DEPTH)/lib/base/base.gyp:nssb', + '<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix', ], - 'conditions': [ - [ 'disable_libpkix==0', { - 'dependencies': [ - '<(DEPTH)/lib/libpkix/pkix/certsel/certsel.gyp:pkixcertsel', - '<(DEPTH)/lib/libpkix/pkix/checker/checker.gyp:pkixchecker', - '<(DEPTH)/lib/libpkix/pkix/params/params.gyp:pkixparams', - '<(DEPTH)/lib/libpkix/pkix/results/results.gyp:pkixresults', - '<(DEPTH)/lib/libpkix/pkix/top/top.gyp:pkixtop', - '<(DEPTH)/lib/libpkix/pkix/util/util.gyp:pkixutil', - '<(DEPTH)/lib/libpkix/pkix/crlsel/crlsel.gyp:pkixcrlsel', - '<(DEPTH)/lib/libpkix/pkix/store/store.gyp:pkixstore', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/pki/pki.gyp:pkixpki', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/system/system.gyp:pkixsystem', - '<(DEPTH)/lib/libpkix/pkix_pl_nss/module/module.gyp:pkixmodule' - ], - }], - ], }, { 'target_name': 'nss3', diff --git a/mach b/mach index efd7c0d0dd..16e6dcab02 100755 --- a/mach +++ b/mach @@ -100,7 +100,13 @@ class testAction(argparse.Action): def runTest(self, test, cycles="standard"): cwd = os.path.dirname(os.path.abspath(__file__)) domsuf = os.getenv('DOMSUF', "localdomain") - env = {"NSS_TESTS": test, "NSS_CYCLES": cycles, "DOMSUF": domsuf} + host = os.getenv('HOST', "localhost") + env = { + "NSS_TESTS": test, + "NSS_CYCLES": cycles, + "DOMSUF": domsuf, + "HOST": host + } command = cwd + "/tests/all.sh" subprocess.check_call(command, env=env) @@ -131,7 +137,7 @@ def parse_arguments(): parser_test = subparsers.add_parser( 'tests', help='Run tests through tests/all.sh.') tests = [ - "cipher", "lowhash", "libpkix", "cert", "dbtests", "tools", "fips", + "cipher", "lowhash", "chains", "cert", "dbtests", "tools", "fips", "sdr", "crmf", "smime", "ssl", "ocsp", "merge", "pkits", "ec", "gtests", "ssl_gtests" ] diff --git a/nss.gyp b/nss.gyp index 97586b3337..e62d28449d 100644 --- a/nss.gyp +++ b/nss.gyp @@ -59,7 +59,8 @@ 'lib/smime/smime.gyp:smime', 'lib/softoken/softoken.gyp:softokn', 'lib/ssl/ssl.gyp:ssl', - 'lib/util/util.gyp:nssutil' + 'lib/util/util.gyp:nssutil', + 'lib/libpkix/libpkix.gyp:libpkix', ], 'conditions': [ [ 'OS=="linux"', { @@ -73,21 +74,6 @@ 'lib/softoken/legacydb/legacydb.gyp:nssdbm', ], }], - [ 'disable_libpkix==0', { - 'dependencies': [ - 'lib/libpkix/pkix/certsel/certsel.gyp:pkixcertsel', - 'lib/libpkix/pkix/checker/checker.gyp:pkixchecker', - 'lib/libpkix/pkix/crlsel/crlsel.gyp:pkixcrlsel', - 'lib/libpkix/pkix/params/params.gyp:pkixparams', - 'lib/libpkix/pkix/results/results.gyp:pkixresults', - 'lib/libpkix/pkix/store/store.gyp:pkixstore', - 'lib/libpkix/pkix/top/top.gyp:pkixtop', - 'lib/libpkix/pkix/util/util.gyp:pkixutil', - 'lib/libpkix/pkix_pl_nss/module/module.gyp:pkixmodule', - 'lib/libpkix/pkix_pl_nss/pki/pki.gyp:pkixpki', - 'lib/libpkix/pkix_pl_nss/system/system.gyp:pkixsystem', - ], - }], [ 'use_system_sqlite==0', { 'dependencies': [ 'lib/sqlite/sqlite.gyp:sqlite', diff --git a/readme.md b/readme.md index 8ffb64ec84..b75bfe7dd2 100644 --- a/readme.md +++ b/readme.md @@ -42,9 +42,10 @@ your system environment to use the libraries of your build from the "lib" directory, e.g., using the `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH`. Usage: build.sh [-hcv] [-j ] [--nspr] [--gyp|-g] [--opt|-o] [-m32] - [--test] [--fuzz] [--pprof] [--scan-build[=output]] + [--test] [--pprof] [--scan-build[=output]] [--ct-verif] [--asan] [--ubsan] [--msan] [--sancov[=edge|bb|func|...]] - [--ct-verif] [--disable-tests] + [--disable-tests] [--fuzz[=tls|oss]] [--system-sqlite] + [--no-zdefs] [--with-nspr] [--system-nspr] [--enable-libpkix] This script builds NSS with gyp and ninja. @@ -62,7 +63,9 @@ directory, e.g., using the `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH`. --opt|-o do an opt build -m32 do a 32-bit build on a 64-bit system --test ignore map files and export everything we have - --fuzz enable fuzzing mode. this always enables test builds + --fuzz build fuzzing targets (this always enables test builds) + --fuzz=tls to enable TLS fuzzing mode + --fuzz=oss to build for OSS-Fuzz --pprof build with gperftool support --ct-verif build with valgrind for ct-verif --scan-build run the build with scan-build (scan-build has to be in the path) @@ -74,6 +77,13 @@ directory, e.g., using the `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH`. --sancov do sanitize coverage builds --sancov=func sets coverage to function level for example --disable-tests don't build tests and corresponding cmdline utils + --system-sqlite use system sqlite + --no-zdefs don't set -Wl,-z,defs + --with-nspr don't build NSPR but use the one at the given location, e.g. + --with-nspr=/path/to/nspr/include:/path/to/nspr/lib + --system-nspr use system nspr. This requires an installation of NSPR and + might not work on all systems. + --enable-libpkix make libpkix part of the build. ## Building NSS (legacy build system)