fix(setup ghc): register haskell packages recursively
previously only main dependencies were registered, ignoring dependencies of dependencies. Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
This commit is contained in:
parent
597726cf10
commit
3ba86891ed
@ -1,18 +1,25 @@
|
||||
# shellcheck shell=bash
|
||||
__termux_haskell_register_packages() {
|
||||
# Register dependency haskell packages with termux-ghc-pkg.
|
||||
IFS=',' read -r -a DEP <<<"$(echo "${TERMUX_PKG_DEPENDS},${TERMUX_PKG_BUILD_DEPENDS}" | tr -d ' ')"
|
||||
for dep in "${DEP[@]}"; do
|
||||
if [[ "${dep/haskell-/}" != "${dep}" ]]; then
|
||||
echo "Dependency '${dep}' is a haskell package, registering it with ghc-pkg..."
|
||||
echo "Registering haskell packages with ghc-pkg...(if any)"
|
||||
while read -r DEP DEP_DIR; do
|
||||
if [[ -z $DEP ]]; then
|
||||
continue
|
||||
elif [[ "${DEP}" == "ERROR" ]]; then
|
||||
termux_error_exit "Failed to find dependencies of ${TERMUX_PKG_NAME}[Context: ${FUNCNAME[0]}]"
|
||||
fi
|
||||
if [[ "${DEP/haskell-/}" != "${DEP}" ]]; then
|
||||
sed "s|${TERMUX_PREFIX}/bin/ghc-pkg|$(command -v termux-ghc-pkg)|g" \
|
||||
"${TERMUX_PREFIX}/share/haskell/register/${dep}.sh" | sh
|
||||
"${TERMUX_PREFIX}/share/haskell/register/${DEP}.sh" | sh
|
||||
termux-ghc-pkg recache
|
||||
# NOTE: Above command rewrites a cache file at
|
||||
# "${TERMUX_PREFIX}/lib/ghc-${TERMUX_GHC_VERSION}/package.conf.d". Since it is done after
|
||||
# timestamp creation, we need to remove it in massage step.
|
||||
fi
|
||||
done
|
||||
done <<<"$(
|
||||
# shellcheck disable=SC2086
|
||||
"${TERMUX_SCRIPTDIR}"/buildorder.py -i "${TERMUX_PKG_BUILDER_DIR}" ${TERMUX_PACKAGES_DIRECTORIES} || echo "ERROR"
|
||||
)"
|
||||
}
|
||||
|
||||
__termux_haskell_setup_build_script() {
|
||||
|
Loading…
Reference in New Issue
Block a user