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
From 3fb17095d204a69c40d3895411d02ed1db3afa5c Mon Sep 17 00:00:00 2001 From: Kirill Makurin <maiddais...@outlook.com> Date: Sun, 16 Feb 2025 01:19:33 +0900 Subject: [PATCH] winpthreads: handle creation of pthread alias for library during installation Signed-off-by: Kirill Makurin <maiddais...@outlook.com> --- mingw-w64-libraries/winpthreads/Makefile.am | 45 +++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/Makefile.am b/mingw-w64-libraries/winpthreads/Makefile.am index 54eca7b81..8a71c0153 100644 --- a/mingw-w64-libraries/winpthreads/Makefile.am +++ b/mingw-w64-libraries/winpthreads/Makefile.am @@ -29,29 +29,32 @@ fakelib_libgcc_s_a_SOURCES = fakelib_libgcc_eh_a_SOURCES = endif -lib_LIBRARIES = - -if COPY_STATIC -lib_LIBRARIES += libpthread.a -libpthread_a_SOURCES = -libpthread_a_DEPENDENCIES = libwinpthread.la -#FIXME: Use cp kludge until a better method presents itself -#libpthread_a_LIBADD = $(LT_OBJDIR)/libwinpthread.a -libpthread_a_AR = cp -f $(LT_OBJDIR)/libwinpthread.a -endif - -if COPY_SHARED -lib_LIBRARIES += libpthread.dll.a -libpthread_dll_a_SOURCES = -libpthread_dll_a_DEPENDENCIES = libwinpthread.la -#FIXME: Use cp kludge until a better method presents itself -#libpthread_dll_a_LIBADD = $(LT_OBJDIR)/libwinpthread.dll.a -libpthread_dll_a_AR = cp -f $(LT_OBJDIR)/libwinpthread.dll.a -endif - # Tell libtool how to use the resource compiler .rc.lo: $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@ -DISTCHECK_CONFIGURE_FLAGS = --host=$(host_triplet) +# Handle -lpthread alias when installing +install-exec-hook: + . $(builddir)/libwinpthread.la; \ + if test -n "$${library_names}"; then \ + alias=$$(printf %s "$${library_names}" | $(SED) 's|winpthread|pthread|'); \ + $(LN_S) $(DESTDIR)$(libdir)/$${library_names} $(DESTDIR)$(libdir)/$${alias}; \ + fi; \ + if test -n "$${old_library}"; then \ + alias=$$(printf %s "$${old_library}" | $(SED) 's|winpthread|pthread|'); \ + $(LN_S) $(DESTDIR)$(libdir)/$${old_library} $(DESTDIR)$(libdir)/$${alias}; \ + fi + +# Likewise when uninstalling +uninstall-hook: + . $(builddir)/libwinpthread.la; \ + if test -n "$${library_names}"; then \ + alias=$$(printf %s "$${library_names}" | $(SED) 's|winpthread|pthread|'); \ + rm -f $(DESTDIR)$(libdir)/$${alias}; \ + fi; \ + if test -n "$${old_library}"; then \ + alias=$$(printf %s "$${old_library}" | $(SED) 's|winpthread|pthread|'); \ + rm -f $(DESTDIR)$(libdir)/$${alias}; \ + fi +DISTCHECK_CONFIGURE_FLAGS = --host=$(host_triplet) -- 2.46.1.windows.1
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public