pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Replace platform detection with initial builtin.mk.



Module Name:	pkgsrc-wip
Committed By:	Amitai Schleier <schmonz%NetBSD.org@localhost>
Pushed By:	schmonz
Date:		Tue Jul 14 15:59:59 2020 -0400
Changeset:	3bfdd58e61113aa636d25ba9dd3a87a9623a64b3

Modified Files:
	libbsd/Makefile
	libbsd/buildlink3.mk
Added Files:
	libbsd/builtin.mk
Removed Files:
	libbsd/Makefile.common

Log Message:
Replace platform detection with initial builtin.mk.

While here, bump BUILDLINK_API_DEPENDS for security fixes and heed pkglint.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3bfdd58e61113aa636d25ba9dd3a87a9623a64b3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 libbsd/Makefile        |  8 ++------
 libbsd/Makefile.common | 18 ------------------
 libbsd/buildlink3.mk   | 13 +++----------
 libbsd/builtin.mk      | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+), 34 deletions(-)

diffs:
diff --git a/libbsd/Makefile b/libbsd/Makefile
index bab080a709..2d9e98ff8a 100644
--- a/libbsd/Makefile
+++ b/libbsd/Makefile
@@ -1,18 +1,14 @@
 # $NetBSD: Makefile,v 1.1 2013/01/03 21:11:34 mrampke Exp $
 
 DISTNAME=	libbsd-0.10.0
+CATEGORIES=	devel
 MASTER_SITES=	http://libbsd.freedesktop.org/releases/
 EXTRACT_SUFX=	.tar.xz
 
-CATEGORIES=	devel
-
+MAINTAINER=	matthias%rampke.de@localhost
 HOMEPAGE=	https://libbsd.freedesktop.org/
 COMMENT=	Compatibility library for BSD functions under other systems
 LICENSE=	original-bsd
-MAINTAINER=	matthias%rampke.de@localhost
-
-.include "Makefile.common"
-ONLY_FOR_PLATFORM= ${LIBBSD.only_for_platform}
 
 GNU_CONFIGURE=	yes
 USE_LIBTOOL=	yes
diff --git a/libbsd/Makefile.common b/libbsd/Makefile.common
deleted file mode 100644
index 435e71bfd2..0000000000
--- a/libbsd/Makefile.common
+++ /dev/null
@@ -1,18 +0,0 @@
-# $NetBSD: Makefile.common,v 1.1 2013/01/03 21:11:34 mrampke Exp $
-#
-# Determine if libbsd can be built on this platform
-#
-# if so, USELIBBSD will be defined and including buildlink3.mk will
-# link your package against it if not, including buildlink3.mk will be a
-# noop.
-#
-# define here for which platforms libbsd is available
-LIBBSD.only_for_platform=	Linux-*-*
-# stop editing here
-
-.include "../../mk/bsd.prefs.mk"
-.for p in ${LIBBSD.only_for_platform}
-.  if !empty(MACHINE_PLATFORM:M${p})
-USE_LIBBSD=		yes
-.  endif
-.endfor
diff --git a/libbsd/buildlink3.mk b/libbsd/buildlink3.mk
index 3a5d98df5d..6e21144449 100644
--- a/libbsd/buildlink3.mk
+++ b/libbsd/buildlink3.mk
@@ -1,19 +1,12 @@
 # $NetBSD: buildlink3.mk,v 1.2 2013/01/03 21:41:42 mrampke Exp $
 
-# check if available on this platform
-#
-.include "Makefile.common"
-.if defined(USE_LIBBSD)
-
 BUILDLINK_TREE+=	libbsd
 
-.  if !defined(LIBBSD_BUILDLINK3_MK)
+.if !defined(LIBBSD_BUILDLINK3_MK)
 LIBBSD_BUILDLINK3_MK:=
 
-BUILDLINK_API_DEPENDS.libbsd+=	libbsd>=0.4.2
+BUILDLINK_API_DEPENDS.libbsd+=	libbsd>=0.10.0
 BUILDLINK_PKGSRCDIR.libbsd?=	../../wip/libbsd
-.  endif	# LIBBSD_BUILDLINK3_MK
+.endif	# LIBBSD_BUILDLINK3_MK
 
 BUILDLINK_TREE+=	-libbsd
-
-.endif
diff --git a/libbsd/builtin.mk b/libbsd/builtin.mk
new file mode 100644
index 0000000000..09145fbb5b
--- /dev/null
+++ b/libbsd/builtin.mk
@@ -0,0 +1,47 @@
+# $NetBSD: builtin.mk,v 1.6 2019/11/03 10:39:08 rillig Exp $
+
+BUILTIN_PKG:=	libbsd
+
+BUILTIN_FIND_HEADERS_VAR:=	H_LIBBSD
+BUILTIN_FIND_HEADERS.H_LIBBSD=	bsd/bsd.h
+
+.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.libbsd)
+IS_BUILTIN.libbsd=	no
+.  if empty(H_LIBBSD:M__nonexistent__) && empty(H_LIBBSD:M${LOCALBASE}/*)
+IS_BUILTIN.libbsd=	yes
+.  endif
+.endif
+MAKEVARS+=		IS_BUILTIN.libbsd
+
+###
+### 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.libbsd)
+.  if ${PREFER.libbsd} == "pkgsrc"
+USE_BUILTIN.libbsd=	no
+.  else
+USE_BUILTIN.libbsd=	${IS_BUILTIN.libbsd}
+.    if defined(BUILTIN_PKG.libbsd) && \
+        !empty(IS_BUILTIN.libbsd:M[yY][eE][sS])
+USE_BUILTIN.libbsd=	yes
+.      for _dep_ in ${BUILDLINK_API_DEPENDS.libbsd}
+.        if !empty(USE_BUILTIN.libbsd:M[yY][eE][sS])
+USE_BUILTIN.libbsd!=							\
+	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.libbsd:Q}; then	\
+		${ECHO} yes;						\
+	else								\
+		${ECHO} no;						\
+	fi
+.        endif
+.      endfor
+.    endif
+.  endif  # PREFER.libbsd
+.endif
+MAKEVARS+=		USE_BUILTIN.libbsd


Home | Main Index | Thread Index | Old Index