#!/bin/bash # Build script for Coral package manager # # Builds coral from source tarball using Reef compiler set -e # Find source directory — SRCDIR from coral, or auto-detect if [ -z "$SRCDIR" ] || [ ! -d "$SRCDIR" ]; then WORKDIR="${SRCDIR:-$(pwd)}" SRCDIR="$(cd "$WORKDIR" && ls -d */ 2>/dev/null | head -1)" SRCDIR="${WORKDIR}/${SRCDIR%/}" fi cd "$SRCDIR" # Set up Reef environment (bootstrap installs to /usr) export PATH="/usr/bin:$PATH" export LIBRARY_PATH="/usr/lib/reef/runtime/lib:/usr/lib:${LIBRARY_PATH:-}" # Build with illumos socket libraries explicitly echo "Building Coral..." reefc build -l socket -l nsl # Find the built binary (named after directory) BINARY=$(ls build/coral* 2>/dev/null | head -1) if [ -z "$BINARY" ]; then echo "Error: No binary found in build/" exit 1 fi echo "Built binary: $BINARY" # Install mkdir -p "$PKGDIR$PREFIX/bin" cp "$BINARY" "$PKGDIR$PREFIX/bin/coral" chmod +x "$PKGDIR$PREFIX/bin/coral" # Create initial config directory structure mkdir -p "$PKGDIR$SYSCONFDIR/coral" mkdir -p "$PKGDIR/var/lib/coral/installed" mkdir -p "$PKGDIR/var/lib/coral/packages" mkdir -p "$PKGDIR/var/lib/coral/sources" mkdir -p "$PKGDIR/var/lib/coral/trusted-keys" mkdir -p "$PKGDIR/var/tmp/coral/work" mkdir -p "$PKGDIR/var/tmp/coral/pkg" # Coral - Package manager for Zygaena # https://git.sharkos.one/zygaena/coral [package] name = "coral" version = "0.4.5" release = 1 description = "Package manager for Zygaena, written in Reef" url = "https://git.sharkos.one/zygaena/coral" license = "BSD-2-Clause" maintainer = "Chris Tusa " arch = "x86_64" [dependencies] runtime = ["reef"] build = ["reef"] [[source]] file = "coral-0.4.5-source.tar.xz" urls = ["coral-0.4.5-source.tar.xz"] checksum = "ea8ad5f63cbc80f939593a661aa4a9bc592f024077feb64e91a85b4cc3f1d6f1" extract = true [build] parallel = false