본문 바로가기

IT/Linux

Linux Source Code Referencd LXR 설정

1. 준비

리눅스를 관련 작업을 하다보면 LXR의 구축이 필요할때가 있다.

현재 LXR Main Site는 https://lxr.linux.no/ 에서 참고 가능하며, 나는 현재 버전 보다는 예전 버전으로 간단하게 구축 사용중이다.

Source는 예전버전인 0.3 버전을 사용하여 간단하게 구축했다.

https://sourceforge.net/projects/lxr/files/old/lxr-0.3/

 

LXR Cross Referencer - Browse /old/lxr-0.3 at SourceForge.net

FactoryTalk Optix Cloud Manufacturing Software For manufacturers interested in a powerful, open, scalable, HMI visualization platform

sourceforge.net

 

perl 과 glimpse 를 설치되어 있어야 한다.

아래의 사용된 Linux tree는 version 0.01 의 예이다.

 

2. 디렉토리 구성

bin     fileidx, genxref, xref
http     blurb.html , find,   index.html,  lxr.conf,  search_help.html,  template-dir,   template-tail,
diff, ident,  search, source,  template-head,  valid_html3.2.gif
lib   SimpleParse.pm
LXR Common.pm, Config.pm
source     version
0.01   fileidx, xref, .glimpse_*
linux source 디렉터리

 

2. apache2.conf 추가된 사항은 다음과 같다.

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

# for LXR
#Alias /lxr "/var/www/html/lxr"
<Files ~ (search|source|ident|diff|find)$>
SetHandler cgi-script
</Files>

<Directory "/var/www/html/lxr">
    Options All
    AllowOverride All
    #Order allow,deny
    #Allow from all
    #Require all granted
</Directory>

 

3. CGI Module를 Enable 한다.

root@www:~#a2enmod cgid

Enabling module cgid.
To activate the new configuration, you need to run:
  systemctl restart apache2

 

4. apache2를 restart 한다.

root@www:~#systemctl restart apache2

 

5. Source Index 생성

절대 경로를 사용하여 인덱스를 생성한다.

cd  var/www/html/lxr/source/0.01

../../bin/genxref linux/
glimpseindex -H /var/www/html/lxr/source/0.01 /var/www/html/lxr/source/0.01/linux
chmod 644 .glimpse* fileidx xref

 

이후에는 다음과 같은 File들이 생성 된다.

-rwxr-xr-x  1 root root 12288 Oct 17 16:07 fileidx*

-rwxr-xr-x 1 root root  4507 Oct 17 16:07 .glimpse_filenames*
-rwxr-xr-x 1 root root   352 Oct 17 16:07 .glimpse_filenames_index*
-rwxr-xr-x 1 root root     0 Oct 17 16:07 .glimpse_filetimes*
-rwxr-xr-x 1 root root 37337 Oct 17 16:07 .glimpse_index*
-rwxr-xr-x 1 root root   116 Oct 17 16:07 .glimpse_messages*
-rwxr-xr-x 1 root root   264 Oct 17 16:07 .glimpse_partitions*
-rwxr-xr-x 1 root root 32494 Oct 17 16:07 .glimpse_statistics*

 

6. 이후 브라우저로 접속하면 다음과 같이 나온다.

7. Debug

 

(1) 아래와 같은 메세지가 나오면 설정 파일을 Check 해보며, 특히 cgi가 동작하는지 확인한다.

 

(2) Directory  목록은 보이나 파일이 없다고 나오는경우는 퍼미션의 문제이다
     전 디렉토리를 chmod 755 * -R 을 하여 준다.

반응형