#!/bin/sh # SPDX-License-Identifier: MIT # Builds openpu--1-x86_64.hpkg on Haiku from the working tree: release build, staged # install (apps/OpenPU, bin/openpu-cli, data/locale, Deskbar link), .PackageInfo, `package create`. # The HaikuPorts recipe (packaging/haiku) is the way to publish; this script is for testing and # for attaching a package to a GitHub release. # # usage: tools/haiku-package.sh [build-dir] (output in the current directory) set -eu SRC=$(cd "$(dirname "$0")/.." && pwd) BUILD=${1:-$SRC/../build-openpu/hpkg} OUT=$(pwd) ARCH=$(getarch) STAGE=$BUILD/stage cmake -S "$SRC" -B "$BUILD" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/boot/system \ -DOPENPU_BUILD_TESTS=OFF cmake --build "$BUILD" rm -rf "$STAGE" # Files are staged relative to the installation location (the package's root). cmake --install "$BUILD" --strip --prefix "$STAGE" # Package versions cannot contain '+' or '.' after the micro number: a development build # 0.2.0+3.gabc1234.dirty becomes 0.2.0_git3_gabc1234_dirty; a tagged build stays 0.2.0. DESCRIPTION=$("$STAGE/bin/openpu-cli" --version | awk '{print $2}') VERSION=$(echo "$DESCRIPTION" | sed -e 's/+/_git/' -e 's/\./_/3g') cat > "$STAGE/.PackageInfo" <" vendor "OpenPU contributors" licenses { "MIT" } copyrights { "2026 yann64 and the OpenPU contributors" } urls { "https://github.com/yann64/openpu" } provides { openpu = $VERSION app:OpenPU = $VERSION cmd:openpu_cli = $VERSION } requires { haiku >= r1~beta6 lib:libarchive >= 13 lib:libcurl >= 4 lib:libgcc_s >= 1 lib:libintl >= 8 lib:libstdc++ } EOF PACKAGE=$OUT/openpu-$VERSION-1-$ARCH.hpkg rm -f "$PACKAGE" package create -C "$STAGE" "$PACKAGE" package list "$PACKAGE"