Skip to content
An intelligent source code browser
Pull request Compare This branch is 2355 commits behind mozilla:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
templates
viewsource
www
xref-scripts
.hgignore
LICENSE
Makefile
README
build-tools.sh
dxr.config
xpidl.patch

README

DXR
---

Introduction:
-------------

DXR is a source code cross-reference tool that uses static analysis data collected by Dehydra (https://developer.mozilla.org/en/Dehydra).  DXR was created in order to build on tools like LXR and MXR.  DXR only runs on Linux for the moment, and is heavily customized for the Mozilla project's source code.


Setup:
------

DXR is primarily a database of source code information.  You need a lot of
space to do this, and a fast computer helps a lot.

1) In order to build the database you need a working Mozilla and Dehydra build environemnt.  If you have this already, take note of the paths for your g++ and dehydra plugin, so you can alter paths in the scripts.  If you do not have one, you can follow the instructions here:

* Mozilla Build Environment for Linux (https://developer.mozilla.org/en/Linux_Build_Prerequisites)
* Dehydra Build Environment for Linux (https://developer.mozilla.org/En/Dehydra/Installing_Dehydra)

Note that Dehydra is only supported for gcc-4.5; any earlier version of gcc uses
a different plugin architecture, which is not supported.

If you are using a Fedora-like Linux, you can also do the following to have an environment setup locally:

./build-tools.sh

NOTE: this will not alter your system in any way, or replace any default tools.  It builds everything in a ./tools directory.  See build-tools.sh for necessary build dependencies.

You also need to make sure that you have python and python-sqlite installed on
your computer, as well as sqlite3

2) DXR uses config info from an INI style config file. Alter the variables in
dxrsrc/www/dxr.config for your environment.

3) For the moment you also need to alter dxrsrc/xref-scripts/dxr.js (i.e., the dehydra script) to point to your srcdir:

// NOTE the trailing slash
var srcroot = "/home/dave/dxr/mozilla-central/";

4) Create the wwwdir (e.g., /var/www/html/dxr) you specified in your dxr.config

5) Copy (or symlink) the contents of dxrsrc/www to your web dir. You also need
to copy (or symlink) the xref-scripts directory.

6) Configure and build your program. Note that you need to have:
CXXFLAGS="-fplugin=/path/to/gcc_dehyra.so -fplugin-arg-gcc_dehydra-script=/path/to/dxrsrc/xref-scripts/dxr.js"
CFLAGS="-fplugin=/path/to/gcc_dehyra.so -fplugin-arg-gcc_dehydra-script=/path/to/dxrsrc/xref-scripts/dxr.js"

7) Run the cross-reference generator:
dxrsrc/xref-scripts/run-dxr.py -f /path/to/web/dir/dxr.config

8) Download and install (or at least build somewhere the web app can access) Glimpse:

http://webglimpse.net/trial/glimpse-latest.tar.gz

9) You can optionally install sqlite 3 if it is not already installed on your system.  You don't strictly need it, but it makes accessing the database manually eaiser.

Running:
-------

You can build your source, create the xref database, and create the static HTML content as follows:

dxrsrc/xref-scripts/run-dxr.py -f /path/to/web/dir/dxr.config

This will post-process the data into dxr.sqlite.  It will also build the static
html and create a glimpse full-text search index.  All these files will be
created in the wwwdir using the name of the tree you provided in dxr.config
(e.g., mozilla-central).  You will end up with the following structure:

/var/www/html/dxr (or whereever your wwwdir is located)
		 /index.html (auto-generated during run-dxr.py)
                 /mozilla-central (symnlink to mozilla-central-current)
                 /mozilla-central-current
		                         /.dxr_xref
                                                   /mozilla-central.sqlite
                                                   /.glimpse*  (glimpse index files)
                                         /accessible (and all other source files copied from your src dir)
Something went wrong with that request. Please try again.