[BACK]Return to builtin.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / archivers / xz

File: [cvs.NetBSD.org] / pkgsrc / archivers / xz / builtin.mk (download)

Revision 1.10, Fri Dec 2 09:17:59 2022 UTC (14 months, 4 weeks ago) by adam
Branch: MAIN
CVS Tags: pkgsrc-2023Q4-base, pkgsrc-2023Q4, pkgsrc-2023Q3-base, pkgsrc-2023Q3, pkgsrc-2023Q2-base, pkgsrc-2023Q2, pkgsrc-2023Q1-base, pkgsrc-2023Q1, pkgsrc-2022Q4-base, pkgsrc-2022Q4
Changes since 1.9: +8 -8 lines

xz: updated to 5.2.9

5.2.9 (2022-11-30)

* liblzma:

- Fixed an infinite loop in LZMA encoder initialization
  if dict_size >= 2 GiB. (The encoder only supports up
  to 1536 MiB.)

- Fixed two cases of invalid free() that can happen if
  a tiny allocation fails in encoder re-initialization
  or in lzma_filters_update(). These bugs had some
  similarities with the bug fixed in 5.2.7.

- Fixed lzma_block_encoder() not allowing the use of
  LZMA_SYNC_FLUSH with lzma_code() even though it was
  documented to be supported. The sync-flush code in
  the Block encoder was already used internally via
  lzma_stream_encoder(), so this was just a missing flag
  in the lzma_block_encoder() API function.

- GNU/Linux only: Don't put symbol versions into static
  liblzma as it breaks things in some cases (and even if
  it didn't break anything, symbol versions in static
  libraries are useless anyway). The downside of the fix
  is that if the configure options --with-pic or --without-pic
  are used then it's not possible to build both shared and
  static liblzma at the same time on GNU/Linux anymore;
  with those options --disable-static or --disable-shared
  must be used too.

# $NetBSD: builtin.mk,v 1.10 2022/12/02 09:17:59 adam Exp $

BUILTIN_PKG:=	xz

BUILTIN_FIND_HEADERS_VAR:=		H_LZMA H_LZMA_VERSION
BUILTIN_FIND_HEADERS.H_LZMA=		lzma.h
BUILTIN_FIND_HEADERS.H_LZMA_VERSION=	lzma/version.h
BUILTIN_FIND_GREP.H_LZMA=		LZMA_

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.xz)
IS_BUILTIN.xz=	no
.  if empty(H_LZMA:M__nonexistent__) && empty(H_LZMA:M${LOCALBASE}/*)
IS_BUILTIN.xz=	yes
.  endif
.endif
MAKEVARS+=	IS_BUILTIN.xz

###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.xz) && ${IS_BUILTIN.xz:tl} == yes
BUILTIN_VERSION.xz!=							\
	${AWK} 'BEGIN { M = "0" }					\
		/\#define[ 	]+LZMA_VERSION_MAJOR/ { M = $$3 }	\
		/\#define[ 	]+LZMA_VERSION_MINOR/ { m = "."$$3 }	\
		/\#define[ 	]+LZMA_VERSION_PATCH/ { p = "."$$3 }	\
		/\#define[ 	]+LZMA_VERSION_STABILITY[ 	]+/ { 	\
			if (split($$3, ss, /_/) == 4 && ss[4] != "STABLE") { \
				s = tolower(ss[4])			\
			}						\
		}							\
		END { printf "%s%s%s%s\n", M, m, p, s}			\
	' ${H_LZMA_VERSION:Q}

BUILTIN_PKG.xz=	xz-${BUILTIN_VERSION.xz}
.endif
MAKEVARS+=	BUILTIN_PKG.xz

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.xz)
.  if ${PREFER.xz} == "pkgsrc"
USE_BUILTIN.xz=	no
.  else
USE_BUILTIN.xz=	${IS_BUILTIN.xz}
.    if defined(BUILTIN_PKG.xz) && ${IS_BUILTIN.xz:tl} == yes
USE_BUILTIN.xz=	yes
.      for _dep_ in ${BUILDLINK_API_DEPENDS.xz}
.        if ${USE_BUILTIN.xz:tl} == yes
USE_BUILTIN.xz!=							\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.xz}; then	\
		${ECHO} yes;						\
	else								\
		${ECHO} no;						\
	fi
.        endif
.      endfor
.    endif
_INCOMPAT_XZ?=	# empty
.    for _pattern_ in ${_INCOMPAT_XZ} ${INCOMPAT_XZ}
.      if !empty(MACHINE_PLATFORM:M${_pattern_})
USE_BUILTIN.xz=	no
.      endif
.    endfor
.  endif  # PREFER.xz
.endif
MAKEVARS+=	USE_BUILTIN.xz

# if USE_XZ is defined, then force the use of a true xz
# implementation.
#
.if defined(USE_XZ)
.  if ${IS_BUILTIN.xz:tl} == no
USE_BUILTIN.xz=	no
.  endif
.endif

###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###

CHECK_BUILTIN.xz?=	no
.if ${CHECK_BUILTIN.xz:tl} == no

.  if ${USE_BUILTIN.xz:tl} == yes
BUILDLINK_FILES.xz+=	lib/pkgconfig/liblzma.pc
.  endif

# Fake pkg-config for builtin xz on NetBSD

.  if ${USE_BUILTIN.xz:tl} == yes
.    if !empty(USE_TOOLS:C/:.*//:Mpkg-config)
do-configure-pre-hook: override-liblzma-pkgconfig

BLKDIR_PKGCFG=		${BUILDLINK_DIR}/lib/pkgconfig
LIBLZMA_PKGCFGF=	liblzma.pc

override-liblzma-pkgconfig: override-message-liblzma-pkgconfig
override-message-liblzma-pkgconfig:
	@${STEP_MSG} "Generating pkg-config files for builtin xz package."

override-liblzma-pkgconfig:
	${RUN}								\
	dst=${BLKDIR_PKGCFG}/${LIBLZMA_PKGCFGF};			\
	src=${BUILDLINK_PREFIX.xz}/lib${LIBABISUFFIX}/pkgconfig/liblzma.pc; \
	if [ ! -f $${dst} ]; then					\
		if [ -f $${src} ]; then					\
			${ECHO_BUILDLINK_MSG} "Symlinking $${src}";	\
			${LN} -sf $${src} $${dst};			\
		else							\
			${MKDIR} ${BLKDIR_PKGCFG};			\
			{						\
			${ECHO} "prefix=${BUILDLINK_PREFIX.xz}";	\
			${ECHO} "exec_prefix=\$${prefix}";		\
			${ECHO} "libdir=\$${exec_prefix}/lib";		\
			${ECHO} "includedir=\$${prefix}/include";	\
			${ECHO} "";					\
			${ECHO} "Name: liblzma";			\
			${ECHO} "Description: Generic purpose data compression library";	\
			${ECHO} "Version: ${BUILTIN_VERSION.xz}";	\
			${ECHO} "Libs: ${COMPILER_RPATH_FLAG}\$${libdir} -L\$${libdir} -llzma";	\
			${ECHO} "Libs.private: -pthread";		\
			${ECHO} "Cflags: -I\$${includedir}";		\
			} > ${BLKDIR_PKGCFG}/${LIBLZMA_PKGCFGF};	\
		fi;							\
	fi
.    endif
.  endif

.endif	# CHECK_BUILTIN.xz