linux下源代码阅读工具lxr安装整理可用版
说明:我是吸取jjww和dragonfly的贴子以及http://www.linuxsir.com/bbs/showthread.php?s=&threadid=28400和我自己的体会整理的.感谢他们一直以来对我的帮助!我这里的过程可能和很多人放置的文件夹位置不太一样,但是我想这可使大家更加清楚每一步,每一个参数是干什么用的,我想大家遇到困难的时候都会问,这个位置和做法到底是干什么的?我换成别的是否可以?所以,我在这里就适当地做了几处替换,我想会更清晰一些.
有不足之处还请指教.
需要的软件包:
glimpse-latest.tar.gz
lxr-0.3.tar.gz
perl-5.8.0.tar.gz(最好要自己下载这个,自己安装,原来自带的可能不全)
环境:
RedHat8.0
我的源代码位置:
/home/linux-2.4.20
安装步骤:
1. #cd /etc/httpd/conf/
#vi httpd.conf
修改DocumentRoot为自己想要的目录,随便自己定义.
DocumentRoot "/home/www/html"
2.1 安装glimpse
#tar -zvxf glimpse-latest.tar.gz
#cd glimpse-4.17.4
#./configure
#make
#make install
这时glimpse就安装到/usr/local/bin中了.
2.2 安装perl
#tar -zvxf perl-5.8.0.tar.gz
#cd perl-5.8.0
#./Configure -d
#make
#make test
#make install
这时perl就安装到了/usr/local/bin中了.
修改 /usr/local/lib/perl5/5.8.0/i686-linux/DB_File.pm
在大约259行,即
==========================
# make recno in Berkeley DB version 2 work like recno in version 1.
if ($db_version > 1 and defined $arg and $arg =~ /RECNO/ and
$arg and ! -e $arg) {
open(FH, ">$arg") or return undef ;
close FH ;
==========================
这段语句之前加上$arg = 0666 unless defined $arg ;进行初始化
2.3 安装lxr
#tar -zvxf lxr-0.3.tar.gz
#cd lxr-0.3
#vi Makefile
修改如下
PERLBIN = /usr/local/bin/perl (perl安装的位置)
INSTALLPREFIX = /home/www/html/lxr (实际上是$DocumentRoot/lxr)
#make install
3 #cd /home/www/html/lxr/http (实际上是$INSTALLPREFIX/http)
#vi .htaccess
内容是
<Files ~ (search|source|ident|diff|find)$>
SetHandler cgi-script
</Files>
#vi lxr.conf
内容是
# Define the base url for the LXR files.baseurl中最后一个斜线"/"绝对不能少.
baseurl: http://localhost/lxr/http/
# These are the templates for the HTML heading, directory listing and
# footer, respectively.
htmlhead: /home/www/html/lxr/http/template-head
htmltail: /home/www/html/lxr/http/template-tail
htmldir:/home/www/html/lxr/http/template-dir
# The source is here.源代码本身的位置
sourceroot: /home/linux-2.4.20/
srcrootname: linux-2.4.20
# "#include <foo.h>" is mapped to this directory (in the LXR source
# tree)
incprefix: /include
# The database files go here.索引之后产生的索引文件所在的位置
dbdir: /home/www/html/lxr/source/$v/
# Glimpse can be found here.
glimpsebin: /usr/local/bin/glimpse
# The power of regexps.This is pretty Linux-specific, but quite
# useful.Tinker with it and see what it does.(How's that for
# documentation?)
map: /include/asm[^\/]*/ /include/asm-$a/
map: /arch/[^\/]+/ /arch/$a/
4. #cd /home/www/html/lxr/source
#vi versions
2.4.20
#vi defversion
2.4.20
#mkdir 2.4.20
5. #cd /home/www/html/lxr/source/2.4.20
#/home/www/html/lxr/bin/genxref /home/linux-2.4.20/
#glimpseindex -H . /home/linux-2.4.20/
注意:生成的2.4.20/下面的fileidx的模式要改成至少是644的,让owner,group和other都可以读
6. #cd /etc/httpd/conf
#vi httpd.conf
加入
<Directory "/home/www/html/lxr/http">
Options All
AllowOverride All
</Directory>
#cd /etc/rc.d/init.d
#./httpd restart
7. 访问http://localhost/lxr/http/source就可以了. 其实我还是觉得直接在Linux下读好一点 i install lxr on my linux laptop. lxr is useful when u search sth. compare the code. 但看上面的安装好像很烦琐哟。 by do it step by step. u can know why it need do that. if u know perl, that is a very good perl code example.
the more u install various kinds of software, the stronger u are.:-D 我按照上面的方法
http://172.16.10.235/lxr/http/blurb.html
点击Browse the code
出现错误
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@LOVE and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log. internal error 500? what server u use? apache? can u check the file mode? do u apache support mod_perl?
most of the time, apache installation will come with two cgi script "printenv , test-cgi" , can u run them succ? 我用的是ML1.1自己带的PERL can u try to see if that two cgi scripts work? if not, try to make them work first. 读完以后, 安装文档安装使用, 发现lxr.conf配置中对dbdir中用的变量v(版本)需要修改一下(在前面定义了, 需要修改路径), 或者干脆像楼主参考的其他文档, 直接写上目录而不使用变量v up 别忘了把db_dir下的所有文件变为可读,包括隐藏文件。 thx 注意,一定要修改lxr.conf文件的以下内容:
# Define typed variable "v", read valueset from file.
variable: v, Version, ,
页:
[1]