On Wed, Sep 11, 2024 at 10:13:12PM +0200, Jeremie Courreges-Anglas wrote:
[...]
> I can think of several approaches to fix this:
> 
> 1. add libstdthreads as a build dep to all those ports.  Simple but
>   slightly problematic:
>   - IIUC, brings no functional value
>   - increases the chance of libstdthreads being picked up by future ports
> 
> 2. "poison" threads.h detection for gnu.port.mk ports.  This should be
>   enough for the gnulib occurences.
> 
> 3. move libstdthreads header and libs to a subdirectory, to avoid
>   threads.h being picked up just because it's in the commonly used
>   /usr/local/include directory.
> 
> The diff below, tested with sysutils/ggrep, implements approach #2.
> If a gnu.port.mk port really wants libstdthreads, one needs to add
> devel/libstdthreads to BUILD_DEPENDS (even though it really belongs in
> LIB_DEPENDS), or add an override in CONFIGURE_ENV.
> The diff isn't complete: it lacks at least REVISION bumps for at least
> octave, pspp and link-grammar, and possibly safety bumps for all other
> affected ports; but it shows the intent.
> 
> Approach #3 seems to work too but is slightly tricker.  wayland/foot
> would need a meson.build patch.

WIP diff for approach #3 below.

> Thoughts?


Index: devel/libstdthreads/Makefile
===================================================================
RCS file: /home/cvs/ports/devel/libstdthreads/Makefile,v
diff -u -p -r1.3 Makefile
--- devel/libstdthreads/Makefile        2 Sep 2024 16:39:12 -0000       1.3
+++ devel/libstdthreads/Makefile        11 Sep 2024 19:53:41 -0000
@@ -2,6 +2,7 @@ COMMENT = C11 standard threads library
 
 DISTNAME =     libstdthreads-${V}
 V =            0.3.2
+REVISION =     0
 
 CATEGORIES =   devel
 
@@ -16,12 +17,19 @@ WANTLIB =           pthread
 COMPILER =             base-clang ports-gcc
 COMPILER_LANGS =       c
 
-FAKE_FLAGS =           LIBDIR=${TRUEPREFIX}/lib \
+MAKE_FLAGS =           PREFIX=${PREFIX}/lib/stdthreads
+FAKE_FLAGS =           LIBDIR=${TRUEPREFIX}/lib/stdthreads/lib \
                        MANDIR=${TRUEPREFIX}/man/man
 
+pre-install:
+       ${INSTALL_DATA_DIR} ${PREFIX}/lib/stdthreads/{lib/pkgconfig,include}
+
 post-install:
        cd ${WRKSRC} && ${INSTALL} -c -m 444 -o root -g bin \
-               threads.h ${PREFIX}/include
+               threads.h ${PREFIX}/lib/stdthreads/include
+       mv ${PREFIX}/lib/stdthreads/lib/pkgconfig/stdthreads.pc \
+               ${PREFIX}/lib/pkgconfig
+       rmdir ${PREFIX}/lib/stdthreads/lib/pkgconfig/
 
 DEBUG_PACKAGES =       ${BUILD_PACKAGES}
 
Index: devel/libstdthreads/patches/patch-stdthreads_pc_in
===================================================================
RCS file: devel/libstdthreads/patches/patch-stdthreads_pc_in
diff -N devel/libstdthreads/patches/patch-stdthreads_pc_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ devel/libstdthreads/patches/patch-stdthreads_pc_in  11 Sep 2024 19:45:42 
-0000
@@ -0,0 +1,9 @@
+Index: stdthreads.pc.in
+--- stdthreads.pc.in.orig
++++ stdthreads.pc.in
+@@ -8,4 +8,4 @@ Description: The C11 standard threads library
+ Version: @PACKAGE_VERSION@
+ 
+ Cflags: -I${includedir}
+-Libs: -L${libdir} -lstdthreads -lpthread
++Libs: -L${libdir} -R${libdir} -lstdthreads -lpthread
Index: devel/libstdthreads/pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/devel/libstdthreads/pkg/PLIST,v
diff -u -p -r1.1.1.1 PLIST
--- devel/libstdthreads/pkg/PLIST       2 Sep 2023 08:30:00 -0000       1.1.1.1
+++ devel/libstdthreads/pkg/PLIST       11 Sep 2024 19:44:44 -0000
@@ -1,6 +1,9 @@
-include/threads.h
-@static-lib lib/libstdthreads.a
-@lib lib/libstdthreads.so.${LIBstdthreads_VERSION}
-@static-lib lib/libstdthreads_p.a
 lib/pkgconfig/stdthreads.pc
+lib/stdthreads/
+lib/stdthreads/include/
+lib/stdthreads/include/threads.h
+lib/stdthreads/lib/
+@static-lib lib/stdthreads/lib/libstdthreads.a
+@lib lib/stdthreads/lib/libstdthreads.so.${LIBstdthreads_VERSION}
+@static-lib lib/stdthreads/lib/libstdthreads_p.a
 @man man/man3/thrd_create.3
Index: graphics/fcft/Makefile
===================================================================
RCS file: /home/cvs/ports/graphics/fcft/Makefile,v
diff -u -p -r1.6 Makefile
--- graphics/fcft/Makefile      31 Aug 2024 16:30:54 -0000      1.6
+++ graphics/fcft/Makefile      11 Sep 2024 20:14:55 -0000
@@ -2,6 +2,7 @@ COMMENT =       small font loading and glyph 
 
 DISTNAME =     fcft-$V
 V =            3.1.7
+REVISION =     0
 
 SITES =                https://codeberg.org/dnkl/fcft/archive/
 DISTFILES =     fcft-{}${V}${EXTRACT_SUFX}
@@ -21,7 +22,8 @@ COMPILER_LANGS = c
 MODULES =      devel/meson
 
 WANTLIB +=     fontconfig freetype harfbuzz m pixman-1
-WANTLIB +=     stdthreads pthread utf8proc
+WANTLIB +=     pthread utf8proc
+WANTLIB +=     lib/stdthreads/lib/stdthreads
 
 BUILD_DEPENDS =        devel/tllist \
                textproc/scdoc
Index: wayland/foot/Makefile
===================================================================
RCS file: /home/cvs/ports/wayland/foot/Makefile,v
diff -u -p -r1.8 Makefile
--- wayland/foot/Makefile       31 Aug 2024 16:30:54 -0000      1.8
+++ wayland/foot/Makefile       11 Sep 2024 20:15:22 -0000
@@ -2,6 +2,7 @@ COMMENT =       fast, lightweight and minimal
 
 DISTNAME =     foot-${V}
 V =            1.18.0
+REVISION =     0
 
 SITES =                https://codeberg.org/dnkl/foot/archive/
 DISTFILES =     foot-{}${V}${EXTRACT_SUFX}
@@ -21,8 +22,9 @@ COMPILER_LANGS = c
 MODULES =       devel/meson
 
 WANTLIB =      c epoll-shim fcft fontconfig m pixman-1
-WANTLIB +=     pthread stdthreads utf8proc wayland-client wayland-cursor
+WANTLIB +=     pthread utf8proc wayland-client wayland-cursor
 WANTLIB +=     xkbcommon
+WANTLIB +=     lib/stdthreads/lib/stdthreads
 
 BUILD_DEPENDS =        devel/tllist \
                textproc/scdoc \
Index: wayland/foot/patches/patch-meson_build
===================================================================
RCS file: /home/cvs/ports/wayland/foot/patches/patch-meson_build,v
diff -u -p -r1.3 patch-meson_build
--- wayland/foot/patches/patch-meson_build      16 Aug 2024 13:09:53 -0000      
1.3
+++ wayland/foot/patches/patch-meson_build      11 Sep 2024 20:09:03 -0000
@@ -50,3 +50,12 @@ Index: meson.build
                   tllist, fcft],
    link_with: pgolib,
    install: true)
+@@ -308,7 +310,7 @@ executable(
+   'macros.h',
+   'util.h',
+   version,
+-  dependencies: [tllist],
++  dependencies: [stdthreads, tllist],
+   link_with: common,
+   install: true)
+ 

-- 
jca

Reply via email to