export PATH="$PREFIX/bin:$BUILD_PREFIX/bin:$PATH"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$BUILD_PREFIX/lib/pkgconfig"

if [ "$(uname -s)" == "Darwin" ] && [ "$(uname -m)" == "arm64" ] ; then
   CONDA_BUILD_SYSROOT="${MACOSX_SDK:-/opt/MacOSX11.0.sdk}"
elif [ "$(uname -s)" == "Darwin" ] ; then
   CONDA_BUILD_SYSROOT="${MACOSX_SDK:-/opt/MacOSX10.9.sdk}"
fi

#Configure, build, install
meson setup build --prefix=$PREFIX --pkg-config-path=$PKG_CONFIG_PATH
meson compile -C build
meson install -C build

#Create a list of all of the parameter files
# Used by the post-link.sh and pre-unlink.sh scripts
# to remove and add write permissions respectively
cd ${PREFIX}/param
find * -maxdepth 0 -type f -name "*.par" -exec echo {} \; > ${PREFIX}/param/.param.pyciao
