devel/gettext-runtime: sync with upstream

Taken from: FreeBSD
This commit is contained in:
Franco Fichtner 2025-01-07 13:48:15 +01:00
parent 3d50724260
commit 332c85624a
3 changed files with 20 additions and 11 deletions

View file

@ -22,7 +22,6 @@ CPE_PRODUCT= gettext
CPE_VENDOR= gnu
GNU_CONFIGURE= yes
GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
CONFIGURE_ARGS= --disable-csharp --disable-java --with-included-gettext \
ac_cv_lib_rt_sched_yield=no
INSTALL_TARGET= install-strip
@ -41,4 +40,7 @@ OPTIONS_DEFINE= DOCS
CONFIGURE_ARGS+=--disable-threads
.endif
post-install:
${RMDIR} ${STAGEDIR}${PREFIX}/lib/gettext
.include <bsd.port.mk>

View file

@ -1,26 +1,34 @@
--- intl/osdep.c.orig 2019-05-11 11:29:32 UTC
+++ intl/osdep.c
@@ -18,6 +18,25 @@
@@ -18,6 +18,33 @@
# include "intl-exports.c"
#elif defined __EMX__ && !defined __KLIBC__
# include "os2compat.c"
+#elif defined __FreeBSD__
+#include <config.h>
+#include <sys/param.h>
+#include <osreldate.h>
+#include <dlfcn.h>
+#include <pthread.h>
+static __attribute__((constructor)) void
+libintl_init (void)
+{
+#if __FreeBSD_version >= 1400094
+ /* We don't link with libpthread in order to avoid the overhead for
+ non-threaded programs. Instead we dlopen it with RTLD_NOLOAD here
+ to ensure it is initialised when present. */
+ /* This dlopen call initialises libpthread if it is present. Normally
+ this is handled by linking to libpthread but libintl does not link
+ with libpthread to avoid the overhead for non-threaded programs. */
+ (void) dlopen ("libpthread.so", RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD);
+#else
+ /* For older versions this hack also triggers libpthread
+ initialisation. */
+ (void) pthread_self ();
+ /* The dlopen call above does not work correctly on older versions of
+ FreeBSD. Call pthread_mutex_timedlock instead. It initialises
+ libpthread and there's no libc stub that can preempt it. */
+#pragma weak pthread_mutex_timedlock
+ if (pthread_mutex_timedlock != NULL)
+ {
+ pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_timedlock (&lock, NULL);
+ pthread_mutex_unlock (&lock);
+ pthread_mutex_destroy (&lock);
+ }
+#endif
+}
#else

View file

@ -11,7 +11,7 @@ lib/libasprintf.so.0.0.0
lib/libintl.a
lib/libintl.so
lib/libintl.so.8
lib/libintl.so.8.4.0
lib/libintl.so.8.4.2
%%PORTDOCS%%%%DOCSDIR%%/bind_textdomain_codeset.3.html
%%PORTDOCS%%%%DOCSDIR%%/bindtextdomain.3.html
%%PORTDOCS%%%%DOCSDIR%%/csharpdoc/GNU_Gettext.html
@ -66,7 +66,6 @@ share/locale/it/LC_MESSAGES/gettext-runtime.mo
share/locale/ja/LC_MESSAGES/gettext-runtime.mo
share/locale/ka/LC_MESSAGES/gettext-runtime.mo
share/locale/ko/LC_MESSAGES/gettext-runtime.mo
share/locale/locale.alias
share/locale/nb/LC_MESSAGES/gettext-runtime.mo
share/locale/nl/LC_MESSAGES/gettext-runtime.mo
share/locale/nn/LC_MESSAGES/gettext-runtime.mo