NSS:NewHGLayout

Revision as of 15:19, 27 February 2013 by Kaie (talk | contribs)

Hints around building, testing and using the new NSS code layout, which involves separate HG (Mercurial) repositories for NSPR and NSS.

For general information about HG see: NSS:UsingHG

One-time preparation

Create a file in your home directory, named .hgrc with the follwing contents, in order to set your preferred 3-way merge tool, your name and email, your preferred diff options, the style of diff/patch output, and to enable to mq and rebase extensions:

[ui]
merge = kdiff3
username = YOURNAME <YOUREMAIL>
[defaults]
diff=-U 8 -p
qdiff=-U 8
[diff]
git = 1
nodates = 1
showfunc=true
[merge-tools]
kdiff3.args = $base $local $other -o $output
[extensions]
hgext.mq =
rebase =


Checkout

Prepare a new directory, which will be the common parent directory for multiple trees. Then use multiple commands for the initial checkout code.

mkdir workarea
cd workarea
hg clone https://hg.mozilla.org/projects/nspr
hg clone https://hg.mozilla.org/projects/nss
# optional: get jss
hg clone https://hg.mozilla.org/projects/jss


Building

In order to build both NSPR and NSS in one step, set the usual environment variables, e.g. BUILD_OPT to empty or 1, USE_64 to empty or 1, OS_TARGET to empty or WIN95, etc. (If you're building JSS (java) also set JAVA_HOME.)

Run:

cd workarea/nss
make nss_build_all
# optional: jss
cd workarea/jss
make


Output files

During build, the object files created by the compiler will be created inside the nspr and nss directories. (We use a .hgignore file in each repository to tell hg to ignore them, so that hg commands like "hg stat" will not show them.)

The distribution files and the tests_results files will be created one level above the nspr/nss repositories, inside the workarea:

ls workarea/dist
ls workarea/tests_results

(At a later time, we could change the buildsystem to create all output files outside of the nspr/nss directories, too. However, given that we can use .hgignore, that's not a high priority.)

Testing

Ensure you still have the environment variables used during the build. If necessary, set the HOST and DOMSUF variables and run:

cd workarea/nss/tests
./all.sh
# optional: jss
cd workarea/jss
export PLATFORM=`make platform`
export DISTDIR=`pwd`/../dist
cd org/mozilla/jss/tests
perl all.pl dist $DISTDIR/$PLATFORM


Updating your local code

Playground

If you'd like to use a playground for experimental and learning purposes:

mkdir playground
cd playground
hg clone http://nss-crypto.org/hg/nspr-playground/ nspr
hg clone http://nss-crypto.org/hg/nss-playground/ nss

Contact kaie if you would like write access.