在Fedora中安装lxr浏览内核源代码


转自:http://bbs.fedora-zh.org/showthread.php?1764-在fedora中安装lxr浏览内核源代码

说明:本文旨在在Fedora中安装lxr,此安装方法与Fedora版本无关,本文在Fedora 11中进行的安装,参考的是Fedora 4/9等文章说明,成功。使用普通用户安装,过程中使用到su命令,lxr设置为可以同时查看多个版本源代码。

1.下载lxr-0.3
下载地址:http://sourceforge.net/projects/lxr/files/
说明:lxr的最新版使用的是PostgreSQL,麻烦,0.3则不需要数据库,方便。

2.下载glimpse
http://webglimpse.net/download.php
http://webglimpse.net/trial/glimpse-latest.tar.gz

3.安装lxr
3.1解压lxr,进入解压后的文件夹lxr-0.3,修改Makefile文件,主要有两项:

代码:
# The location of your perl5 binary
PERLBIN=/usr/bin/perl
这是perl的路径名,/usr/bin/perl是大多数情况下的默认配置,如果不同,请用whereis perl查找。
# LXR will be installed here
INSTALLPREFIX=/var/www/html/lxr
这是lxr脚本的安装目录,其中/var/www/html取自Apache配置文件/etc/httpd/conf/httpd.conf中的DocumentRoot(文件根目录)的值。3.2执行"make install"

代码:
su
make install这会在上述INSTALLPREFIX目录安装相应的脚本和文件.

4.安装glimpse
进入解压后的文件夹,执行:

代码:
./configure
su
make install以下操作需要root权限:

5.把源代码放在/var/www/html/lxr/source文件夹中
这里可以放多个,比如linux-1.0, linux-2.4.0, linux-2.6.18.8,其中linux-1.0.tar.bz2和linux-2.4.1.tar.bz2解压后的文件夹都是linux,请自行改名,原因后面说明。

6.在source中建立两个文件versions和defversion,其中versions为你的源代码版本(即你的目录),defversion为你的default version,即lxr默认展示的那个version。
versions的内容就是所有的源代码的版本,如下:

代码:
linux-1.0
linux-2.4.0
linux-2.6.18.8defversion的内容如下:

代码:
linux-2.4.07.修改lxr的配置文件lxr.conf,先备份一下:

代码:
# cp lxr.conf lxr.conf.bak需要修改的有variable v, baseurl, htmlhead, htmltail, htmldir, sourceroot, srcrootname, dbdir和glimpsebin,如下(这里用到了前面建立的两个文件versions和defversion):

代码:
# Configuration file.

# Define typed variable "v", read valueset from file.
variable: v, Version, [/var/www/html/lxr/source/versions], [/var/www/html/lxr/source/defversion]

# Define typed variable "a".  First value is default.
variable: a, Architecture, (i386, alpha, m68k, mips, ppc, sparc, sparc64)

# Define the base url for the LXR files.
baseurl: http://localhost/lxr/http/

# These are the templates for the HTML heading, directory listing and
# footer, respectively.
htmlhead: /var/www/html/lxr/http/template-head
htmltail: /var/www/html/lxr/http/template-tail
htmldir:  /var/www/html/lxr/http/template-dir

# The source is here.
sourceroot: /var/www/html/lxr/source/$v/
srcrootname: $v

# "#include <foo.h>" is mapped to this directory (in the LXR source
# tree)
incprefix: /include

# The database files go here.
dbdir: /var/www/html/lxr/source/dbdir/$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/8.创建lxr/http/.htaccess文件,即/var/www/html/lxr/http/.htaccess,

内容如下:

  • 1
  • 2
  • 下一页

相关内容