Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: zstd: enable pzstd
To:
Bjorn Ketelaars <bket@openbsd.org>, Nick Owens <mischief@offblast.org>, ports@openbsd.org
Date:
Thu, 7 Nov 2024 08:56:45 +0000

Download raw body.

Thread
On 2024/11/06 22:34, Kirill A. Korinsky wrote:
> On Wed, 06 Nov 2024 22:17:47 +0100,
> Bjorn Ketelaars <bket@openbsd.org> wrote:
> > 
> > On Wed 06/11/2024 21:44, Kirill A. Korinsky wrote:
> > > 
> > > re-inline patch with micro tweak, added original input from Nick Owens, and
> > > Cc'ed Bjorn Ketelaars (maintaner)
> > 
> > This needs a bit more work.
> > 
> > pzstd is written in C++ (C++14). Please have a look at the output of
> > 'make port-lib-depends-check'. I think you need to add
> > ${COMPILER_LIBCXX} to WANTLIB. Additionally, please have a look if it is
> > needed to add 'COMPILER=base-clang ports-gcc', and if it is needed to
> > add CXX="${CXX}" and CXXFLAGS="${CXXFLAGS}" to MAKE_ENV.
> >
> 
> You absolutley right. It also needs m in WANTLIB.
> 
> So, here an updated diff which addresses that remarks.
> 
> > Most important is that building is tested on arches other than amd64.
> > Unfortunately, I can not help with that.
> 
> Unfortunately, neigther do I.
> 
> But I found that it builds on Linux on other arches, see:
> https://ci.guix.gnu.org/search?query=pzstd%201.5.2%20spec:master
> 
> Index: Makefile
> ===================================================================
> RCS file: /home/cvs/ports/archivers/zstd/Makefile,v
> diff -u -p -r1.47 Makefile
> --- Makefile	16 Apr 2024 17:29:50 -0000	1.47
> +++ Makefile	6 Nov 2024 21:29:59 -0000
> @@ -1,6 +1,7 @@
>  COMMENT =		zstandard fast real-time compression algorithm
>  
>  V =			1.5.6
> +REVISION =		0
>  DISTNAME =		zstd-${V}
>  
>  SHARED_LIBS =		zstd	6.4	# 1.5.6
> @@ -14,15 +15,20 @@ MAINTAINER =		Bjorn Ketelaars <bket@open
>  # BSD 3 clauses + GPLv2
>  PERMIT_PACKAGE =	Yes
>  
> -WANTLIB =		c lz4 lzma pthread z
> +WANTLIB =		${COMPILER_LIBCXX} c lz4 lzma m pthread z
>  
>  SITES =			https://github.com/facebook/zstd/releases/download/v${V}/
>  
> +# pzstd requires C++14
> +COMPILER =		base-clang ports-gcc

I think it would be better not to kill this port on base-gcc arches.
Perhaps make building pzstd conditional?

I'd also worry about an archiver that pulls in ports-gcc causing a
dependency loop on ports-gcc archs (seems ok now, but perhaps sometime
in the future).

>  LIB_DEPENDS =		archivers/lz4 \
>  			archivers/xz
>  BUILD_DEPENDS =		sysutils/ggrep
>  
>  MAKE_ENV =		CC="${CC}" \
> +			CXX="${CXX}" \
> +			CXXFLAGS="${CXXFLAGS}"\
>  			CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include" \
>  			LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib"
>  MAKE_FLAGS =		SHARED_EXT_VER="so.$(LIBzstd_VERSION)" \
> @@ -46,6 +52,12 @@ TEST_ENV =		TMPDIR=${TESTTMP}
>  
>  pre-build:
>  	ln -fs ${LOCALBASE}/bin/ggrep ${WRKDIR}/bin/grep
> +
> +post-build:
> +	cd ${WRKSRC}/contrib/pzstd && exec ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS}

post-build/install are  better than the "override do-build/install"
diff, but why "exec"?

> +post-install:
> +	cd ${WRKSRC}/contrib/pzstd && exec ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} ${FAKE_TARGET}
>  
>  pre-test:
>  	mkdir -p ${TESTTMP}
> Index: pkg/PLIST
> ===================================================================
> RCS file: /home/cvs/ports/archivers/zstd/pkg/PLIST,v
> diff -u -p -r1.9 PLIST
> --- pkg/PLIST	8 Mar 2022 08:53:49 -0000	1.9
> +++ pkg/PLIST	6 Nov 2024 20:21:55 -0000
> @@ -1,3 +1,4 @@
> +@bin bin/pzstd
>  bin/unzstd
>  @bin bin/zstd
>  bin/zstdcat
> 
> 
> -- 
> wbr, Kirill
>