Re: Threaded version of TOOL_XZ ?

Tobias Nygren <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain,gmane.os.netbsd.current
Message-ID <[email protected]>
On Tue, 19 Apr 2022 10:18:20 -0700 (PDT)
Paul Goyette <[email protected]> wrote:

> Using TOOL_XZ instead of TOOL_GZ satisfies requirement #1, and use of
> (unsupported) TOOL_PIGZ satisfies #2, but neither option can meet
> both.  TOOL_XZ is explicitly built without thread support, and simply
> modifying its Makefile to enable_threads=yes doesn't build.

This patch does more or less what you want. But doing it this way means
NetBSD can no longer be cross-compiled from a host without pthreads.
Not sure if we care about this anymore or if we need to hide this
behind a toggle. You also need to hook "-T 0" into xz args for sets.

# set cpu on fire
/work/tools/bin/nbxz -T 0 -9c < /dev/zero > /dev/null

Index: external/public-domain/xz/bin/xz/Makefile
===================================================================
RCS file: /cvsroot/src/external/public-domain/xz/bin/xz/Makefile,v
retrieving revision 1.6
diff -p -u -r1.6 Makefile
--- external/public-domain/xz/bin/xz/Makefile	12 Apr 2021 02:54:08 -0000	1.6
+++ external/public-domain/xz/bin/xz/Makefile	19 Apr 2022 18:03:58 -0000
@@ -44,7 +44,7 @@ FILESNAME_${XZSRCDIR}/po/${lang}.gmo=	xz
 .if defined(HOSTPROG)
 HOST_CPPFLAGS+=	${CPPFLAGS:N-Wp,-iremap,*}
 XZLIBDIR!=	cd ${NETBSDSRCDIR}/tools/xz-lib && ${PRINTOBJDIR}
-LDADD+=	-L${XZLIBDIR} -llzma
+LDADD+=	-L${XZLIBDIR} -llzma -lpthread
 DPADD+=	${XZLIBDIR}/liblzma.a
 .else
 DPADD+=	${LIBLZMA} ${LIBINTL} ${LIBPTHREAD}
Index: external/public-domain/xz/lib/Makefile
===================================================================
RCS file: /cvsroot/src/external/public-domain/xz/lib/Makefile,v
retrieving revision 1.10
diff -p -u -r1.10 Makefile
--- external/public-domain/xz/lib/Makefile	25 Sep 2018 05:42:08 -0000	1.10
+++ external/public-domain/xz/lib/Makefile	19 Apr 2022 18:03:58 -0000
@@ -57,9 +57,7 @@ SRCS+=	common.c block_util.c easy_preset
 	index_decoder.c index_hash.c stream_buffer_decoder.c \
 	stream_decoder.c stream_flags_decoder.c vli_decoder.c
 
-.if !defined(HOSTLIB)
 SRCS+=	 stream_encoder_mt.c
-.endif
 
 .PATH:	${XZSRCDIR}/src/liblzma/delta
 SRCS+=	delta_common.c delta_encoder.c delta_decoder.c
Index: tools/xz-include/Makefile
===================================================================
RCS file: /cvsroot/src/tools/xz-include/Makefile,v
retrieving revision 1.4
diff -p -u -r1.4 Makefile
--- tools/xz-include/Makefile	18 Sep 2021 01:47:11 -0000	1.4
+++ tools/xz-include/Makefile	19 Apr 2022 18:03:59 -0000
@@ -8,7 +8,7 @@
 #
 .include "Makefile.inc"
 
-CONFIGURE_ARGS+=	--enable-threads=no --disable-nls
+CONFIGURE_ARGS+=	--enable-threads=posix --disable-nls
 .if ${MAKEVERBOSE} == 0
 CONFIGURE_ARGS+=	--silent
 .endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.