#!/bin/zsh # Build script for Reef programming language set -e cd "$SRCDIR" export PATH="$PREFIX/bin:$PATH" # dune-installed libs live in $PREFIX/lib, not $PREFIX/lib/ocaml export OCAMLPATH="$PREFIX/lib:${OCAMLPATH:-}" # Force 64-bit compilation for the runtime export CC="gcc -m64" export CXX="g++ -m64" export CFLAGS="-m64 -O2" export CXXFLAGS="-m64 -O2" export LDFLAGS="-m64 $LDFLAGS" # Library paths (hammerhead BSD layout) export LD_LIBRARY_PATH="/usr/lib:${LD_LIBRARY_PATH:-}" export LIBRARY_PATH="/usr/lib:${LIBRARY_PATH:-}" # Build sequentially — runtime then compiler — to avoid OOM on small VMs # (gmake all would build both in parallel via -j flag) echo "Building Reef runtime..." gmake -j1 runtime echo "Building Reef compiler..." gmake -j1 compiler # Manual install — Hammerhead's /usr/sbin/install (SVR4) breaks PATH local COMPILER_DIR="$SRCDIR/reef-compiler" local RUNTIME_DIR="$SRCDIR/reef-runtime" local RUNTIME_BUILD="$RUNTIME_DIR/build" local STDLIB_DIR="$SRCDIR/reef-stdlib" local D="$PKGDIR$PREFIX" # Compiler binary mkdir -p "$D/bin" cp "$COMPILER_DIR/_build/default/bin/reefc.exe" "$D/bin/reefc" chmod 755 "$D/bin/reefc" # Runtime headers mkdir -p "$D/lib/reef/runtime/include" cp "$RUNTIME_DIR"/include/*.h "$D/lib/reef/runtime/include/" # Runtime libraries mkdir -p "$D/lib/reef/runtime/lib" cp "$RUNTIME_BUILD/libreef_runtime.a" "$D/lib/reef/runtime/lib/" for lib in libreef_x11.a libreef_tls.a libcrypto.a libssl.a libtls.a; do [ -f "$RUNTIME_BUILD/$lib" ] && cp "$RUNTIME_BUILD/$lib" "$D/lib/reef/runtime/lib/" done # Standard library mkdir -p "$D/lib/reef/stdlib" cp -r "$STDLIB_DIR"/* "$D/lib/reef/stdlib/" rm -rf "$D/lib/reef/stdlib/docs" 2>/dev/null || true chmod -R a+rX "$D/lib/reef" # Config file — substitute @PREFIX@ with actual prefix mkdir -p "$PKGDIR$SYSCONFDIR/reef" sed "s|@PREFIX@|$PREFIX|g" "$SRCDIR/etc/reefc.conf.in" > "$PKGDIR$SYSCONFDIR/reef/reefc.conf" chmod 644 "$PKGDIR$SYSCONFDIR/reef/reefc.conf" # Reef - Programming language for system programming # https://reef-lang.org [package] name = "reef" version = "0.7.7" release = 1 description = "Reef programming language compiler and runtime" url = "https://reef-lang.org" license = "BSD-2-Clause" maintainer = "Chris Tusa " arch = "x86_64" [dependencies] runtime = [] build = ["ocaml", "dune", "menhir", "ocaml-alcotest"] [[source]] file = "reef-lang-0.7.7-source.tar.gz" urls = ["reef-lang-0.7.7-source.tar.gz"] checksum = "d27b526aa7f7e61c72c0b16a9fd8a3ef37e39676a2d0d14257a244b678cd3516" extract = true [build] parallel = false