MSYS2-packages: makepkg-mingw ccache build option doesn't work

makepkg-mingw executes makepkg with makepkg_mingwXY.config:

  if [ -f "/${_mingw}/bin/gcc.exe" ]; then
    MSYSTEM=${_msystem} \
    PATH=/${_mingw}/bin:$(echo $PATH | tr ':' '\n' | awk '$0 != "/opt/bin"' | paste -sd:) \
    /usr/bin/makepkg --config /etc/makepkg_${_mingw}.conf $@ || exit 1

default config: BUILDENV=(!distcc color !ccache check !sign) If we uncomment !ccache to ccache makepkg will run following:

    # use ccache if it is requested (check buildenv and PKGBUILD opts)
    if check_buildoption "ccache" "y" && [[ -d /usr/lib/ccache/bin ]]; then
        export PATH="/usr/lib/ccache/bin:$PATH"
        ccache=1
    fi

This not only makes ccache useless for makepkg-mingw but also modifies path set by makepkg-mingw (gcc in /usr/bin will be first choice instead of /mingwXY/bin).

My suggestion is to change BUILDENV=(!distcc color !ccache check !sign) like this BUILDENV=(!distcc color !ccache_mingw check !sign) and add proper check in makepkg:

    # use ccache_mingw if it is requested (check buildenv and PKGBUILD opts)
    if check_buildoption "ccache_mingw" "y" && [[ -d $MINGW_PREFIX/lib/ccache/bin ]]; then
        export PATH="/$MINGW_PREFIX/lib/ccache/bin:$PATH"
        ccache=1
    fi

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

I’m trying to test it but compilation of pacman fails. EDIT: Ok, compiled it with --nocheck. Tomorrow I’ll do tests.

I was gonna complain about the second solution (it looked nice except the “ccache_mingw” part), but now I see you edited the code. 😃

I think the second solution is better, but maybe MINGW_PREFIX is not the right variable to check. We could introduce a new variable like MINGW_BUILDING=1.