# 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 cabal-vendor convert

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

%cabal_vendor_build %{expand:
    %_prepare_cabal_repo
    %_local_cabal %{shrink: build
                            --enable-debug-info=3
                            --enable-split-sections
                            --disable-executable-stripping
    } \\\
}

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

%cabal_vendor_test %_local_cabal test
