# Macros for building Haskell programs with vendored dependencies
# Designed for use in conjunction with the cabal-vendor utility from Sisyphus
# Vendoring still isn’t supported out of the box in cabal-install
# See: https://github.com/haskell/cabal/issues/10934

%_prepare_cabal_repo sed -i "s|{BUILDDIR}|$PWD|" local-repo/config

%__cabal /usr/bin/cabal
%_local_cabal %__cabal --config local-repo/config

%cabal_vendor_build %{expand:
    %_prepare_cabal_repo
    %_local_cabal build \\\
}

%cabal_vendor_install %_local_cabal %{shrink: install
    --installdir     %buildroot/%_bindir
    --install-method copy
}
