Tree


.gitignorecommits | blame
.rustfmt.tomlcommits | blame
LICENSEcommits | blame
Makefilecommits | blame
README.mdcommits | blame
assets/
wp.1commits | blame
wp.rscommits | blame

README.md

wp - where OpenBSD ports
========================
wp generates a static HTML site for browsing OpenBSD ports.
No JavaScript, works in lynx. Includes built-in CGI search.

Requirements
------------
- rustc

Building
--------
Edit Makefile to match your local setup (wp is installed
into the /usr/local/bin namespace by default).

Afterwards enter the following command to build and install
wp (if necessary as root):

    make
    make install

Running
-------
    wp -p /usr/ports -o /var/www/htdocs/ports

Options:
  -p portsdir   path to ports tree (default: /usr/ports)
  -o outdir     output directory (default: ./site)
  -d dump       use dump-vars output instead of parsing Makefiles

Search
------
wp has built-in CGI support. When the QUERY_STRING environment
variable is set, wp acts as a CGI program: it reads INDEX.txt
from the current directory and returns search results as HTML.

The search matches port names, descriptions, and maintainers.

CGI setup with httpd(8)
-----------------------
Generate the site:

    wp -p /usr/ports -o /var/www/htdocs/ports

Copy the binary and INDEX.txt into the chroot:

    cp /usr/local/bin/wp /var/www/cgi-bin/search.cgi
    cp /var/www/htdocs/ports/INDEX.txt /var/www/cgi-bin/INDEX.txt

OpenBSD does not support static binaries. Copy the required
shared libraries into the chroot:

    mkdir -p /var/www/usr/lib /var/www/usr/libexec
    cp /usr/lib/libc.so.* /var/www/usr/lib/
    cp /usr/lib/libm.so.* /var/www/usr/lib/
    cp /usr/lib/libpthread.so.* /var/www/usr/lib/
    cp /usr/lib/libc++abi.so.* /var/www/usr/lib/
    cp /usr/libexec/ld.so /var/www/usr/libexec/

Configure httpd.conf(5):

    server "ports.example.com" {
        listen on * port 80
        root "/htdocs/ports"
        location "/search.cgi" {
            fastcgi socket "/run/slowcgi.sock"
            root "/"
        }
    }

Enable and start slowcgi(8):

    rcctl enable slowcgi
    rcctl start slowcgi
    rcctl reload httpd

License
-------
ISC - see LICENSE.