QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7306|回复: 13

linux下源代码阅读工具lxr安装整理可用版

[复制链接]
发表于 2003-6-4 11:46:22 | 显示全部楼层 |阅读模式
说明:我是吸取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[4] and $arg[4] =~ /RECNO/ and
        $arg[1] and ! -e $arg[1]) {
        open(FH, ">$arg[1]") or return undef ;
        close FH ;
        ==========================
        这段语句之前加上$arg[3] = 0666 unless defined $arg[3] ;进行初始化

  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就可以了.
发表于 2003-6-4 14:33:13 | 显示全部楼层
其实我还是觉得直接在Linux下读好一点
回复

使用道具 举报

发表于 2003-6-4 22:58:25 | 显示全部楼层
i install lxr on my linux laptop. lxr is useful when u search sth. compare the code.
回复

使用道具 举报

发表于 2003-6-23 20:37:58 | 显示全部楼层
但看上面的安装好像很烦琐哟。
回复

使用道具 举报

发表于 2003-6-23 22:09:56 | 显示全部楼层
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.  
回复

使用道具 举报

发表于 2003-6-27 01:50:38 | 显示全部楼层
我按照上面的方法
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.
回复

使用道具 举报

发表于 2003-6-27 03:45:23 | 显示全部楼层
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?
回复

使用道具 举报

发表于 2003-6-27 11:45:17 | 显示全部楼层
我用的是ML1.1自己带的PERL
回复

使用道具 举报

发表于 2003-6-27 22:07:25 | 显示全部楼层
can u try to see if that two cgi scripts work? if not, try to make them work first.
回复

使用道具 举报

发表于 2003-11-28 09:37:01 | 显示全部楼层
读完以后, 安装文档安装使用, 发现lxr.conf配置中对dbdir中用的变量v(版本)需要修改一下(在前面定义了, 需要修改路径), 或者干脆像楼主参考的其他文档, 直接写上目录而不使用变量v
回复

使用道具 举报

发表于 2004-6-29 03:26:58 | 显示全部楼层
up
回复

使用道具 举报

发表于 2004-8-25 10:32:47 | 显示全部楼层
别忘了把db_dir下的所有文件变为可读,包括隐藏文件。
回复

使用道具 举报

发表于 2004-10-28 16:52:08 | 显示全部楼层
thx
回复

使用道具 举报

发表于 2006-7-21 17:43:42 | 显示全部楼层
注意,一定要修改lxr.conf文件的以下内容:
# Define typed variable "v", read valueset from file.
variable: v, Version, [/home/www/html/lxr/source/versions], [/home/www/html/lxr/source/defversion]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-25 18:24 , Processed in 0.161893 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表