Skip to content

Building NSS

Endi S. Dewata edited this page Dec 23, 2022 · 4 revisions

Overview

NSS source code is stored Mercurial repository at https://hg.mozilla.org/projects/nss.

A Git mirror is available at https://github.com/nss-dev/nss.

Prerequisites

$ dnf install mercurial git-remote-hg
$ dnf install nss-softokn-devel nss-util-devel sqlite-devel xmlto
$ dnf install clang

Getting Source Code

Create a sandbox folder:

$ mkdir sandbox
$ cd sandbox

To checkout NSS source:

$ hg clone https://hg.mozilla.org/projects/nss

or

$ git clone hg::https://hg.mozilla.org/projects/nss

or

$ git clone https://github.com/nss-dev/nss.git

Build Variables

build.sh:

OS_TARGET=`uname -s`
OS_RELEASE=`uname -r | sed 's/-.*//' | sed 's/-.*//' | cut -d . -f1,2`
CPU_TAG=_`uname -m`

OBJDIR_NAME_COMPILER=_cc
LIBC_TAG=_glibc
IMPL_STRATEGY=_PTH
if [ "${RUN_BITS}" = "64" ]; then
    OBJDIR_TAG=_${RUN_BITS}_${RUN_OPT}.OBJ
else
    OBJDIR_TAG=_${RUN_OPT}.OBJ
fi

NSS_OBJDIR_NAME=${OS_TARGET}${OS_RELEASE}${CPU_TAG}${OBJDIR_NAME_COMPILER}
NSS_OBJDIR_NAME=${NSS_OBJDIR_NAME}${LIBC_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}

arch.mk:

ifdef CROSS_COMPILE
    OBJDIR_NAME_COMPILER =
else
    OBJDIR_NAME_COMPILER = $(COMPILER_TAG)
endif
OBJDIR_NAME_BASE = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(OBJDIR_NAME_COMPILER)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG)
OBJDIR_NAME = $(OBJDIR_NAME_BASE).OBJ

Building NSS

To create normal NSPR and NSS build, go to the nss folder and execute the following:

$ USE_64=1 make nss_build_all

It will build the binaries in ../dist folder.

To clean the system:

$ USE_64=1 make nss_clean_all

Testing NSS

To run all tests:

$ cd tests
$ ./all.sh

To run specific tests:

$ cd tests/ssl_gtests
$ ./ssl_gtests.sh