lxr+glimpse建立linux下源代码阅读环境
将lxr的安装文档修改后一个实用文档
To install LXR itself:
- Set the variables PERLBIN and INSTALLPREFIX in the makefile to
reflect where the Perl 5 binary is located on your system and where
you want the LXR files to be installed.
[ Additional ]
#modify the Makefile
That is, if the perl binary is located in /usr/bin,
PERLBIN=/usr/bin
should work. The INSTALLPREFIX refers to where the LXR scripts
will be installed; for instance, if you set
INSTALLPREFIX=/var/www/html/lxr
then the Makefile will create several directories under that point.
In particular, the Makefile will create
/var/www/html/lxr
source
bin
http
directories, for the source code you are going to cross reference,
the executable for creating the cross reference database, and
the CGI scripts used to browser the cross-referenced source,
respectively.
- Do "make install".
[ Additional ]
You probably will need to be root to do this.
- Edit $(INSTALLPREFIX)/http/lxr.conf to fit your source code
installations and needs.
[ Additional ]
lxr.conf defines several strings that control how lxr works.
Given a default installation, you should probably change
the following things:
# Define typed variable "v", read valueset from file.
variable: v, Version, [/var/www/html/lxr/source/versions], [/var/www/html/lxr/source/defversion]
So you should do "mkdir versions" first in the /var/www/html/lxr/source/ , and then edit the file ,add the kernel versions you want on this file per-line.
such as:
1.0
2.0
Also, you should create the folds under the /var/www/html/lxr/source/, named as 1.0 ,2.0 respectively.
and put the kernel sourcecodes into 1.0 and 2.0 respectively, and named as linux. (#for example: you should put kernel linux-1.0.tar.bz2 into 1.0,then tar xjvf linux-1.0.tar.bz2,it will create a folder linux-1.0, you should rename linux-1.0 as linux.)
# Define typed variable "a". First value is default.
variable: a, Architecture, (i386, alpha, m68k, mips, ppc, sparc, sparc64)
baseurl: http://your.server.com/lxr/http/
for example: my baseurl is: http://10.10.139.110/lxr/http/
where lxr/http should reflect the lxr directory relative to
your Webserver's document root. For instance, if your
Document root is /var/www/html and your INSTALLPREFIX is
/var/www/html/lxr, a likely baseurl would be
baseurl: http://your.server.com/lxr/http/
Be sure and include the trailing slash!
Following the above example,
htmlhead: /var/www/html/lxr/http/template-head
htmltail: /var/www/html/lxr/http/template-tail
htmldir: /var/www/html/lxr/http/template-dir
would be the proper settings for htmlhead, htmltail, and htmldir,
respectively. These files contain HTML that is prepended and appended
to each cross-reference webpage.
The sourceroot string refers to the directory containing the
source that you have cross referenced. Be sure to include the
trailing slash on the directory path.
dbdir should (probably) refer to $INSTALLPREFIX/source
Using our example, this would be
dbdir: /var/www/html/lxr/source/$v/
Once again, be sure to include the trailing slash!
# Glimpse can be found here.
glimpsebin: /usr/local/bin/glimpse
(Make sure you have copied glimpse,glimpseindex to /usr/local/bin/)
- Make sure the files in $(INSTALLPREFIX)/http can be reached via
your webserver. Make sure your webserver executes the files
search, source, ident and diff as cgi-scripts. With the Apache
webserver this can be accomplished by making
$(INSTALLPREFIX)/.htaccess contain the following lines:(you should create a file named ".htaccess" under /var/www/html/lxr/ first.)
<Files ~ (search|source|ident|diff|find)$>
SetHandler cgi-script
</Files>
[ Additional ]
With Apache, you may also need to edit the
/etc/httpd/conf/httpd.conf file
to include:
# Cross Reference Stuff
<Directory /var/www/html/lxr>
Options All
AllowOverride All
</Directory>
where /var/www/html/lxr should be replaced with the value
of INSTALLPREFIX.
- Generate the identifier database. Go to the directory you
configured as "dbdir" and do "$(INSTALLPREFIX)/bin/genxref foo", (your will do this under fold: /var/www/html/lxr/source/1.0/ or 2.0/, and foo is replaced by linux)
where foo is the subdirectory containing the actual source code.
- (Optional) Generate the Glimpse database. Go to the directory you
configured as "dbdir" and do "glimpseindex -H . foo", where foo is
the same as above. You might want to add other options to the
commandline (e.g. "-n"), see the Glimpse documentation for details.
do: chmod +r xref
chmod +r fileidx
chmod +r .glim*
To use:
After you have made the above changes, restart your web server
if you've edited the httpd.conf file, and then point a browser
to http://your.server.com/lxr/source
where lxr/source should refer to your INSTALLPREFIX relative
to your web server's document root.