#!/bin/sh
# Build script for tree-sitter (plain Makefile, no deps, no libtool - links# the shared object directly via $(CC) -shared, gated on `$(CC) -dumpmachine`# rather than `uname`, so it already falls through cleanly to the generic# ELF .so branch on Hammerhead).## GOTCHA (1b-2): lib/src/portable/endian.h picks its `#include <endian.h>`# branch only when __illumos__ (or __linux__/etc) is defined; Hammerhead's# GCC predefines __sun/__sun__, not __illumos__, so unpatched it falls to# the final `#error platform not supported`. illumos's own# /usr/include/endian.h already declares htobe16/le16toh/etc as libc# externs (confirmed present) - just needs the macro to select that arm.set -e
cd "$SRCDIR"export CFLAGS="${CFLAGS} -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS -D__illumos__"gmake -j${JOBS:-1} PREFIX="$PREFIX"gmake install PREFIX="$PREFIX" DESTDIR="$PKGDIR"