INSTALL 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. This INSTALL file is customized for the version of MXR used by
  2. mozilla.org. MXR is derived from LXR, the original LXR can be
  3. found at:
  4. http://lxr.linux.no/
  5. In order to install MXR, you will need:
  6. - Perl version 5 or later.
  7. - A webserver with cgi-script capabilities.
  8. and optionally, to enable the freetext search queries:
  9. - Glimpse
  10. If you don't have Perl installed, get it from
  11. <URL:http://www.perl.com/perl/info/software.html>.
  12. If you need a webserver, take a look at Apache at
  13. <URL:http://www.apache.org/>
  14. If you want Glimpse and the freetext searching facilities, visit
  15. <URL:http://glimpse.cs.arizona.edu/>.
  16. MXR works on GNU/Linux and Solaris with Apache and NES.
  17. Other unix-like operating systems and decently
  18. featured webservers should work as well.
  19. To install MXR itself:
  20. - Retrieve the mxr source with hg from hg.mozilla.org:
  21. hg clone http://hg.mozilla.org/webtools/mxr
  22. - Edit lxr.conf to fit your source code installations and needs.
  23. - Make sure the files in http can be reached via your webserver.
  24. Make sure your webserver executes the files search, source, ident
  25. and diff as cgi-scripts. With the Apache webserver this can be
  26. accomplished by making .htaccess contain the following lines:
  27. <Files ~ (search|source|ident|diff)$>
  28. SetHandler cgi-script
  29. </Files>
  30. You may also need to edit these Apache config files appropriately
  31. srm.conf
  32. AddHandler cgi-script .cgi
  33. access.conf
  34. Options <whatever> # setting to all will work
  35. AllowOverride Options
  36. Its also recommended to set up a robots.txt file on your server to
  37. discourage robots from traversing your source tree and performing
  38. an identifier lookup for each identifier in your code. This will
  39. take up a lot of cpu time and probably several gigabytes of files.
  40. - Generate the identifier database. Go to the directory you
  41. configured as "dbdir" in lxr.conf and do "genxref foo", where foo
  42. is the subdirectory containing the actual source code.
  43. - (Optional) Generate the Glimpse database. Go to the directory you
  44. configured as "dbdir" in lxr.conf and do "glimpseindex -H . foo",
  45. where foo is the same as above. You might want to add other options
  46. to the commandline (e.g. "-n"), see the Glimpse documentation for details.
  47. If it doesn't work:
  48. - Make sure all the permissions are right. Remember that the
  49. webserver needs to be able to access most of them.
  50. - Check that all the Perl scripts find their library files, also when
  51. executed by the webserver.
  52. Multiple Trees
  53. There are two ways to configure MXR to index multiple trees.
  54. The first way relies on configuring virtual host/alias support in
  55. your web server. This turns out to be fairly painful for dynamic
  56. systems where you're likely to add trees to MXR frequently and
  57. your web admin does not like making frequent changes to the web
  58. server's configuration.
  59. Virtual Host based configuration for Multiple Trees
  60. This requires a web server (such as apache) that supports virtual
  61. hosts and/or aliases. At mozilla.org, we had set the document root
  62. of lxr.mozilla.org to the lxr/root directory and for each tree,
  63. and set up an alias with the tree name pointing to the main mxr
  64. directory.
  65. From our httpd.conf:
  66. <VirtualHost 207.200.73.38:80>
  67. DocumentRoot /opt/webtools/lxr.mozilla.org/root
  68. ServerName lxr.mozilla.org
  69. Alias /classic /opt/webtools/lxr.mozilla.org
  70. Alias /ef /opt/webtools/lxr.mozilla.org
  71. Alias /grendel /opt/webtools/lxr.mozilla.org
  72. Alias /mailnews /opt/webtools/lxr.mozilla.org
  73. Alias /mozilla /opt/webtools/lxr.mozilla.org
  74. Alias /nspr /opt/webtools/lxr.mozilla.org
  75. Alias /seamonkey /opt/webtools/lxr.mozilla.org
  76. </VirtualHost>
  77. Symlink based coniguration for Multiple Trees
  78. This requires a file system which supports symlinks (ntfs junctions
  79. should also work). This is the approach currently used by
  80. mxr.mozilla.org.
  81. Create symlinks for each root in the MXR directory:
  82. ln -s . ef
  83. ln -s . nspr
  84. ln -s . js
  85. ln -s . webtools
  86. The more formal way to do this is now:
  87. ./add-root.pl ef /data/mxr/ef/mozilla ef
  88. ./add-root.pl nspr /data/mxr/nspr/mozilla nspr
  89. ./add-root.pl seamonkey /data/mxr/seamonkey/mozilla mozilla
  90. ./add-root.pl mozilla-central /data/mxr/mozilla-central/mozilla-central mozilla
  91. add-root.pl will both create the symlink and add the appropriate lines
  92. to lxr.conf. The third optional argument is roughly speaking the tree's
  93. "pretty" name.
  94. Currently root/index.html is not automatically generated,
  95. it could and should be.
  96. Files you will need to change manually:
  97. update-src.pl
  98. - add pull/checkout rules for each tree
  99. root/index.html
  100. - advertise your roots with this file which is the user facing root
  101. of the MXR install
  102. Files you can customize:
  103. template-*
  104. - these files are used to piece together the output from
  105. * find
  106. * search
  107. * ident
  108. * source
  109. * diff
  110. Local.pm
  111. - add support for VCS integration magic
  112. - add special directory prefix handling
  113. index.html
  114. * this is the root for all trees
  115. Scripts you will want to run from a cron job (in order)
  116. ./update-src.pl -cron treename &&
  117. ./update-search.pl -cron treename &&
  118. ./update-xref.pl -cron treename
  119. The easiest way to add a tree to your new (or growing) MXR:
  120. ./add-root.pl treename /path/to/tree/root treeprefix
  121. e.g.:
  122. ./add-root.pl bugzilla /data/mxr/bugzilla/webtools/bugzilla mozilla/webtools/bugzilla
  123. the result:
  124. sourceroot: bugzilla /data/mxr/bugzilla/mozilla/webtools/bugzilla
  125. sourceprefix: bugzilla mozilla/webtools/bugzilla
  126. Sometimes you may want to change the location of your trees,
  127. without having to rerun the indexer (which can be prohibitively
  128. expensive). The most common case for this is when you're
  129. importing a tree from another file system and the paths don't match.
  130. The easiest way to move a tree on your file system:
  131. mv /path/to/tree/root /newpath/to/tree/root
  132. ./update-root.pl treename /newpath/to/tree/root
  133. The more common variant:
  134. [origin mxr-data] $ rsync tree/root host:/newpath/to/tree/root
  135. [host mxr] ./add-root.pl treename /path/to/tree/root
  136. [host mxr] ./update-root.pl treename /newpath/to/tree/root
  137. The argument to add-root isn't a valid path on host, but that's
  138. ok, it's only necessary so that update-root.pl can understand
  139. how to change the path to match the new file system layout.
  140. The lxr.conf file:
  141. MXR does not care much about your directory structure, all relevant
  142. paths can be configured from the lxr.conf file. This file is located
  143. in the same directory as the perl script files.
  144. MXR recognizes the following options in the configuration file:
  145. baseurl
  146. The url for the root directory of your source. Tree name (if any)
  147. is appended to this.
  148. htmlhead
  149. The header of all html files. This is a template that
  150. contains mainly html code but it can also contain some special
  151. directives, these are documented below.
  152. sourcehead
  153. A special version of htmlhead used for source code listings.
  154. sourcedirhead
  155. A special version of htmlhead used for directory listings.
  156. htmltail
  157. Template for bottom of pages.
  158. htmldir
  159. Template file for the directory listings.
  160. sourceroot
  161. The root directory of the source to be indexed. If you're indexing
  162. several version you could include a variable in the path.
  163. sourceroot: /usr/local/lxr/source/$v/linux/
  164. To index more than one tree, include one sourceroot entry for
  165. each tree. Each entry is a tree name/directory pair.
  166. sourceroot: classic /export2/lxr-data/classic/mozilla
  167. virtroot
  168. This is prepended to the path name when forming the url in links.
  169. bonsaihome
  170. If bonsai is set up for your code then set this as the url prefix. If not,
  171. then remove the bonsai related code in the htmlhead file and ignore this.
  172. More info on bonsai can be found at http://www.mozilla.org/bonsai.html
  173. sourcerootname
  174. The name of the root (more....)
  175. sourceprefix
  176. The prefix between the global prefix and the starting point for the root.
  177. incprefix
  178. Where to find source specific include files.
  179. dbdir
  180. Where to find the database files that lxr needs (fileidx xref and
  181. the glimpse files). The tree name (if any) is appended to this.
  182. alias
  183. Defines another tree with the same properties as an existing alias/tree.
  184. glimpsebin
  185. Location of the glimpse binary on your system.
  186. variable
  187. This defines a variable that can be used in templates and
  188. the config file. The syntax is
  189. variable: <name>, <text>, <values>, <default>
  190. <name> is the name of the variable, <text> is a textual description,
  191. <values> are the possible values of the variable.
  192. <default> is the default value of the variable.
  193. The <values> field can either be a list starting with a "(" and
  194. ending with a ")", with elements separated with ",", or it can be
  195. [ <filename> ]. In this case the values are read from a file with
  196. one value on each line.
  197. EXAMPLE:
  198. # Define typed variable "v", read valueset from file.
  199. variable: v, Version, [/local/lxr/source/versions], [/local/lxr/source/defversion]
  200. # Define typed variable "a". First value is default.
  201. variable: a, Architecture, (i386, alpha, m68k, mips, ppc, sparc, sparc64)
  202. map - This makes it possible to rewrite directories using variables.
  203. The linux sourcecode for instance contains several different
  204. architectures, the include files for each of these are found in the
  205. directory /include/asm-<architecture>/. To remap each of these
  206. according to a variable $a you can specify
  207. map: /include/asm[^\/]*/ /include/asm-$a/
  208. Find creative uses for this option :-)