#!/bin/sh -e

export DESTDIR="$1"

install -Dm644 libunwind/include/mach-o/compact_unwind_encoding.h include/mach-o/compact_unwind_encoding.h

cmake -B build \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -Wno-dev

cmake --build   build
cmake --install build

ln -s lld "$1/usr/bin/ld"
