xref: /freebsd/share/mk/bsd.pkg.pre.mk (revision bb75b0d581f74e22a68d7868ad1f5da1146a8de0)
1# SPDX-License-Identifier: ISC
2#
3# Copyright (c) 2026 Lexi Winter <ivy@FreeBSD.org>
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
17# Variable definitions used by bsd.pkg.mk.  All of these may be overridden:
18#
19# PKG_CMD	The pkg command.  [pkg]
20# PKG_FORMAT	The archive format used when creating packages.  One of
21# 		"tzst", "txz", "tbz", "tgz" or "tar".  [tzst]
22# PKG_LEVEL	The compression level for compressed package formats.
23# 		The meaning depends on the exact format, or one of the
24# 		special values "fast" or "best" may be used. [-1]
25# PKG_CTHREADS	How many threads to use when creating compressed packages.
26# 		Set to "0" or "auto" to auto-detect based on the number
27# 		of CPUs.  [0]
28# PKG_ABI_FILE	The file used to determine the ABI to use when creating
29# 		packages.  This should refer to the system being built,
30# 		not the host system. [${WSTAGEDIR}/usr/bin/uname}
31#
32#
33# Package metadata:
34#
35# PKG_NAME_PREFIX	The prefix to use for package names.  [FreeBSD]
36# PKG_MAINTAINER	The package maintainer.  [re@FreeBSD.org]
37# PKG_WWW		The package website.  [https://www.FreeBSD.org]
38#
39#
40# Only if _PKG_NEED_ABI is defined:
41#
42# PKG_ABI	The ABI string to use when creating packages.  [autodetected]
43#
44.if !target(__<bsd.pkg.pre.mk>__)
45__<bsd.pkg.pre.mk>__:  .NOTMAIN
46
47# How we invoke pkg.
48PKG_CMD?=	pkg
49PKG_FORMAT?=	tzst
50PKG_LEVEL?=	-1
51PKG_CLEVEL=	${"${PKG_FORMAT:Mtar}" != "":?:-l ${PKG_LEVEL}}
52PKG_CTHREADS?=	0
53PKG_ABI_FILE?=	${WSTAGEDIR}/usr/bin/uname
54
55# These are used in the generated packages, and can be overridden for
56# downstream builds.
57PKG_NAME_PREFIX?=	FreeBSD
58PKG_MAINTAINER?=	re@FreeBSD.org
59PKG_WWW?=		https://www.FreeBSD.org
60
61# These can be set per-package.
62PKG_LICENSELOGIC?=	single
63PKG_LICENSES?=		BSD2CLAUSE
64PKG_SETS?=		optional optional-jail
65
66# The set annotation may be removed in the future, so don't rely on
67# it being here.
68PKG_ANNOTATIONS+=	set
69PKG_ANNOTATIONS.set=	${PKG_SETS:ts,:[*]}
70
71.endif	# !target(__<bsd.pkg.pre.mk>__)
72
73# This always needs to be evaluated since something may have previously
74# included us without setting _PKG_NEED_ABI.
75.if defined(_PKG_NEED_ABI)
76
77. if !defined(PKG_ABI)
78PKG_ABI!=		${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI
79. endif
80
81# Usually SRCRELDATE comes from Makefile.inc1, but if it's missing,
82# find it ourselves.
83. if !defined(PKG_OSVERSION)
84.  if defined(SRCRELDATE)
85PKG_OSVERSION=	${SRCRELDATE}
86.  else
87PKG_OSVERSION!=	awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
88		${SRCTOP}/sys/sys/param.h
89.  endif
90. endif
91
92.endif	# defined(_PKG_NEED_ABI)
93