ports/134145: New port: devel/lxr, generic code cross-reference tool

Eygene Ryabinkin rea-fbsd at codelabs.ru
Fri May 1 19:40:01 UTC 2009


>Number:         134145
>Category:       ports
>Synopsis:       New port: devel/lxr, generic code cross-reference tool
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 01 19:40:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 7.2-PRERELEASE amd64
>Organization:
Code Labs
>Environment:

System: FreeBSD 7.2-PRERELEASE amd64

>Description:

There is no LXR software in the ports tree and some people would like
to have it.

>How-To-Repeat:

find /usr/ports -name lxr

>Fix:

The following SHAR archive contains the port.  I had just upgraded it to
the latest version, 0.9.6.  I lived with 0.9.5 for around a half a year
and seen no problems, so this port is more-or-less tested.

--- lxr.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	lxr
#	lxr/Makefile
#	lxr/distinfo
#	lxr/files
#	lxr/files/fix-perl-warnings.patch
#	lxr/files/pkg_message.in
#	lxr/files/pkg_message.mysql.in
#	lxr/files/pkg_message.postgresql.in
#	lxr/pkg-descr
#	lxr/pkg-plist
#
echo c - lxr
mkdir -p lxr > /dev/null 2>&1
echo x - lxr/Makefile
sed 's/^X//' >lxr/Makefile << '9ef6a2c252fa1ec24a6d5be0e53ec403'
X# Ports collection makefile for:	lxr
X# Date created:				11 Dec 2008
X# Whom:					Eygene Ryabinkin
X#
X# $FreeBSD$
X#
X
XPORTNAME=	lxr
XPORTVERSION=	0.9.6
XCATEGORIES=	devel
XMASTER_SITES=	SF
XEXTRACT_SUFX=	.tgz
X
XMAINTAINER=	rea-fbsd at codelabs.ru
XCOMMENT=	Source code indexer and cross-referencer
X
XBUILD_DEPENDS=	exctags:${PORTSDIR}/devel/ctags \
X		swish-e:${PORTSDIR}/www/swish-e \
X		${SITE_PERL}/File/MMagic.pm:${PORTSDIR}/devel/p5-File-MMagic
X
XPATCH_STRIP=	-p1
XEXTRA_PATCHES=	${PATCHDIR}/fix-perl-warnings.patch
X
XUSE_GZIP=	yes
XUSE_PERL5=	yes
XNO_BUILD=	yes
X
XOPTIONS=	POSTGRESQL	"Enable PostgreSQL support"		on \
X		MYSQL		"Enable MySQL support (untested)"	off
X
X# Name prefix for database tables, indexes, sequences and other stuff.
XDB_PREFIX=	lxr
X
X# Installation directory
X.if !defined(LXRDIR)
X.if defined(APACHE_DATADIR)
XLXRDIR=	${APACHE_DATADIR}/data/lxr
X.else
XLXRDIR=	${PREFIX}/www/data/lxr
X.endif # defined(APACHE_DATADIR)
X.endif # !defined(LXRDIR)
X
XPLIST_SUB+=	LXRDIR=${LXRDIR:S!^${PREFIX}/!!}
XSUB_LIST+=	LXRDIR=${LXRDIR}
X
X.include <bsd.port.pre.mk>
X
X.if defined(WITH_POSTGRESQL) && defined(WITH_MYSQL)
XIGNORE=		you must choose only one database backend
X.endif
X
X.if defined(WITH_POSTGRESQL)
XBUILD_DEPENDS+=	${SITE_PERL}/${PERL_ARCH}/DBD/Pg.pm:${PORTSDIR}/databases/p5-DBD-Pg
XMSG_FILES+=	pkg_message.postgresql
XDB_DRIVER=	Pg
X.endif # defined(WITH_POSTGRESQL)
X
X.if defined(WITH_MYSQL)
XBUILD_DEPENDS+=	${SITE_PERL}/DBD/mysql.pm:${PORTSDIR}/databases/p5-DBD-mysql
XMSG_FILES+=	pkg_message.mysql
XDB_DRIVER=	mysql
X.endif # defined(WITH_MYSQL)
X
XMSG_FILES+=	pkg_message
X
XSUB_FILES+=	${MSG_FILES}
X
XLXR_SCRIPTS=	diff \
X		find \
X		genxref \
X		ident \
X		search \
X		source
X
XLXR_CONF=	swish-e.conf \
X		initdb-postgres \
X		initdb-mysql
X
XLXR_DOCS=	BUGS \
X		CREDITS.txt \
X		ChangeLog \
X		HACKING \
X		INSTALL \
X		LICENSE \
X		RELEASING \
X		notes
X
Xpost-patch:
X	@${REINPLACE_CMD} \
X	    -e"s|'glimpsebin'|# 'glimpsebin'|" \
X	    -e"s|'glimpseindex'|# 'glimpseindex'|" \
X	    -e"s|'/usr/local/bin/swish-e'|'${LOCALBASE}/bin/swish-e'|" \
X	    -e"s|'/usr/bin/ctags'|'${LOCALBASE}/bin/exctags'|" \
X	    -e"s|'/path/to/lib/LXR/Lang/generic.conf'|'${SITE_PERL}/LXR/Lang/generic.conf'|" \
X	    -e"s|'/path/to/lib/LXR/Lang/ectags.conf'|'${SITE_PERL}/LXR/Lang/ectags.conf'|" \
X	    -e"s|'dbi:mysql:|'dbi:${DB_DRIVER}:|" \
X	    -e's|'lxr_'|'${DB_PREFIX}_'|g' \
X	    ${WRKSRC}/templates/lxr.conf && \
X	    ${RM} -f ${WRKSRC}/templates/lxr.conf.bak
X	@${REINPLACE_CMD} \
X	    -e's|lxr_|${DB_PREFIX}_|g' \
X	    ${WRKSRC}/initdb-postgres
X	@${REINPLACE_CMD} \
X	    -e's|lxr|${DB_PREFIX}|g' \
X	    ${WRKSRC}/initdb-mysql
X
Xdo-install:
X	${MKDIR} ${LXRDIR}
X.for f in ${LXR_SCRIPTS}
X	${INSTALL_SCRIPT} ${WRKSRC}/${f} ${LXRDIR}
X.endfor # ${LXR_SCRIPTS}
X.for f in ${LXR_CONF}
X	${INSTALL_DATA} ${WRKSRC}/${f} ${LXRDIR}
X.endfor # ${LXR_CONF}
X.if !defined(NOPORTDOCS)
X	${MKDIR} ${DOCSDIR}
X.for f in ${LXR_DOCS}
X	${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
X.endfor # ${LXR_DOCS}
X.endif # !defined(NOPORTDOCS)
X	${INSTALL_DATA} ${WRKSRC}/Local.pm ${SITE_PERL}
X	${MKDIR} ${PREFIX}/${SITE_PERL_REL}
X	${TAR} -C ${WRKSRC}/lib -cf - --exclude *.orig LXR | ${TAR} -C ${PREFIX}/${SITE_PERL_REL} -xf -
X	${TAR} -C ${WRKSRC} -cf - --exclude *.orig templates | ${TAR} -C ${LXRDIR} -xf -
X	${CHMOD} 640 ${LXRDIR}/templates/lxr.conf
X
Xpost-install:
X	@${ECHO}
X	@${ECHO} "******************** Installation tips ********************"
X	@${ECHO}
X.for f in ${MSG_FILES}
X	@${CAT} ${WRKDIR}/${f}
X.endfor # ${MSG_FILES}
X
X.include <bsd.port.post.mk>
9ef6a2c252fa1ec24a6d5be0e53ec403
echo x - lxr/distinfo
sed 's/^X//' >lxr/distinfo << 'f2fd14a9666df7d1ca01b14e90f08533'
XMD5 (lxr-0.9.6.tgz) = 2388d79c91d39063a41d99c7300615d1
XSHA256 (lxr-0.9.6.tgz) = 18c02e814da196b4d66809fb14ff260b20f2dd52c36e2453147a6a4609a1180d
XSIZE (lxr-0.9.6.tgz) = 97109
f2fd14a9666df7d1ca01b14e90f08533
echo c - lxr/files
mkdir -p lxr/files > /dev/null 2>&1
echo x - lxr/files/fix-perl-warnings.patch
sed 's/^X//' >lxr/files/fix-perl-warnings.patch << '5d4dc7b1830605d1b5e08d1b536d6338'
XFrom 5e71b7d7e7b4b7619b156b0fb13e52775ed17ccc Mon Sep 17 00:00:00 2001
XFrom: Eygene Ryabinkin <rea-fbsd at codelabs.ru>
XDate: Fri, 12 Dec 2008 19:26:20 +0300
XSubject: [PATCH] Fixed some warnings produced by 'perl -w'
X
XSigned-off-by: Eygene Ryabinkin <rea-fbsd at codelabs.ru>
X---
X lib/LXR/Common.pm         |   23 +++++++++++++++++------
X lib/LXR/Files/Plain.pm    |    1 +
X lib/LXR/Index/Postgres.pm |    6 ++++++
X 3 files changed, 24 insertions(+), 6 deletions(-)
X
Xdiff --git a/lib/LXR/Common.pm b/lib/LXR/Common.pm
Xindex fea8479..84f38e4 100644
X--- a/lib/LXR/Common.pm
X+++ b/lib/LXR/Common.pm
X@@ -120,6 +120,7 @@ sub fileref {
X 	# jwz: URL-quote any special characters.
X 	$path =~ s|([^-a-zA-Z0-9.\@/_\r\n])|sprintf("%%%02X", ord($1))|ge;
X 
X+	$line = -1 unless defined($line);
X 	if ($line > 0 && length($line) < 3) {
X 		$line = ('0' x (3 - length($line))) . $line;
X 	}
X@@ -134,7 +135,8 @@ sub diffref {
X 	my ($desc, $css, $path, $darg) = @_;
X 	my $dval;
X 
X-	($darg, $dval) = $darg =~ /(.*?)=(.*)/;
X+        ($darg, $dval) = (defined($darg) ?
X+	    $darg =~ /(.*?)=(.*)/ : (undef, undef));
X 	return ("<a class='$css' href=\"$config->{virtroot}/diff$path"
X 		  . &urlargs(($darg ? "diffvar=$darg" : ""), ($dval ? "diffval=$dval" : ""))
X 		  . "\"\>$desc</a>");
X@@ -280,6 +282,9 @@ sub markupfile {
X 		while (defined($frag)) {
X 			&markspecials($frag);
X 
X+			# Use value that won't match anything
X+			# in the next if-else for the undefined $btype
X+			$btype = '' unless (defined($btype));
X 			if ($btype eq 'comment') {
X 
X 				# Comment
X@@ -295,7 +300,6 @@ sub markupfile {
X 				# Include directive
X 				$lang->processinclude(\$frag, $dir);
X 			} else {
X-
X 				# Code
X 				$lang->processcode(\$frag);
X 			}
X@@ -371,6 +375,7 @@ sub markupfile {
X }
X 
X sub fixpaths {
X+	return '/' unless defined($_[0]);
X 	my $node = '/' . shift;
X 
X 	while ($node =~ s|/[^/]+/\.\./|/|g) { }
X@@ -473,7 +478,9 @@ sub httpinit {
X 	$HTTP->{'this_url'} = 'http://' . $ENV{'SERVER_NAME'};
X 	$HTTP->{'this_url'} .= ':' . $ENV{'SERVER_PORT'}
X 	  if $ENV{'SERVER_PORT'} != 80;
X-	$HTTP->{'this_url'} .= $ENV{'SCRIPT_NAME'} . $ENV{'PATH_INFO'};
X+	$HTTP->{'this_url'} .= $ENV{'SCRIPT_NAME'};
X+	$HTTP->{'this_url'} .= $ENV{'PATH_INFO'}
X+	    if defined($ENV{'PATH_INFO'});
X 	$HTTP->{'this_url'} .= '?' . $ENV{'QUERY_STRING'}
X 	  if $ENV{'QUERY_STRING'};
X 
X@@ -721,9 +728,13 @@ sub varlinks {
X 				$vallink = &idref($val, "varlink", $identifier, "$var=$val");
X 			} elsif ($who eq 'search') {
X 				$vallink =
X-				    "<a class=\"varlink\" href=\"$config->{virtroot}/search"
X-				  . &urlargs("$var=$val", "string=" . $HTTP->{'param'}->{'string'})
X-				  . "\">$val</a>";
X+				    "<a class=\"varlink\" href=\"$config->{virtroot}/search";
X+				if (defined($HTTP->{'param'}->{'string'})) {
X+                                        $vallink .= &urlargs("$var=$val",
X+                                            "string=" .
X+                                            $HTTP->{'param'}->{'string'});
X+                                }
X+                                $vallink .= "\">$val</a>";
X 			}
X 		}
X 
Xdiff --git a/lib/LXR/Files/Plain.pm b/lib/LXR/Files/Plain.pm
Xindex 27c5dee..ade40fd 100644
X--- a/lib/LXR/Files/Plain.pm
X+++ b/lib/LXR/Files/Plain.pm
X@@ -131,6 +131,7 @@ sub getdir {
X 
X sub toreal {
X 	my ($self, $pathname, $release) = @_;
X+	$release = "" unless defined($release);
X 
X # nearly all (if not all) method calls eventually call toreal(), so this is a good place to block file access
X 	foreach my $ignoredir ($config->ignoredirs) {
Xdiff --git a/lib/LXR/Index/Postgres.pm b/lib/LXR/Index/Postgres.pm
Xindex ae1e11f..4667036 100644
X--- a/lib/LXR/Index/Postgres.pm
X+++ b/lib/LXR/Index/Postgres.pm
X@@ -158,6 +158,9 @@ sub getindex {
X 	my ($self, $symname, $release) = @_;
X 	my ($rows, @ret);
X 
X+	$release = "" unless defined($release);
X+	return () unless defined($symname);
X+
X 	$rows = $indexes_select->execute("$symname", "$release");
X 
X 	while ($rows-- > 0) {
X@@ -175,6 +178,9 @@ sub getreference {
X 	my ($self, $symname, $release) = @_;
X 	my ($rows, @ret);
X 
X+	$release = "" unless defined($release);
X+	return () unless defined($symname);
X+
X 	$rows = $usage_select->execute("$symname", "$release");
X 
X 	while ($rows-- > 0) {
X-- 
X1.6.0.4
X
5d4dc7b1830605d1b5e08d1b536d6338
echo x - lxr/files/pkg_message.in
sed 's/^X//' >lxr/files/pkg_message.in << '8bb1f2ed7976e895dde7a613afc9356a'
XConfiguring LXR
X===============
X
XFirst-time installation
X-----------------------
X
XFor the first-time installations you should copy the template files
Xfor LXR to your installation
X
X cp %%LXRDIR%%/templates/* %%LXRDIR%%/
X
XThen you should glance over configuration file at
X %%LXRDIR%%/lxr.conf
X
XIt has some reasonable values for the helper programs, but you should
Xcustomize variables like 'baseurl', 'virtroot' and others.
X
XUpgrades
X--------
X
XYou should look at the contents of the directory
X %%LXRDIR%%/templates/
Xand possibly merge new stuff from it to the corresponding files in
X %%LXRDIR%%/
X
X
XHappy cross-referencing and code mining!
X
8bb1f2ed7976e895dde7a613afc9356a
echo x - lxr/files/pkg_message.mysql.in
sed 's/^X//' >lxr/files/pkg_message.mysql.in << '7e613226572927c146f23247bc8d78f0'
XMySQL setup
X===========
X
XRun 'mysql' and then read in the initdb-mysql file using
X'\. %%LXRDIR%%/initdb-mysql'.
X
XThis will create the database and a user called lxr with access
Xrights to the database.
X
7e613226572927c146f23247bc8d78f0
echo x - lxr/files/pkg_message.postgresql.in
sed 's/^X//' >lxr/files/pkg_message.postgresql.in << '18b50c74f6afc80c3f3df3135a14dd2e'
XPostgreSQL setup
X================
X
XCreate a user for lxr and give the user permission to create databases:
X           createuser -P lxr
XCreate a database for lxr:
X           createdb -O lxr lxr
XInitialise the database:
X           psql -U lxr lxr
X           \i %%LXRDIR%%/initdb-postgres
XJust ignore the errors about unimplemented functions.
X
18b50c74f6afc80c3f3df3135a14dd2e
echo x - lxr/pkg-descr
sed 's/^X//' >lxr/pkg-descr << 'c2f79c710b75f78b4e836ecef8997fe7'
XLXR -- Linux Cross-Reference
X
XA general purpose source code indexer and cross-referencer that
Xprovides web-based browsing of source code with links to the
Xdefinition and usage of any identifier.
X
XWWW: http://sourceforge.net/projects/lxr/
c2f79c710b75f78b4e836ecef8997fe7
echo x - lxr/pkg-plist
sed 's/^X//' >lxr/pkg-plist << 'e332403dfdc65cf4c312fb8db2b4edcc'
X%%LXRDIR%%/diff
X%%LXRDIR%%/find
X%%LXRDIR%%/genxref
X%%LXRDIR%%/ident
X%%LXRDIR%%/search
X%%LXRDIR%%/source
X%%LXRDIR%%/swish-e.conf
X%%LXRDIR%%/initdb-postgres
X%%LXRDIR%%/initdb-mysql
X%%LXRDIR%%/templates/html-dir.html
X%%LXRDIR%%/templates/html-find.html
X%%LXRDIR%%/templates/html-head.html
X%%LXRDIR%%/templates/html-ident-refs.html
X%%LXRDIR%%/templates/html-ident.html
X%%LXRDIR%%/templates/html-search-glimpse.html
X%%LXRDIR%%/templates/html-search-swish.html
X%%LXRDIR%%/templates/html-tail.html
X%%LXRDIR%%/templates/lxr.conf
X%%LXRDIR%%/templates/lxr.css
X%%PORTDOCS%%%%DOCSDIR%%/BUGS
X%%PORTDOCS%%%%DOCSDIR%%/CREDITS.txt
X%%PORTDOCS%%%%DOCSDIR%%/ChangeLog
X%%PORTDOCS%%%%DOCSDIR%%/HACKING
X%%PORTDOCS%%%%DOCSDIR%%/INSTALL
X%%PORTDOCS%%%%DOCSDIR%%/LICENSE
X%%PORTDOCS%%%%DOCSDIR%%/RELEASING
X%%PORTDOCS%%%%DOCSDIR%%/notes
X%%SITE_PERL%%/LXR/Files/Plain.pm
X%%SITE_PERL%%/LXR/Files/BK.pm
X%%SITE_PERL%%/LXR/Files/CVS.pm
X%%SITE_PERL%%/LXR/Files/GIT.pm
X%%SITE_PERL%%/LXR/Common.pm
X%%SITE_PERL%%/LXR/Config.pm
X%%SITE_PERL%%/LXR/Files.pm
X%%SITE_PERL%%/LXR/Index.pm
X%%SITE_PERL%%/LXR/Lang.pm
X%%SITE_PERL%%/LXR/SimpleParse.pm
X%%SITE_PERL%%/LXR/Tagger.pm
X%%SITE_PERL%%/LXR/Index/Mysql.pm
X%%SITE_PERL%%/LXR/Index/DB.pm
X%%SITE_PERL%%/LXR/Index/DBI.pm
X%%SITE_PERL%%/LXR/Index/Oracle.pm
X%%SITE_PERL%%/LXR/Index/Postgres.pm
X%%SITE_PERL%%/LXR/Lang/Cobol.pm
X%%SITE_PERL%%/LXR/Lang/Generic.pm
X%%SITE_PERL%%/LXR/Lang/Java.pm
X%%SITE_PERL%%/LXR/Lang/Perl.pm
X%%SITE_PERL%%/LXR/Lang/Python.pm
X%%SITE_PERL%%/LXR/Lang/ectags.conf
X%%SITE_PERL%%/LXR/Lang/ectags.conf.documentation
X%%SITE_PERL%%/LXR/Lang/generic.conf
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
X at dirrm %%SITE_PERL%%/LXR/Files
X at dirrm %%SITE_PERL%%/LXR/Lang
X at dirrm %%SITE_PERL%%/LXR/Index
X at dirrm %%SITE_PERL%%/LXR
X at dirrm %%LXRDIR%%/templates
X at dirrmtry %%LXRDIR%%
e332403dfdc65cf4c312fb8db2b4edcc
exit
--- lxr.shar ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list