# OpenWebSpider on IBM Platforms

This port covers three different IBM targets:

- IBM Z: Linux on s390x. z/OS is not covered by this port.
- IBM AIX: AIX with the Toolbox/freeware style dependency prefix.
- IBM i: PASE under `/QOpenSys`, not native ILE/EBCDIC compilation.

OpenWebSpider is a POSIX C application with loadable modules. The IBM support
therefore focuses on 64-bit builds, package-manager prefixes, runtime config
lookup, and dynamic module loading.

## IBM Z

IBM Z is an architecture, not a single operating system. For OpenWebSpider the
supported path is Linux on s390x, using the existing Linux code path plus an
`OWS_IBM_Z` build define when `uname -m` reports `s390` or `s390x`.

Install dependencies with your distribution package manager. Package names vary
between RHEL, SLES, Ubuntu, and Debian, but you need:

```sh
gcc make pkgconf mariadb-connector-c-devel openssl-devel zlib-devel poppler-utils ffmpeg
```

Build:

```sh
make ibmz
```

For RPM builds, the skeleton uses `%{_libdir}` so modules land in the correct
`lib` or `lib64` directory for the distribution.

Package starter:

```text
packaging/ibm-z/rpm/openwebspider.spec
```

## IBM AIX

AIX builds use the `AIX` `uname -s` branch. The Makefile defaults
`PREFIX=/opt/freeware`, `LOCALBASE=/opt/freeware`, `OBJECT_MODE=64`, enables
`_ALL_SOURCE`, `_THREAD_SAFE`, large files, and runtime linking flags used by
`dlopen`.

Install dependencies from AIX Toolbox or your site package mirror:

```sh
dnf install gcc make pkg-config mariadb-connector-c-devel openssl-devel zlib-devel poppler-utils ffmpeg
```

Build:

```sh
gmake aix
```

The default assumes the AIX Toolbox GCC-style toolchain. If your site uses IBM
XL C, override the compiler and the few GCC-style flags:

```sh
gmake aix CC=xlc_r COMMON_CFLAGS='-O2' PIC_CFLAGS='-qpic' \
  SHARED='-qmkshrobj' MODULE_LDFLAGS='-Wl,-brtl -Wl,-bexpall'
```

If your AIX linker/compiler needs a different shared-library command, override
`SHARED`, `MODULE_LDFLAGS`, or `EXPORT_DYNAMIC` rather than editing the
Makefile.

Package starter:

```text
packaging/aix/rpm/openwebspider.spec
```

## IBM i

The supported IBM i path is PASE. Native ILE builds are not supported by this
port because the crawler assumes POSIX sockets, `dlopen`, pthreads, and ASCII
compatible runtime behavior.

Install dependencies from the IBM i Open Source Package Management environment:

```sh
yum install gcc make pkg-config mariadb-connector-c-devel openssl-devel zlib-devel poppler-utils ffmpeg
```

Build from a PASE shell:

```sh
gmake ibmi
```

The Makefile uses `UNAME_S=OS400` for IBM i PASE and defaults
`PREFIX=/QOpenSys/pkgs`, `LOCALBASE=/QOpenSys/pkgs`, and `OBJECT_MODE=64`.
Runtime configuration is compiled to `$(PREFIX)/etc/openwebspider` unless you
override `SYSCONFDIR`.

Run the build in a PASE environment with an ASCII/UTF-8 compatible locale. The
port does not attempt EBCDIC source conversion for native ILE compilers.

Package/helper starter:

```text
packaging/ibmi/README.md
packaging/ibmi/openwebspider.spec
```

## Install

All three targets share the same staging-friendly install target:

```sh
gmake install DESTDIR=/tmp/openwebspider-stage
```

Installed layout:

- `bin/openwebspider`
- `lib/openwebspider/*.so`
- `etc/openwebspider/*.conf.sample`

OpenWebSpider first checks the current directory for configuration files and
then falls back to the compiled `OWS_SYSCONFDIR`.
