Read Source Code the HTML Way
The first thing you'll see when you open the file is a definition for a variable called v. As with programming languages, you can define your own variables and use them later in the configuration file. Wherever they occur, they will be replaced by whatever value they have. Variable values are referenced by the configuration file by $/variable-name. Variable definitions follow one of two possible formats:
variable: /variable-identifier, variable-name, /(/list-of-values/), /default-value/
variable: /variable-identifier, variable-name, /[/file-containing-list-of-values/], /default-value/
Here's what the terms stand for:
variable-identifier: the name the variable will be known as throughout the configuration file.
variable-name: the actual name of the variable that will be displayed to the user.
list-of-values: comma-separated list of values to be displayed.
file-containing: a file that contains a list of possible values.
list-of-values: the list has each entry on a separate line. The user can select any one of them. The absolute path of the file should be provided.
default-value: the value that the variable will take on by default. The first value is automatically set if this is not specified.
The baseurl is the URL relative to which all of the scripts required by LXR are placed. It should be accessible via a browser. In my configuration, it's http://my-ip/lxr/http/ <http://localhost/lxr/http/>. Make sure to place the / at the end, or the last directory will be ignored.
When the HTML for the source is generated, LXR can add headers and footers to the pages. Sample headers and footers are provided in the $INSTALLPREFIX/http/ directory. They're called template-head and template-tail. In addition, you also can change the way files and directories are displayed by LXR by modifying the template-dir file. The locations of these files can be specified by the htmlhead, htmltail and htmldir options in the lxr.conf file.
This option tells LXR where to look for the actual source code. In my case, it's /var/www/htdocs/lxr/source/glibc-2.3.5. If you want to cross-reference multiple projects, all you have to do is create a variable specifying the location of each of the directories that contain the source code. Then, you can specify the value of the variable as the sourceroot. For example, I set up the sources for glibc-2.3.5 and OpenMOSIX-2.4.26, placing the sources for both of them in /var/www/htdocs/lxr/source in their individual directories with the same names as above. In lxr.conf, I had a line like:
variable: s, Source, (glibc-2.3.5, OpenMOSIX-2.4.26)
Thus, the appropriate source code is automatically selected based on the value of the source variable.
srcrootname specifies the name of the project whose source code is displayed—for example:
This is the location of the fileidx and xref files generated by genxref. If you have multiple projects, specify a separate location for each, as follows:
These are the only options you need to set when configuring LXR. Additionally, you can specify the location of the glimpse binary using glimpsebin.
glimpse allows users to search for specific files within the source code and to search for any text within source files. You can obtain the latest version of glimpse from webglimpse.net/trial/glimpse-latest.tar.gz. Extract and install it. Once you are done installing glimpse, go to the directory where the source code is installed, such as /var/www/htdocs/lxr/source/glibc-2.3.5, and do the following:
bash# glimpseindex -H . .
The output should look something like this:
This is glimpseindex version 4.18.2, 2006. Indexing "/var/www/htdocs/lxr/source/glibc-2.3.5" ... Size of files being indexed = 81711416 B, Total #of files = 10075 Index-directory: "/var/www/htdocs/lxr/source/glibc-2.3.5" Glimpse-files created here: -rw-r--r-- 1 root root 676398 2006-09-08 05:51 .glimpse_filenames -rw-r--r-- 1 root root 40300 2006-09-08 05:51 .glimpse_filenames_index -rw-r--r-- 1 root root 0 2006-09-08 05:50 .glimpse_filetimes -rw------- 1 root root 1783314 2006-09-08 05:51 .glimpse_index -rw-r--r-- 1 root root 686 2006-09-08 05:51 .glimpse_messages -rw------- 1 root root 836 2006-09-08 05:51 .glimpse_partitions -rw-r--r-- 1 root root 23888 2006-09-08 05:51 .glimpse_statistics
This creates the required glimpse index files in the current directory. Once they're created, make sure read permission is set for others:
bash# chmod o+r .glimpse-*
Now, set the glimpsebin option in lxr.conf to wherever you installed glimpse. I installed it in /usr/local/bin/glimpse.
That's it; save and close the lxr.conf file. The only thing remaining to do now is configure the Web server to work with LXR.
Webinar: 8 Signs You’re Beyond Cron
11am CDT, April 29th
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.Join us!
|Android Candy: Intercoms||Apr 23, 2015|
|"No Reboot" Kernel Patching - And Why You Should Care||Apr 22, 2015|
|Return of the Mac||Apr 20, 2015|
|DevOps: Better Than the Sum of Its Parts||Apr 20, 2015|
|Play for Me, Jarvis||Apr 16, 2015|
|Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites||Apr 15, 2015|
- Tips for Optimizing Linux Memory Usage
- "No Reboot" Kernel Patching - And Why You Should Care
- DevOps: Better Than the Sum of Its Parts
- Return of the Mac
- Android Candy: Intercoms
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites
- Designing Foils with XFLR5
- Non-Linux FOSS: .NET?
- Play for Me, Jarvis