dosbox-staging/docs/build-openbsd.md
kcgen 685eb22d67 Add BSD build notes and dependencies
Also makes a couple minor compatibility fixes:

 - OpenBSD's thread name in Loguru

 - Update headers for the BSDs
2023-03-21 10:05:44 -07:00

2.5 KiB

Building on OpenBSD

OpenBSD builds can be created with Clang using the Meson build system.

Before getting started, you should know that OpenBSD isn't fully supported or used by the current maintainers. It's been lightly tested on a big-endian PowerPC system.

Pre-requisites

Expand the systems' memory limits

The LLVM link process will map more virtual memory than OpenBSD normally grants to user processes, so it's recommended to open up these limits by editing /etc/login.conf with your root account:

Change the two default datasize- fields to infinity, as follows:

default:\
  ...
  :datasize-max=infinity:\
  :datasize-cur=infinity:\
  ...

This change allowed the link process to successfully run on an Apple Powerbook G4 with only 2 GB of physical RAM.

Setup your bin path

In order to run Python PIP-installed programs, we link ~/.local/bin to ~/bin, which is in OpenBSD's default user PATH:

ln -s .local/bin ~/bin

Consider a wxallowed mount-point on slow hardware

If your platform is old or slow (such as 32-bit PowerPC, MIPS, or 32-bit ARM SBC), then you might benefit by disabling per-page W^X permission flagging.

If so:

  1. Read the about the per-page W^X permission build option in the meson_options.txt, and consider comparing builds.

  2. If you do make a build without per-page W^X (-Dper_page_w_or_x=disabled) your binary needs to reside within a filesystem mounted with the wxallowed flag. This is OpenBSD-specific, where as the other BSDs don't have this requirement.

    The good news is that OpenBSD mounts /usr/local with the wxallowed flag by default, so the easiest option is to simply place your build tree under there, for example: /usr/local/src/dosbox-staging.

    Alternatively, you can edit /etc/fstab and add the wxallowed mount flag the filesystem where your build tree resides.

If you're on a fast 64-bit platform or are using per-page W^X, then your binary will run anywhere and you can skip this.

Build instructions

Clone and enter the repository:

git clone https://github.com/dosbox-staging/dosbox-staging.git
cd dosbox-staging

Install dependencies:

pkg_add $(cat packages/openbsd.txt)
pip install meson

Build:

meson setup build
ninja -C build

To learn more about Meson's build options, see BUILD.md.

Run

Your binary is build/dosbox, which you can link into your ~/bin/ path:

ln -s $PWD/build/dosbox ~/bin/dosbox-staging