LXR的安装和配置

来源:互联网 发布:荣耀9安兔兔跑分数据 编辑:程序博客网 时间:2024/06/06 00:07

1) A recent version of the exuberant ctags program.  Available from
   http://sf.net/projects/ctags

2) A relational database - MySQL 4.x/5.x (http://www.mysql.com), Postgresql
   (http://www.postgresql.org) and Oracle are supported.
   You will also need the right Perl DBI drivers for your particular database,
   usually available from CPAN.

3) A webserver - Apache httpd (http://httpd.apache.org/) with mod_perl
   (http://perl.apache.org/) is recommended.  LXR works with Apache 1 and Apache 2.

4) For freetext searching, either Glimpse (http://glimpse.cs.arizona.edu) or
   Swish-e (http://swish-e.org) version 2.1 or later.
   Swish-e is fully GPL'ed, while Glimpse is only free for
   non-commercial use.

5) The Perl database driver interface DBI and the relevant DBD driver for the
   database you're using.  If you don't already have these, they can be
   installed via CPAN.  See http://dbi.perl.org/index.html for more info.

6) The Perl File::MMagic module, available from CPAN

7) If using the CVS support, you will need rcs installed as well.

8) If you are using the BitKeeper support, you will need:
    BitKeeper (bk) installed
    Digest::SHA module (available from CPAN)

 

====Mysql脚本安装====

Run 'mysql' as a user that has the right to create new databases
(often root) and then read in the initdb-mysql file using
'/. initdb-mysql'.  This will create the database and a user called
lxr with access rights to the database.

 

====lxr.conf==========

# -*- mode: perl -*-
# Configuration file
#
(
    {
        # Global configuration

        # Path to glimpse executables.
        # Define this OR the swish-e variable depending which search engine you want to use.
        'glimpsebin'   => '/usr/local/bin/glimpse',
        'glimpseindex' => '/usr/local/bin/glimpseindex',
        'htmlsearch' => 'html-search-glimpse.html',

        # Location of SWISH-E binary
        #'swishbin' => '/usr/local/bin/swish-e',

        # Path to Exuberant Ctags executable
        'ectagsbin' => '/usr/bin/ctags',

        # Place where lxr can write temporary files
        'tmpdir' => '/tmp',

        # Location of the Generic.pm config file
        'genericconf' => '/home/Program/lxr/lib/LXR/Lang/generic.conf',

        # Location of the ectags.conf file
        'ectagsconf' => '/home/Program/lxr/lib/LXR/Lang/ectags.conf',

        # Paths for CVS module
        'cvspath' => '/bin:/usr/local/bin:/usr/bin:/usr/sbin',
    },

    {

        # Configuration for http://192.168.1.3/lxr.
        # baseurl is used to select configuration block.

        'baseurl' => 'http://127.0.0.1/lxr',    # Put your URL here
             # baseurl_aliases allows other URLs to be used to reach the site
             # comment this out if you do not want any aliases
        #'baseurl_aliases' => [ 'http://localhost/lxr', 'http://mydomain/lxr' ],
        'virtroot'        => '/lxr',                   # The bit after the / above

        'variables' => {

            # Define typed variable "v".  This is the list of versions to index.
            'v' => {
                'name' => 'Version',

                # This can come from a file, a function or be explicitly
                # ennumerated.
                # From a file:
                #'range' => [ readfile('versions') ],

                # Explicitly:
                # 'range' => [qw(v1 v2 v3.1 v4 experimental)],
                # If files within a tree can have different versions,
                # e.g in a CVS tree, 'range' can be specified as a
                # function to call for each file:
                #'range'   => sub { return
                #            ($files->allreleases($LXR::Common::pathname),
                #             $files->allrevisions($LXR::Common::pathname))
                #            }, # deferred function call.
                #
                # When using a GIT repo, you can use its tags
                # to create a list of versions. As an extra
                # bonus, with the Linux::KernelSort Perl module,
                # you can properly sort kernel versions. Just
                # leave it off for generic projects.
                #
                #    Simple example for any GIT repo:
                #    'range' => sub {
                #        my $some_dir = "/path/to/project/.git/refs/tags";
                #        opendir (DIR, $some_dir) || die "cannot opendir $some_dir: $!";
                #        my @files = grep { -f "$some_dir/$_" } readdir (DIR);
                #        closedir DIR;
                #        return sort @files;
                #    },
                #
                #    Advanced example for Linus's upstream
                #    linux-2.6 kernel repository:
                #    'range' => sub {
                #        use Linux::KernelSort;
                #        my $kernel = new Linux::KernelSort;
                #
                #        my $some_dir = "/path/to/linux-2.6/.git/refs/tags";
                #        opendir (DIR, $some_dir) || die "cannot opendir $some_dir: $!";
                #        my @files = grep { -f "$some_dir/$_" } readdir (DIR);
                #        closedir DIR;
                #        # Linus's tags all have a leading "v"
                #        # which we must cut off for sorting
                #        # add again afterwards.
                #        for (my $i = 0; $i < scalar (@files); $i++) {
                #            $files[$i] =~ s/^v//;
                #        }
                #        @files = $kernel->sort (@files);
                #        for (my $i = 0; $i < scalar (@files); $i++) {
                #            $files[$i] =~ s/^/v/;
                #        }
                #
                #        return @files;
                #    },

                # The default version to display
                'default' => 'boost'
            },

            # Define typed variable "a".  First value is default.
            'a' => {
                'name'  => 'Architecture',
                'range' => [qw(i386 alpha arm m68k mips ppc sparc sparc64)]
            },
        },

        # These do funky things to paths in the system - you probably don't need them.
        'maps' => {
            '/include/asm[^//]*/' => '/include/asm-$a/',
            '/arch/[^//]+/'       => '/arch/$a/',
        },

        # Templates used for headers and footers
        'htmlhead'     => 'html-head.html',
        'htmltail'     => 'html-tail.html',
        'htmldir'     => 'html-dir.html',
        'htmlident'     => 'html-ident.html',
        'htmlident_refs' => 'html-ident-refs.html',
        'htmlfind'     => 'html-find.html',
        'htmlsearch'     => 'html-search-swish.html',

        'sourcehead'    => 'html-head.html',
        'sourcedirhead'    => 'html-head.html',
        'stylesheet'    => 'lxr.css',

        # sourceroot - where to get the source files from

        # For ordinary directories, this specifies a directory which has each version as a
        # subdirectory e.g.
        #  indexed-src/version1/...
        #  indexed-src/version2/...
        # The names of the version directories must match the values for the Version
        # variable above.
        'sourceroot' => '/home/lxr-indexed-src',

        # Alternatively, this can specify a CVS repository by setting the value to "cvs:"
        # followed by the path to the repository.  Note this must be file accessible - remote
        # server access does NOT work.
        #     'sourceroot'    => 'cvs:/hom/karsk/a/CVSROOT/linux',

        # For a BitKeeper repository, specify bk: followed by the path to the
        # repository.  For BK it is also necessary to specify a 'cachepath' parameter in
        # the 'sourceparams' value below.  This should point to a directory where the
        # code can write and read files.
        #     'sourceroot' => 'bk:/some/repository/here',

        # Finally, you can also use GIT, Linux Kernel's new
        # distributes SCM to access the history:
        #     'sourceroot' => 'git:/some/repository/.git'
        #     'sourceroot' => 'git:/some/repostitory.git'
        # The `sourceroot' config variable points to the directory
        # in which you find the `objects', `refs', `index' etc.
        # directories.

        # The name to display for this source tree
        'sourcerootname' => 'Boost1.42.0',

        #
        # Any parameters to the source access method should be specified below.
        #
        # BK:    'cachepath' is used for temporary files
        # GIT:    if `do_annotations' is non-zero, the file revision that
        #        introduced each line is displayed.
        #    `do_blame' will add the author of each line to the
        #        output. Keep in mind that the core LXR code
        #        will only request author information if
        #        annotations are switched on, too!
        #
        'sourceparams' => {
            'cachepath'    => '/a/path/here',
            'do_annotate'    => 1,
            'do_blame'    => 1,
        },

        # The DBI identifier for the database to use
        # For mysql, the format is dbi:mysql:dbname=<name>
        # for Postgres, it is dbi:Pg:dbname=<name>
        # for Oracle, it is dbi:Oracle:host=localhost;sid=DEVMMS;port=1521
        'dbname' => 'dbi:mysql:dbname=lxr',

        # If you need to specify the username or password for the database connection,
        # uncomment the following two lines
        #  'dbpass'        => 'foo',
           'dbuser'        => 'lxr',

        # If you need multiple lxr configurations in one database, set different table
        # prefixes for them.
        #  'dbprefix' => 'lxr_',

        # For using glimpse, the directory to store the .glimpse files in is required
        'glimpsedir' => '/home/Program/lxr/glimpse/databases',

        # Location of swish-e index database files if using swish-e
        #'swishdir' => '/a/directory/here/',

        # where to look for include files inside the sourcetree.  This is used to hyperlink
        # to included files.
        'incprefix' => [ '/include', '/include/linux' ],

        # Which extensions to treat as images when browsing.  If a file is an image,
        # it is displayed.
        'graphicfile' => '(?i)/.(gif|jpg|jpeg|pjpg|pjpeg|xbm|png)$',    #'

        # How to map files to languages
        # Note that the string for the key and the first entry in the
        # array MUST match
        'filetype' => {

            # Format is
            # Language name, filepatten regexp, module to invoke,
            # (optional )tabwidth
            # Note that to have another language supported by Generic.pm,
            # you must ensure that:
            # a) exuberant ctags supports it
            # b) generic.conf is updated to specify information about the language
            # c) the name of the language given here matches the entry in generic.conf
            'C' => [
                'C', '/.c$|/.pc$'    #'
                , 'LXR::Lang::Generic', '8'
            ],
            'C++' => [
                'C++',
                '/.C$|((?i)/.c/+/+$|/.cc$|/.cpp$|/.cxx$|/.h$|/.hh$|/.hpp$|/.hxx$|/.h/+/+$)'    #'
                , 'LXR::Lang::Generic', '8'
            ],

            # Some languages are commented out until the relevant entries in generic.conf are made
            # The list here is the set supported by ctags 5.0.1
            # 'Beta'    => [ 'Beta',   '(?i)/.bet$', 'LXR::Lang::Generic' ],
            # 'Eiffel'  => [ 'Eiffel', '(?i)/.e$',   'LXR::Lang::Generic' ],
            # 'Fortran' =>
            #   [ 'Fortran', '(?i)/.f$|/.for$|/.ftn$|/.f77$|/.f90$|/.f95$', 'LXR::Lang::Generic' ],
            'Cobol' => [ 'Cobol',  '(?i)/.cob$', 'LXR::Lang::Cobol' ],
            'Java' => [ 'Java', '(?i)/.java$', 'LXR::Lang::Java', '4' ],

            # 'Lisp' => [
            #    'Lisp', '(?i)/.cl$|/.clisp$|/.el$|/.l$|/.lisp$|/.lsp$|/.ml$', 'LXR::Lang::Generic'
            # ],

            # No tabwidth specified here as an example
            'Make' => [ 'Make', '(?i)/.mak$|(?i)/.mk$|makefile*', 'LXR::Lang::Generic' ],

            # 'Pascal' => [ 'Pascal', '(?i)/.p$|/.pas$',                'LXR::Lang::Generic' ],
            'Perl'   => [ 'Perl',   '(?i)/.pl$|/.pm$|/.perl$',     'LXR::Lang::Generic', '4' ],
            'php'    => [ 'php',    '(?i)/.php$|/.php3$|/.phtml$', 'LXR::Lang::Generic', '2' ],
            'Python' => [ 'Python', '(?i)/.py$|/.python$',         'LXR::Lang::Generic', '4' ],

            # 'rexx'   => [ 'rexx',   '(?i)/.cmd$|/.rexx$|/.rx$',       'LXR::Lang::Generic' ],
            # 'ruby'   => [ 'ruby',   '(?i)/.rb$',                      'LXR::Lang::Generic' ],
            # 'scheme' => [ 'scheme', '(?i)/.sch$|/.scheme$|/.scm$|/.sm$', 'LXR::Lang::Generic' ],
            'shell' => [ 'shell', '(?i)/.sh$|/.bsh$|/.bash$|/.ksh$|/.zsh$', 'LXR::Lang::Generic' ],

            # 's-Lang' => [ 's-Lang', '(?i)/.sl$',                'LXR::Lang::Generic' ],
            'SQL' => [ 'SQL', '(?i)/.sql$|/.pks$|/.pkb$',               'LXR::Lang::Generic' ],
            'VB'  => [ 'VB',  '(?i)/.bas$|/.cls$|/.ctl$|/.frm$|/.vbs$', 'LXR::Lang::Generic' ],
            #'tcl' => [ 'tcl', '(?i)/.tcl$|/.wish$',                     'LXR::Lang::Generic' ],
        },

        # Maps interpreter names to languages.  The format is:
        #  regexp => langname
        #   regexp is matched against the part after #! on the first line of a file
        #   langname must match one of the keys in filetype above.
        #
        # This mapping is only used if the filename doesn't match a pattern above, so
        # a shell script called shell.c will be recognised as a C file, not a shell file.

        'interpreters' => {
            'perl'   => 'Perl',
            'bash'   => 'shell',
            'csh'    => 'shell',
            'python' => 'Python',
            'ksh'    => 'shell',
            'zsh'    => 'shell',
            'sh'     => 'shell',
            'ksh'    => 'shell',
        },

        # a link of the form (prefix)($filepath)(postfix) is generated when viewing a file
        #   example for cvsweb:
        #'cvswebprefix' => 'http://cvs.myhost.com/cgi-bin/cvsweb.cgi',
        #'cvswebpostfix' => '?cvsroot=rootname',
        #   example for viewcvs:
        #'cvswebprefix' => 'http://cvs.myhost.com/cgi-bin/viewcvs.cgi/myroot',
        #'cvswebpostfix' => '',

        # Directories to always ignore. These usually are the SCM's
        # private directories which possibly may contain non-public
        # project history.
        'ignoredirs' => ['CVSROOT', '.git'],
    }
  )