Re: git: eb3a0a74a069 - main - libarchive: Clean up the build configuration

From: Shawn Webb <shawn.webb_at_hardenedbsd.org>
Date: Thu, 04 Jun 2026 19:49:38 UTC
On Thu, Jun 04, 2026 at 01:12:57PM +0000, Dag-Erling Smørgrav wrote:
> The branch main has been updated by des:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=eb3a0a74a069d0f294e1596504676459282bb308
> 
> commit eb3a0a74a069d0f294e1596504676459282bb308
> Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
> AuthorDate: 2026-06-04 13:12:23 +0000
> Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
> CommitDate: 2026-06-04 13:12:23 +0000
> 
>     libarchive: Clean up the build configuration
>     
>     * Move settings duplicated in libarchive, bsdcat, bsdcpio, bsdtar, and
>       bsdunzip into libarchive's Makefile.inc.
>     
>     * Drop some CFLAGS that merely duplicated some of the contents of our
>       platform configuration header.
>     
>     MFC after:      1 week
>     Reviewed by:    mm
>     Differential Revision:  https://reviews.freebsd.org/D57307
> ---
>  lib/libarchive/Makefile       |  7 ++-----
>  lib/libarchive/Makefile.inc   | 16 +++++++++++-----
>  lib/libarchive/tests/Makefile |  8 ++++----
>  usr.bin/bsdcat/Makefile       | 17 ++++++-----------
>  usr.bin/bsdcat/tests/Makefile | 15 +++++++--------
>  usr.bin/cpio/Makefile         | 18 +++++-------------
>  usr.bin/cpio/tests/Makefile   | 15 +++++++--------
>  usr.bin/tar/Makefile          | 13 +++----------
>  usr.bin/tar/tests/Makefile    | 13 +++++++------
>  usr.bin/unzip/Makefile        | 14 ++++----------
>  usr.bin/unzip/tests/Makefile  | 13 +++++++------
>  11 files changed, 63 insertions(+), 86 deletions(-)
> 
> diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile
> index 4e32dcf72341..c4b4bc67ba33 100644
> --- a/lib/libarchive/Makefile
> +++ b/lib/libarchive/Makefile
> @@ -1,7 +1,8 @@
>  .include <src.opts.mk>
>  
> +.include "Makefile.inc"
> +
>  PACKAGE=lib${LIB}
> -_LIBARCHIVEDIR=	${SRCTOP}/contrib/libarchive
>  
>  LIB=	archive
>  
> @@ -9,10 +10,6 @@ LIB=	archive
>  # It has no real relation to the libarchive version number.
>  SHLIB_MAJOR= 7
>  
> -CFLAGS+=	-I${.OBJDIR}
> -CFLAGS+=	-I${SRCTOP}/sys/contrib/zstd/lib
> -.include "Makefile.inc"
> -
>  .if ${MACHINE_ARCH:Marm*} != "" || ${MACHINE_ARCH:Mpowerpc*} != ""
>  NO_WCAST_ALIGN=	yes
>  .if ${MACHINE_ARCH:M*64*} == ""
> diff --git a/lib/libarchive/Makefile.inc b/lib/libarchive/Makefile.inc
> index 755a39ec01e8..33ab0085367f 100644
> --- a/lib/libarchive/Makefile.inc
> +++ b/lib/libarchive/Makefile.inc
> @@ -2,11 +2,17 @@
>  # them in sync we can get run-time crashes while running tests due to mismatches
>  # between structures such as archive_md5_ctx, etc.
>  
> -LIBADD=	z bz2 lzma bsdxml zstd
> -CFLAGS+=	-DHAVE_BZLIB_H=1 -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 \
> -		-DHAVE_ZSTD_H=1 -DHAVE_LIBZSTD=1 -DHAVE_ZSTD_compressStream=1 \
> -		-DHAVE_SYSCONF=1
> -CFLAGS+=	-DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\"
> +_LIBARCHIVEDIR=	${SRCTOP}/contrib/libarchive
> +LIBARCHIVE_VERSION_ONLY_STRING!= \
> +	sed -n '/define.*ARCHIVE_VERSION_ONLY_STRING/{s,[^0-9.],,gp;q;}' \
> +	    ${LIBARCHIVEDIR}/libarchive/archive.h

Hey Dag-Erling,

This seems to have created a new warning during buildworld:

==== BEGIN BUILD LOG ====
===> lib/libarchive (all)
sed: /libarchive/archive.h: No such file or directory
make[5]: /usr/src/lib/libarchive/Makefile.inc:6: warning: Command "sed -n '/define.*ARCHIVE_VERSION_ONLY_STRING/{s,[^0-9.],,gp;q;}'  /libarchive/archive.h" exited with status 1
==== END BUILD LOG ====

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Signal Username:  shawn_webb.74
Tor-ified Signal: +1 (719) 756-1197 / activist_opsec.27
https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc