From a495aefe83ebc671bfff2ee77792bb72a8c83ce8 Mon Sep 17 00:00:00 2001 From: kcgen <1557255+kcgen@users.noreply.github.com> Date: Fri, 8 May 2020 09:33:34 -0700 Subject: [PATCH] Add Haiku OS support to build system --- configure.ac | 6 ++ scripts/automator/build/clang-haiku_x86_64 | 1 + scripts/automator/build/gcc-haiku_x86_64 | 7 +++ scripts/automator/build/os-haiku | 10 ++++ scripts/automator/packages/clang-haikuports | 1 + scripts/automator/packages/manager-haikuports | 6 ++ scripts/build.md | 57 ++++++++++++++----- 7 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 scripts/automator/build/clang-haiku_x86_64 create mode 100644 scripts/automator/build/gcc-haiku_x86_64 create mode 100644 scripts/automator/build/os-haiku create mode 100644 scripts/automator/packages/clang-haikuports create mode 100644 scripts/automator/packages/manager-haikuports diff --git a/configure.ac b/configure.ac index 78a2dcac..1f5a5e87 100644 --- a/configure.ac +++ b/configure.ac @@ -475,6 +475,12 @@ if test x$enable_network = xyes ; then AC_DEFINE(C_MODEM,1) AC_DEFINE(C_IPX,1) AC_MSG_RESULT([yes]) + case "$host_os" in haiku*) + AC_CHECK_LIB(network, socket, [], + [AC_MSG_ERROR([Can't find a useable network libary])], + -l network) + ;; + esac else AC_MSG_WARN([Can't find SDL_net, internal modem and ipx disabled]) fi diff --git a/scripts/automator/build/clang-haiku_x86_64 b/scripts/automator/build/clang-haiku_x86_64 new file mode 100644 index 00000000..b69bcf4b --- /dev/null +++ b/scripts/automator/build/clang-haiku_x86_64 @@ -0,0 +1 @@ +ld="ld" diff --git a/scripts/automator/build/gcc-haiku_x86_64 b/scripts/automator/build/gcc-haiku_x86_64 new file mode 100644 index 00000000..d9452b24 --- /dev/null +++ b/scripts/automator/build/gcc-haiku_x86_64 @@ -0,0 +1,7 @@ +# Tool additions +ldflags+=(-Wl,--as-needed) + +# Enable math vectorizions using instructions avaiable in circa-2008+ CPUs +x86_math=(-mfpmath=sse -msse4.2) +cflags_release+=("${x86_math[@]}") +cflags_optinfo+=("${x86_math[@]}") diff --git a/scripts/automator/build/os-haiku b/scripts/automator/build/os-haiku new file mode 100644 index 00000000..34d36624 --- /dev/null +++ b/scripts/automator/build/os-haiku @@ -0,0 +1,10 @@ +cflags+=(-fPIC) + +function make_binary() { + make \ + --jobs="$(nproc)" \ + --output-sync=line \ + |& tee build.log +} + +dependencies=(objdump -afp "${executable}") diff --git a/scripts/automator/packages/clang-haikuports b/scripts/automator/packages/clang-haikuports new file mode 100644 index 00000000..95253eb3 --- /dev/null +++ b/scripts/automator/packages/clang-haikuports @@ -0,0 +1 @@ +compiler=(llvm${postfix}_clang) diff --git a/scripts/automator/packages/manager-haikuports b/scripts/automator/packages/manager-haikuports new file mode 100644 index 00000000..1799f043 --- /dev/null +++ b/scripts/automator/packages/manager-haikuports @@ -0,0 +1,6 @@ +# Package repo: https://depot.haiku-os.org +delim="" +packages+=(ccache coreutils autoconf automake autoconf_archive + pkgconfig libpng ncurses6_devel libsdl2_devel + sdl2_net_devel libogg_devel opus_devel opusfile_devel + gcc_syslibs_devel opus_tools) diff --git a/scripts/build.md b/scripts/build.md index b05a4838..927f7b03 100644 --- a/scripts/build.md +++ b/scripts/build.md @@ -1,17 +1,19 @@ -# DOSBox Build Script +# Build Script -This script builds DOSBox with your choice of compiler, release type, and -additional options. It runs on MacOS, Linux, and Windows. +This script builds `dosbox-staging` with your choice of compiler, release +type, and additional options. It runs on MacOS, Linux, Windows, and possibly +other operating systems. -If this is your first time building DOSBox, then you will need to install -DOSBox's development tools and dependencies, which is included in the notes -below. +If this is your first time building dosbox-staging, then you will need to +install its development tools and dependencies, which is covered in the +notes below. ## Requirements - **Windows newer than XP** - **NTFS-based C:**, because msys2 doesn't work on FAT filesystems - **MacOS** 10.x +- **Haiku** up-to-date - **Ubuntu** 16.04 or newer - **Fedora** up-to-date - **RedHat or CentOS** 7 or newer @@ -81,13 +83,13 @@ agreed to: 1. Download and install brew per the instructions here: 1. Update it with: `brew update` 1. Install git with: `brew install git` -1. Install DOSBox dependencies: +1. Install dosbox-staging dependencies: `brew install $(./scripts/list-build-dependencies.sh -p brew)` ### MacPorts Installation -1. Build and install MacPorts along with DOSBox dependencies with the following - sequence: +1. Build and install MacPorts along with dosbox-staging dependencies with the + following sequence: ``` shell git clone --quiet --depth=1 https://github.com/macports/macports-base.git @@ -101,12 +103,12 @@ agreed to: sudo port -q install $(/scripts/list-build-dependencies.sh -p macports) ``` -### Build DOSBox (common for all of the above) +### Build dosbox-staging (common for all of the above) 1. Clone the repository: `git clone https://github.com/dreamer/dosbox-staging.git` 1. Change directories into the repo: `cd dosbox-staging` -1. Build DOSBox: +1. Build: - Clang: `./scripts/build.sh --compiler clang -t release --bin-path /usr/local/bin` @@ -125,12 +127,41 @@ agreed to: in this example: `sudo apt install -y $(./scripts/list-build-dependencies.sh -p apt)` For other supported package managers, run: `./scripts/list-build-dependencies.sh --help` -1. Build DOSBox: +1. Build: - Clang: `./scripts/build.sh --compiler clang -t release -v 9` - GCC (default version): `./scripts/build.sh -c gcc -t release` - GCC (specific version, ie: 9): `./scripts/build.sh -c gcc -v 9 -t release` +## Haiku Installation + +1. Clone the repository: `git clone + https://github.com/dreamer/dosbox-staging.git` +1. Change directories into the repo: `cd dosbox-staging` +1. (🏁 first-time-only) Install dependencies: + + `pkgman install -y $(./scripts/list-build-dependencies.sh + -c clang -v 9 -p haikuports)` +1. Build an optimized binary: + +- Clang: `./scripts/build.sh --compiler clang -t + release -m lto --prefix=$HOME/config/non-packaged` +- GCC: `./scripts/build.sh -c gcc -t release + --prefix=$HOME/config/non-packaged` +1. Build a debug binary: + +- Clang: `./scripts/build.sh --compiler clang -t debug + --prefix=$HOME/config/non-packaged` +- GCC: `./scripts/build.sh -c gcc -t debug + --prefix=$HOME/config/non-packaged` +1. Install: `make install` +1. Set the emulation core type to ***normal*** by editing your config file + `dosbox -editconf` and setting `core = normal` in the `[cpu]` section. +1. You may now run `dosbox` inside any directory in your Terminal. + +Note: `texture*` output is not available under Haiku; use the default +`opengl*` output options instead. + ## Additional Tips ### Compiler variations @@ -305,7 +336,7 @@ Procedures: Repeat this for multiple training runs, each time saving the output to a new `-o samples-N.prof` file. Ideally you want to exercise all code paths in - DOSBox (core types, video cards, video modes, sound cards, and audio + dosbox-staging (core types, video cards, video modes, sound cards, and audio codecs). 1. Convert your sample profiles into compiler-specific records using tools