termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.19k stars 3.02k forks source link

Recursion in `termux_setup_wayland_cross_pkg_config_wrapper` function #21777

Closed johndebia2022 closed 1 week ago

johndebia2022 commented 1 week ago

https://github.com/termux/termux-packages/blob/52bd744bcb9ea9901ccb68e10de181dc18e4e3ef/scripts/build/setup/termux_setup_pkg_config_wrapper.sh#L20

ALSULTAN commented 1 week ago
termux_setup_pkg_config_wrapper() {
    local _PKG_CONFIG_LIBDIR=$1
    local _WRAPPER_BIN="${TERMUX_PKG_BUILDDIR}/_wrapper/bin"
    mkdir -p "${_WRAPPER_BIN}"
    if [[ "${TERMUX_ON_DEVICE_BUILD}" == "false" ]]; then
        sed "s|^export PKG_CONFIG_LIBDIR=|export PKG_CONFIG_LIBDIR=${_PKG_CONFIG_LIBDIR}:|" \
            "${TERMUX_STANDALONE_TOOLCHAIN}/bin/pkg-config" \
            > "${_WRAPPER_BIN}/pkg-config"
        chmod +x "${_WRAPPER_BIN}/pkg-config"
        export PKG_CONFIG="${_WRAPPER_BIN}/pkg-config"
    fi
    export PATH="${_WRAPPER_BIN}:${PATH}"
}

termux_setup_glib_cross_pkg_config_wrapper() {
    termux_setup_pkg_config_wrapper "${TERMUX_PREFIX}/opt/glib/cross/lib/x86_64-linux-gnu/pkgconfig"
}

termux_setup_wayland_cross_pkg_config_wrapper() {
    termux_setup_pkg_config_wrapper "${TERMUX_PREFIX}/opt/libwayland/cross/lib/x86_64-linux-gnu/pkgconfig"
}
TomJo2000 commented 1 week ago

Both of you are gonna need to elaborate. What's the issue here?

ALSULTAN commented 1 week ago

Same method is called causing recursion:

termux_setup_wayland_cross_pkg_config_wrapper() {
    termux_setup_wayland_cross_pkg_config_wrapper
}
Biswa96 commented 1 week ago

The termux_setup_wayland_cross_pkg_config_wrapper function seems to call itself in the shell script.

TomJo2000 commented 1 week ago

Okay I see now. https://github.com/termux/termux-packages/blob/52bd744bcb9ea9901ccb68e10de181dc18e4e3ef/scripts/build/setup/termux_setup_pkg_config_wrapper.sh#L19-L21 That is gonna be a problem.

@twaik you'll want to fix that.

Biswa96 commented 1 week ago

We both changed the title at same time :slightly_smiling_face:

TomJo2000 commented 1 week ago

Jinx

truboxl commented 1 week ago

Don't be Push trigger happy

twaik commented 1 week ago

Currently I can not fix it. Can someone please switch lines between these 2 and commit? https://github.com/termux/termux-packages/blob/a338cd8a4f366a0eb4090ac3db915ef6d170527d/packages/vulkan-tools/build.sh#L25 and https://github.com/termux/termux-packages/blob/52bd744bcb9ea9901ccb68e10de181dc18e4e3ef/scripts/build/setup/termux_setup_pkg_config_wrapper.sh#L20

twaik commented 1 week ago

Seems like geany switched tab after replacing all occurrences of termux_setup_pkg_config_wrapper "${TERMUX_PREFIX}/opt/libwayland/cross/lib/x86_64-linux-gnu/pkgconfig with termux_setup_wayland_cross_pkg_config_wrapper and I replaced it back in wrong place.

TomJo2000 commented 1 week ago

Seems like geany switched tab after replacing all occurrences of termux_setup_pkg_config_wrapper "${TERMUX_PREFIX}/opt/libwayland/cross/lib/x86_64-linux-gnu/pkgconfig with termux_setup_wayland_cross_pkg_config_wrapper and I replaced it back in wrong place.

It happens. A PR and review would have caught this before it ends up on master, but we'll just fix it now.

TomJo2000 commented 1 week ago

Currently I can not fix it. Can someone please switch lines between these 2 and commit?

https://github.com/termux/termux-packages/blob/a338cd8a4f366a0eb4090ac3db915ef6d170527d/packages/vulkan-tools/build.sh#L25

This one is also missing an ending ".