본문 바로가기

Linux

lxr installing document

1. apache 2.xx설치 하기

DSO(Dynamic Shared Objet)방식은 아파치가 구동 중에 클라이언트로
부터 perl스크립트의 해석을 요청 받았을 때 비로서 perl이 구동하는 방식이다.
이는 항상 메모리에 상주하는 static방법보다 더 효율적이다.

apaceh 2.0은 perl 5.8.0, mod_perl 2.0이상이어야 함.

여기에 대략적으로 설명을 남긴다.
DSO를 설치하는 두가지 방법 중 아파치가 이미 설치된 경우로 했다.
이 경우는 apxs으로서 아파치에서 cgi스크립트가 활성화 되어야 하고
mod_so가 모듈화 되어 있어야한다.(httpd -l)
apxs setup방식
$ tar xvfz httpd-2.0.52.tar.gz
$ cd apache-2.0.52
$ ./configure --prefix=/usr/local/apache --enable-shared=max

//
// Download path
// http://perl.apache.org/download/index.html
//
먼저 perl모듈패키지를 적당한 곳에 다운 받는다.
압축을 푼다.
$ tar -xzvf mod_perl-2.0-current.tar.gz

압축 푼곳으로 이동한다
$ cd mod_perl-1.99_16
$ perl Makefile.PL WHITH_APXS=/usr/local/apache/bin/apxs
$ make
$ make install

httpd.conf파일에 다음과 같이 추가한다.

    LoadModule perl_module modules/mod_perl.so
    PerlModule Apache2

2. lxr설치

//
// Download Path
// http://lxr.sf.net
//
lxr 을 다운 받아서 설치한다.

설치시 Makefile을 수정해야 한다.

tar xvfz lxr-0.3.tar.gz
PERLBIN=/usr/bin/perl    ; 펄의 위치
INSTALLPREFIX=/usr/local/apache/htdocs/lxr ; lxr이 깔릴 위치(여기서는 htdocs/lxr에 깔리도록 해놨다. 이게 속편하다.)

make install

//
// Download Path
// http://webglimpse.net/download.php
//
3. glimpse설치
glimpse를 설치한다. 서치엔진...인가???

tar xvfz glimpse-latest.tar.gz
sh configure
make
make install

4. perl-db설치
perl-db를 다운받아 설치한다.
주소는 http://fr.rpmfind.net/linux/rpm2html/search.php
$ rpm -ivh perl-DB_File-1.804-88.i386.rpm

5. lxr configure 수정.
/usr/local/apache/htdocs/lxr/http로 이동한다.
http안에 lxr.conf를 열어서 수정한다.


//////////////////////////////////////////////////////////////////////////////////////////////
# Configuration file.
     2
     3 # Define typed variable "v", read valueset from file.
     4 variable: v, Version, [/usr/local/apache/htdocs/lxr/source/versions], [/usr/local/apache/htdocs/lxr/source/defversion]
     5
     6 # Define typed variable "a". First value is default.
     7 variable: a, Architecture, (i386, alpha, m68k, mips, ppc, sparc, sparc64)
     8
     9 # Define the base url for the LXR files.
     10 baseurl: http://203.240.203.172/lxr/http/
     11
     12 # These are the templates for the HTML heading, directory listing and
     13 # footer, respectively.
     14 htmlhead: /usr/local/apache/htdocs/lxr/http/template-head
     15 htmltail: /usr/local/apache/htdocs/lxr/http/template-tail
     16 htmldir: /usr/local/apache/htdocs/lxr/http/template-dir
     17
     18 # The source is here.
     19 sourceroot: /usr/local/apache/htdocs/lxr/source/$v/tos/
     20 srcrootname: tos
     21
     22 # "#include " is mapped to this directory (in the LXR source
     23 # tree)
     24 incprefix: /include
     25
     26 # The database files go here.
     27 dbdir: /usr/local/apache/htdocs/lxr/source/$v/
     28
     29 # Glimpse can be found here.
     30 glimpsebin: /usr/local/bin/glimpse
     31
     32 # The power of regexps. This is pretty Linux-specific, but quite
     33 # useful. Tinker with it and see what it does. (How's that for
     34 # documentation?)
     35 map: /include/asm[^\/]*/ /include/asm-$a/
     36 map: /arch/[^\/]+/ /arch/$a/
////////////////////////////////////////////////////////////////////////////////////////////////

위와 같이 수정하면 된다. 주의할것은 variable과 baseurl의 위치를 주의깊게 보기바란다.
또한 sourceroot는 srcrootname과 마지막 디렉토리 이름이 같아야 한다. source디렉토리의 이름과...
glimpsebin의 위치는 /usr/local/bin/glimpse이다.


SetHandler cgi-script


httpd.conf추가

Options All
AllowOverride All



6. DB파일을 생성

우선 identifier 데이터베이스의 생성은 lxr/bin/genxref를 이용해서 한다 lxr.conf의
dbdir로 설정한 디렉토리로 가서 genxref를 실행하면 된다. 주의할 점은 반드시 dbdir로
가서 genxref를 실행해야 한다는 것이다.
컴퓨터의 성능에 따라 수분에서 수십분의 시간이 걸린다. 결과 파일로 fileidx와 xref라
는 두개의 파일이 생성된다.

genxref를 실행하기 전에 ~/lxr/http/lib/LXR/Common.pm파일을 수정한다. 수정할 부분은 다음과 같다.

    # A C/C++ file
    if ($fname =~ /\.([ch]|cpp?|cc|nc)$/i) { # Duplicated in genxref.

if문안에 nc확장자를 추가한다. 이렇게 해야 nc파일도 인덱싱이 된다.

# cd /usr/local/lxr/source/2.4.11
# ../../bin/genxref linux


다음으로 glimpse를 위한 데이터베이스를 생성해 준다 이 역시 dbdir에서 지정한 디렉
토리에서 glimpseindex를 실행한다.
수분의 시간이 걸리는데 로 시작하는 개의 파일이 생성된다 로 확인해 , .glimpse_ 7 . ls -la
볼 수 있다.

# cd /usr/local/lxr/source/2.4.11
# /usr/local/glimpse/bin/glimpseindex -H . linux


마지막으로 이들 파일에 대한 접근 권한을 부여한다. 아파치 실행시의 owner와
group으로 지정한다.

# chmod a+r .glimpse_*
# chmod a+r fileidx
# chmod a+r xref


모든 설치와 설정이 끝났다. 이제 브라우저를 통해 lxr의 url에 접속해 보자 그러면 화면
2와 같은 lxr의 화면을 볼 수 있을 것이다. 상단의 기능을 이용하면 원하는 search
나 identifier와 freetext file을 쉽게 검색해 볼 수 있을 것이다

'Linux' 카테고리의 다른 글

Nonblocking I/O | UNIX C - Network 2005/03/15 17:16  (0) 2013.09.26
2.2. Bottom Half  (0) 2013.09.26
[LXR로 소스 코드 올리는 법]  (0) 2013.09.26
rdate Cross compile  (0) 2013.09.26
Hybus 공인 ip 설정  (0) 2013.09.26