$OpenBSD$

+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
+-----------------------------------------------------------------------

# Author: Mattieu Baptiste <mattieu@brimbelle.org>

In order to make cvsweb operate in a chroot environment, it is
necessary to copy all of the relevant tools, libraries, and perl modules
that cvsweb employs into /var/www.

First, create the basic directory structure:

$ cd /var/www
# mkdir etc tmp usr var
# chown www:www tmp	(needs to be writeable for the www user)

$ cd /var/www/usr
# mkdir -p {bin,lib,libdata/perl5,libexec,local,X11R6/lib}

$ cd /var/www/usr/libdata/perl5
# mkdir -p {CGI,File,IPC,Time,warnings,`machine`-openbsd/5.12.2/auto}

$ cd /var/www/usr/local
# mkdir -p {bin,lib,libdata/perl5/site_perl,share/enscript}

$ cd /var/www/usr/local/libdata/perl5/site_perl
# mkdir -p `machine`-openbsd/auto

$ cd /var/www/var
# mkdir -p run

The "annotate" function requires this empty file:

NOTE: You can create an actual null device instead, but that will
not work if the filesystem is mounted with the nodev option, and
it is not required for cvsweb.

$ cd /var/www/dev
# touch null

Now, the required binaries:

$ cd /var/www/usr/bin
# cp -p /usr/bin/{co,cvs,diff,perl,rcsdiff,rlog,uname} .

Next, the libraries that the binaries are linked to:

NOTE: Wildcards will, of course, copy any old, unused libraries that are
lurking around (for example, from an upgrade):

$ cd /var/www/usr/lib
# cp -p /usr/lib/lib{c,crypto,gssapi,krb5,m,perl,util,z}.so* .

Now, the run-time link-editor:

$ cd /var/www/usr/libexec
# cp -p /usr/libexec/ld.so .

And finally, the perl modules:

$ cd /var/www/usr/libdata/perl5
# cp -pR /usr/libdata/perl5/{File,CGI,IPC,Time,warnings,Term,Carp,Exporter} .
# cp -pR /usr/libdata/perl5/{Tie,overload} .
# cp -p /usr/libdata/perl5/{CGI,Carp,Exporter,warnings}.pm .
# cp -p /usr/libdata/perl5/{base,integer,Symbol,constant,vars,strict}.pm .
# cp -p /usr/libdata/perl5/{filetest,XSLoader,AutoLoader,SelectSaver}.pm .
# cp -p /usr/libdata/perl5/{bytes,overload,UNIVERSAL,utf8}.pm .
# cp -p /usr/libdata/perl5/{perl5db,bytes_heavy,utf8_heavy}.pl .

$ cd /var/www/usr/libdata/perl5/`machine`-openbsd/5.12.2
# cp -pR /usr/libdata/perl5/`machine`-openbsd/5.12.2/{Compress,File,IO,List} .
# cp -pR /usr/libdata/perl5/`machine`-openbsd/5.12.2/Scalar .
# cp -p /usr/libdata/perl5/`machine`-openbsd/5.12.2/{Config,Cwd,re}.pm .
# cp -p /usr/libdata/perl5/`machine`-openbsd/5.12.2/{DynaLoader,Errno}.pm .
# cp -p /usr/libdata/perl5/`machine`-openbsd/5.12.2/{Fcntl,IO,POSIX}.pm .
# cp -p /usr/libdata/perl5/`machine`-openbsd/5.12.2/Config_heavy.pl .
# cp -p /usr/libdata/perl5/`machine`-openbsd/5.12.2/Config_git.pl .

$ cd /var/www/usr/libdata/perl5/`machine`-openbsd/5.12.2/auto
# cp -pR /usr/libdata/perl5/`machine`-openbsd/5.12.2/auto/{re,Fcntl,IO} .
# cp -pR /usr/libdata/perl5/`machine`-openbsd/5.12.2/auto/{POSIX,Cwd,List} .
# cp -pR /usr/libdata/perl5/`machine`-openbsd/5.12.2/auto/{File,DynaLoader} .
# cp -pR /usr/libdata/perl5/`machine`-openbsd/5.12.2/auto/Compress .

$ cd /var/www/usr/local/libdata/perl5/site_perl
# cp -pR /usr/local/libdata/perl5/site_perl/{IPC,URI} .
# cp -pR /usr/local/libdata/perl5/site_perl/URI.pm .


Optional
--------

1) p5-String-Ediff
------------------

If you want nicer colored diff lines, install p5-String-Ediff and:

$ cd /var/www/usr/local/libdata/perl5/site_perl/`machine`-openbsd
# cp -pR /usr/local/libdata/perl5/site_perl/`machine`-openbsd/String .

$ cd /var/www/usr/local/libdata/perl5/site_perl/`machine`-openbsd/auto
# cp -pR /usr/local/libdata/perl5/site_perl/`machine`-openbsd/auto/String .


2) p5-MIME-Types
----------------

If you want cvsweb to lookup MIME types, install p5-MIME-Types and:

# cp -pR /usr/local/libdata/perl5/site_perl/MIME .


3) enscript
-----------

cvsweb can use enscript to display nice colored diffs. Install enscript and:

Copy the required enscript binaries:

$ cd /var/www/usr/local/bin
# cp -p /usr/local/bin/{enscript,states} .

Next, the libraries that the binaries are linked to:

$ cd /var/www/usr/lib
# cp -p /usr/lib/lib{c,m}.so* .

Then, create a master.passwd file and its structure:

$ cd /var/www/etc
# cp -p /etc/master.passwd .

Edit master.passwd to not show system accounts other than www.

# pwd_mkdb -d /var/www/etc /var/www/etc/master.passwd

Copy config file needed by enscript:

$ cd /var/www/etc
# cp -p /etc/enscript.cfg .

Copy the various enscript data files:

$ cd /var/www/usr/local/share/enscript
# cp -pR /usr/local/share/enscript/* .

Copy the cvsweb highlighting styles:
$ cd /var/www/usr/local/share/enscript/hl
# cp -p /usr/local/share/enscript/hl/lang_cvsweb{,_diff}.st .

Copy the sh shell:
$ cd /var/www/bin
# cp -p /bin/sh .

Finally, edit cvsweb.conf and change the variable $allow_enscript.


4) cvsgraph
-----------

cvsweb can use cvsgraph to render nice graphs of file revisions.
Install cvsgraph and:

Copy the required cvsgraph binary:

$ cd /var/www/usr/local/bin
# cp -p /usr/local/bin/cvsgraph .

Next, the libraries that the binary is linked to:

$ cd /var/www/usr/lib
# cp -p /usr/lib/lib{c,m,z,expat}.so* .

$ cd /var/www/usr/X11R6/lib
# cp -p /usr/X11R6/lib/lib{fontconfig,freetype}.so* .

$ cd /var/www/usr/local/lib
# cp -p /usr/local/lib/lib{png,jpeg,iconv,gd,fontconfig,freetype}.so* .

Finally, the library location hints:

$ cd /var/www/var/run
# cp /var/run/ld.so.hints .


Editing cvsweb and cvsweb.conf
------------------------------

Change CVSrepositories to reflect the location of the directories which
contain CVSROOT.  This example shows a local repository NFS mounted over
loopback into /var/www/cvs, since the directory must be relative to
/var/www, we use /cvs.

@CVSrepositories = (
	'local'   => ['Local Repository', '/home/cvs'],	      (default)
	'local'   => ['Local Repository', '/cvs'],	      (chroot)

The cvsweb program has a stylesheet in /var/www/cvsweb/cvsweb.css. You can link
to it by:

$ cd /var/www/htdocs
# ln -s ../cvsweb cvsweb
