If you're good with that patch, I would like to update it to also remove lines 
in `configure.ac` which define `COPY_STATIC` and `COPY_SHARED` Automake 
conditionals. Let me know what you decide.

- Kirill Makurin
________________________________
From: Kirill Makurin <maiddais...@outlook.com>
Sent: Sunday, February 16, 2025 1:31 AM
To: LIU Hao <lh_mo...@126.com>; mingw-w64-public@lists.sourceforge.net 
<mingw-w64-public@lists.sourceforge.net>
Subject: Re: [Mingw-w64-public] make sure WINPTHREAD_API is correctly defined 
in pthread_time.h

It slipped my mind back then that we can source .la files to get the variables.

I attached modified patch.

The only issue that will remain is silly libtool behavior I described. But I 
think it should be fixed in libtool, not by copying the DLL.

- Kirill Makurin

________________________________
From: LIU Hao
Sent: Sunday, February 16, 2025 12:30 AM
To: Kirill Makurin; mingw-w64-public@lists.sourceforge.net
Subject: Re: [Mingw-w64-public] make sure WINPTHREAD_API is correctly defined 
in pthread_time.h

在 2025-02-15 23:23, Kirill Makurin 写道:
> What do you think if we just guard those rules for `libptrhead[.dll].a` with 
> `if !MSVC`?
>
> Libtool has a silly behavior with MSVC tools. When you create a shared 
> library which depends on
> another (non-libtool) shared library, when it handles `-l{name}` it searches 
> PATH for file `{name}
> *.dll` (not even `lib{name}*.dll` as it seems) and it will refuse to create 
> shared library if there
> is no such file. This means that having import library alone will not be 
> sufficient and it also
> seems like it doesn't even consider static libraries. It gave lots of 
> headache to me.
>
> If people who build winpthreads with MSVC want to use it with Autotools 
> projects they can create
> hard links like this:
>
> pthread.dll.lib -> winpthreads.dll.lib
> pthread.lib -> winpthreads.lib
> pthread.dll -> winpthread-{VERSION}.dll

It is not necessary to copy the DLL; the import library contains the name of 
the corresponding DLL,
so it will always reference libwinpthread-1.dll.

I think your patch can be simplified a lot if you do `. libwinpthread.la`, then 
those variables will
become available for use by commands in the hooks.

Meson has `install_symlink()` so this dirty work is unnecessary there.



--
Best regards,
LIU Hao

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to