# OpenWebSpider on BSD

OpenWebSpider can now build directly on FreeBSD, OpenBSD, and NetBSD. The
project Makefile detects each system with `uname -s`, uses the local package
prefix for `pkg-config`, compiles in a package-manager friendly configuration
directory, and installs into staged package roots with `DESTDIR`.

## Dependencies

Install binary packages first. Use ports/pkgsrc when you need a source build, a
local patch, or a package recipe.

FreeBSD:

```sh
pkg install gmake pkgconf mariadb-connector-c openssl zlib poppler-utils ffmpeg
```

OpenBSD:

```sh
pkg_add gmake pkgconf mariadb-client openssl zlib poppler-utils ffmpeg
```

NetBSD:

```sh
pkgin install gmake pkgconf mariadb-client openssl zlib poppler-utils ffmpeg
```

`poppler-utils` provides `pdftotext` and `pdfinfo`; `ffmpeg` provides
`ffprobe`.

## Build

Use GNU make because the project Makefile uses GNU make conditionals:

```sh
gmake
```

Or call the platform aliases explicitly:

```sh
gmake freebsd
gmake openbsd
gmake netbsd
```

On NetBSD, dependencies usually live below `/usr/pkg`; the Makefile defaults
`LOCALBASE` accordingly. Override it when your package prefix is different:

```sh
gmake LOCALBASE=/opt/pkg
```

By default, local builds look for runtime configuration in
`$(PREFIX)/etc/openwebspider` after trying the current directory. Package
recipes can override this at compile time:

```sh
gmake CONFIG_CFLAGS='-DOWS_SYSCONFDIR=\"/etc/openwebspider\"'
```

## Install

For a direct local install:

```sh
gmake install PREFIX=/usr/local
```

For packaging/staging:

```sh
gmake install PREFIX=/usr/local DESTDIR=/tmp/openwebspider-stage
```

The install target places the executable in `bin`, modules in
`lib/openwebspider`, and sample configuration in the selected `SYSCONFDIR`.

## FreeBSD

FreeBSD users should normally install the binary package with `pkg install`
when one is available. The skeleton under `packaging/freebsd/openwebspider`
models the ports path: it builds with `gmake`, stages via `DESTDIR`, installs
sample configuration below `${ETCDIR}`, and compiles that same directory into
the executable/modules.

## OpenBSD

OpenBSD users should normally use `pkg_add` packages. The skeleton under
`packaging/openbsd/openwebspider` keeps ports-specific work in the ports tree
shape: Makefile, dependency metadata, fake install staging, PLIST, and sample
configuration under `${SYSCONFDIR}/openwebspider`.

## NetBSD

NetBSD users normally consume pkgsrc binary packages, while pkgsrc handles
source builds in a portable way. The skeleton under
`packaging/netbsd/openwebspider` stages sample files under
`share/examples/openwebspider`, declares `CONF_FILES`, and compiles the runtime
lookup path as `${PKG_SYSCONFDIR}`.

## Package Recipe Skeletons

The repository includes starter recipes for the three BSD packaging worlds:

- `packaging/freebsd/openwebspider`
- `packaging/openbsd/openwebspider`
- `packaging/netbsd/openwebspider`

They are intentionally small and point at the project Makefile. Before sending
them upstream, fill in the final `MASTER_SITES`, maintainer, checksums, and any
platform-specific dependency package names required by the target ports tree.
