summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install/Makefile
blob: a45c20d564a0bb28ed9a4461d1b0d470ff57b1b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# $NetBSD: Makefile,v 1.105 2004/11/02 00:10:15 erh Exp $

# Notes to package maintainers:
#
# To update this package, import from src/usr.sbin/pkg_install.
#
# Updating this package does not automatically necessitate bumping
# PKGTOOLS_REQD in bsd.pkg.mk. Do so if and only if there is a critical
# change in the pkg_* tools that pkgsrc relies on for proper operation.

DISTNAME=		pkg_install-${VERSION}
CATEGORIES=		pkgtools
MASTER_SITES=		# empty
DISTFILES=		# empty

MAINTAINER=		tech-pkg@NetBSD.org
HOMEPAGE=		http://www.pkgsrc.org/
COMMENT=		Package management and administration tools for pkgsrc

GNU_CONFIGURE=		# defined
CONFIGURE_ARGS+=	--with-pkgdbdir=${PKG_DBDIR}
CONFIGURE_ARGS+=	--with-ftp=${FETCH_CMD}
CONFIGURE_ARGS+=	--with-mtree=${MTREE}
CONFIGURE_ARGS+=	--with-pax=${PAX}
CONFIGURE_ARGS+=	--with-tar=${TAR}

NO_PKGTOOLS_REQD_CHECK=	# defined
NO_BUILDLINK=		# defined
NO_CHECKSUM=		# defined
NO_MTREE=		# defined
PKG_PRESERVE=		# defined

# These are needed to solve a chicken-and-egg problem where pkgsrc uses
# newer features of pkg_install, but older NetBSD installations won't
# support them.  In this case, we explicitly use the native GCC
# compiler to avoid problems with depending on pkgsrc GCC for building
# pkg_install.  We also avoid building digest as that would involve
# using the newer pkg_install tools.
# We also use the newly built pkg_delete since upgrading from
# an older pkg_install might required features of the new program.
#
USE_NATIVE_GCC=		yes
USE_DIGEST=		no
PKG_DELETE=	${WRKSRC}/delete/pkg_delete

PLIST_SUBST+=		MANDIR=${MANDIR}
PLIST_SUBST+=		PKG_TOOLS_BIN=${PKG_TOOLS_BIN}

CPPFLAGS+=		-DDEF_UMASK=${DEF_UMASK}

MAKE_ENV+=		MACHINE_ARCH="${MACHINE_ARCH}"
MAKE_ENV+=		OPSYS="${OPSYS}"

PKG_DBDIR?=		/var/db/pkg
PKG_INFO=		PKG_DBDIR=${PKG_DBDIR} ${PKG_INFO_CMD}
PKG_ADMIN=		PKG_DBDIR=${PKG_DBDIR} ${PKG_ADMIN_CMD}

.include "../../mk/bsd.prefs.mk"

VERSION!=		${AWK} -F '"' '/PKGTOOLS_VERSION/ {print $$2}' \
			${FILESDIR}/lib/version.h

do-extract:
	@${CP} -Rp ${FILESDIR} ${WRKSRC}

post-install:
	if [ ! -f ${PKG_DBDIR}/pkgdb.byfile.db ]; then			\
		if [ ! -d ${PKG_DBDIR} ]; then				\
			${INSTALL_DATA_DIR} ${PKG_DBDIR};		\
		fi;							\
		${PKG_ADMIN} rebuild;					\
	fi

.include "../../pkgtools/libnbcompat/inplace.mk"
.include "../../mk/bsd.pkg.mk"

PREFIX:=		${PKG_TOOLS_BIN:C|/[^/]?bin$||}
.if ${PREFIX} == "/usr"
CONFIGURE_ARGS+=	--mandir=${PREFIX}/share/man
MANDIR=			share/
.else
CONFIGURE_ARGS+=	--mandir=${PREFIX}/man
MANDIR=			# empty
.endif