#!/bin/zsh

if [ -z "${PREFIX}" ]; then
    PREFIX=${MANYO_PATH}
fi
cd source
#git clone -b 4.4 https://github.com/nexusformat/code # only once
#patch code/src/napi5.c < nexusformat.diff # No need

#git clone https://github.com/nexusformat/code # only once
patch code/applications/NXbrowse/NXbrowse.c < Utsusemi/contrib/macos/AppleSilicon/NXbrowse.diff
cd code
mkdir build
cd build
export ENABLE_CXX=yes;cmake -DENABLE_APPS=ON -DENABLE_HDF5=1 -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX} ..
make install
