msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.31k stars 1.23k forks source link

[msmtp] Incorrect LOCALEDIR #22187

Open mlt opened 1 month ago

mlt commented 1 month ago

Description / Steps to reproduce the issue

As it is, LOCALEDIR points to D:/a/MSYS64. That part should be stripped. LOCALEDIR should be just /ucrt64/share/locale by using ./configure … CFLAGS=-DLOCALEDIR=/ucrt64/share/locale. I'm actually not sure where it is coming from... default ./configure yields localedir_c='"/ucrt64/share/locale"' in my config.log.

$ LANG=pt_BR msmtp --version
$ pacman -Ql mingw-w64-ucrt-x86_64-msmtp | grep pt_BR
mingw-w64-ucrt-x86_64-msmtp /ucrt64/share/locale/pt_BR/
mingw-w64-ucrt-x86_64-msmtp /ucrt64/share/locale/pt_BR/LC_MESSAGES/
mingw-w64-ucrt-x86_64-msmtp /ucrt64/share/locale/pt_BR/LC_MESSAGES/msmtp.mo

Expected behavior

One can remap things to get it work

$ subst.exe d: c:\\
$ cmd.exe //C "mklink /J C:\a C:\"
$ LANG=pt_BR msmtp --version
msmtp versao 1.8.23
Plataforma: x86_64-w64-mingw32
Biblioteca TLS/SSL: GnuTLS
Biblioteca de autenticaçao: interno
Métodos de autenticaçao suportados:
plain external cram-md5 login oauthbearer xoauth2
Suporte a IDN: habilitado
NLS: habilitado, LOCALEDIR é D:/a/msys64/ucrt64/share/locale
Suporte a chaveiro: GNOME
Nome do arquivo de configuraçao do sistema: C:\ProgramData\msmtprc.txt
Nome do arquivo de configuraçao do usuário: C:\Users\mlt\msmtprc.txt

Copyright (C) 2023 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Actual behavior

msmtp can't find its translations.

$ LANG=pt_BR msmtp --version
msmtp version 1.8.23
Platform: x86_64-w64-mingw32
TLS/SSL library: GnuTLS
Authentication library: built-in
Supported authentication methods:
plain external cram-md5 login oauthbearer xoauth2
IDN support: enabled
NLS: enabled, LOCALEDIR is D:/a/msys64/ucrt64/share/locale
Keyring support: Gnome
System configuration file name: C:\ProgramData\msmtprc.txt
User configuration file name: C:\Users\mlt\msmtprc.txt

Copyright (C) 2023 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Verification

Windows Version

MINGW64_NT-10.0-22000

MINGW environments affected

Are you willing to submit a PR?

No response

Kreijstal commented 1 month ago

maybe try MSYS2_ARG_CONV_EXCL="*" ?

mlt commented 1 month ago

It is odd… If I build the package on my machine, everything works as expected without remapping. msmtp uses LOCALEDIR as supplied by autotools and I see correct value starting with /ucrt64 in Makefile and config.log.

config.log (I had to add CFLAGS=-Wno-incompatible-pointer-types)

  $ ../msmtp-1.8.23/configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --prefix=/ucrt64 CFLAGS=-Wno-incompatible-pointer-types

src/Makefile (only relevant lines)

prefix = /ucrt64
datarootdir = ${prefix}/share
localedir = ${datarootdir}/locale
DEFS = -DHAVE_CONFIG_H -DSYSCONFDIR=\"$(sysconfdir)\" \
    -DLOCALEDIR=\"$(localedir)\" -DBINDIR=\"$(bindir)\"

There is no logic in the code. https://github.com/marlam/msmtp/blob/master/src/msmtp.c#L2237 and https://github.com/marlam/msmtp/blob/master/src/msmtp.c#L3817

mlt commented 1 month ago

I almost feel like the following would fix it. But I'm not sure what gets there on a build farm… I mean if it is D:.

diff --git a/mingw-w64-msmtp/PKGBUILD b/mingw-w64-msmtp/PKGBUILD
index 98916b3f3..aae2e3636 100644
--- a/mingw-w64-msmtp/PKGBUILD
+++ b/mingw-w64-msmtp/PKGBUILD
@@ -42,6 +42,7 @@ build() {
     --host=${MINGW_CHOST} \
     --prefix=${MINGW_PREFIX}

+  sed -i 's/\/d\/a//' src/Makefile
   sed -i 's/-R\/mingw..\/lib//' src/Makefile
   touch ${srcdir}/${_realname}-${pkgver}/src/*.c
   make