summaryrefslogtreecommitdiff
path: root/pkgtools/pkg/Makefile
blob: 57af0bb3ac1b9dcc608b384e79c79953106b8510 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# $NetBSD: Makefile,v 1.8 2016/10/27 00:24:58 khorben Exp $

DISTNAME=	pkg-1.8.7
PKGREVISION=	3
CATEGORIES=	pkgtools
MASTER_SITES=	http://files.etoilebsd.net/pkg/
EXTRACT_SUFX=	.tar.xz

MAINTAINER=	khorben@defora.org
HOMEPAGE=	https://wiki.freebsd.org/pkgng
COMMENT=	Package management tool for FreeBSD
LICENSE=	2-clause-bsd

GNU_CONFIGURE=	yes
USE_LANGUAGES=	c

CPPFLAGS+=	-D_LOCALBASE="\"${PREFIX}\""
CPPFLAGS+=	-DPORTSDIR="\"${PKGSRCDIR}\""

AUTO_MKDIRS=	yes

EGDIR=		${PREFIX}/share/examples/pkg

CONF_FILES+=	${EGDIR}/bash_completion.d/_pkg.bash \
		${PKG_SYSCONFDIR}/bash_completion.d/_pkg.bash
CONF_FILES+=	${EGDIR}/periodic/daily/411.pkg-backup \
		${PKG_SYSCONFDIR}/periodic/daily/411.pkg-backup
CONF_FILES+=	${EGDIR}/periodic/daily/490.status-pkg-changes \
		${PKG_SYSCONFDIR}/periodic/daily/490.status-pkg-changes
CONF_FILES+=	${EGDIR}/periodic/security/410.pkg-audit \
		${PKG_SYSCONFDIR}/periodic/security/410.pkg-audit
CONF_FILES+=	${EGDIR}/periodic/security/460.pkg-checksum \
		${PKG_SYSCONFDIR}/periodic/security/460.pkg-checksum
CONF_FILES+=	${EGDIR}/periodic/weekly/400.status-pkg \
		${PKG_SYSCONFDIR}/periodic/weekly/400.status-pkg
CONF_FILES+=	${EGDIR}/pkg.conf.sample \
		${PKG_SYSCONFDIR}/pkg.conf

SUBST_CLASSES+=	manpages-prefix
SUBST_STAGE.manpages-prefix=	pre-install
SUBST_FILES.manpages-prefix=	docs/pkg-install.8 docs/pkg-repo.8
SUBST_FILES.manpages-prefix+=	docs/pkg-search.8 docs/pkg-update.8
SUBST_FILES.manpages-prefix+=	docs/pkg-upgrade.8 docs/pkg.8
SUBST_FILES.manpages-prefix+=	docs/pkg.conf.5
SUBST_SED.manpages-prefix+=	-e "s|/usr/local|${PREFIX}|g"
SUBST_MESSAGE.manpages-prefix=	Correct the installation prefix in manual pages.

SUBST_CLASSES+=	pkgconf-prefix
SUBST_STAGE.pkgconf-prefix=	pre-install
SUBST_FILES.pkgconf-prefix=	src/pkg.conf.sample
SUBST_SED.pkgconf-prefix+=	-e "s|/usr/local|${PREFIX}|g"
SUBST_MESSAGE.pkgconf-prefix=	Correct the installation prefix in pkg.conf(5).

SUBST_CLASSES+=	portsdir
SUBST_STAGE.portsdir=		pre-install
SUBST_FILES.portsdir=		libpkg/pkg_config.c \
				src/pkg.conf.sample \
				docs/pkg-create.8 \
				docs/pkg-set.8 \
				docs/pkg-repo.8 \
				docs/pkg.conf.5 \
				docs/pkg-version.8 \
				docs/pkg.8
SUBST_SED.portsdir=		-e "s|/usr/ports|${PORTSDIR}|g" \
				-e "s|/var/db/pkg|/var/db/pkgng|g" \
				-e "s|/var/cache/pkg|/var/cache/pkgng|g"
SUBST_MESSAGE.portsdir=		Correct reference to FreeBSD portsdir.

.if defined(PACKAGE_BUILDING) # set by Synth which has custom location, so use default path
PORTSDIR=	/usr/pkgsrc
.else
PORTSDIR=	${PKGSRCDIR}
.endif

# DragonFly SSL libraries are private.  pkg(8) is the one exception of a userland
# program that is allowed to link to them due to bootstrap reasons
.if exists(/usr/lib/priv/libprivate_ssl.so)
BUILDLINK_PASSTHRU_RPATHDIRS=	/lib/priv
.endif

post-patch:
	${CP} ${FILESDIR}/readpassphrase_compat.h \
		${WRKSRC}/src/

# DragonFly SSL libraries are private.
.if exists(/usr/lib/priv/libprivate_ssl.so)
	${SED} -i.bak \
		-e 's|lssl|lprivate_ssl|' \
		-e 's|lcrypto|lprivate_crypto|' \
		-e 's|la_rpath = |la_rpath = -R/lib/priv |' \
		${WRKSRC}/libpkg/Makefile.in \
		${WRKSRC}/src/Makefile.in \
		${WRKSRC}/tests/Makefile.in
	${SED} -i.bak \
		-e '/OS_CFLAGS=/ s|SOURCE|SOURCE -I/usr/include/priv|' \
		-e '/OS_LDFLAGS=/ s|=|="-L/usr/lib/priv -R/lib/priv"|' \
		${WRKSRC}/configure
.endif

post-install:
	${RM} ${DESTDIR}${PREFIX}/sbin/pkg2ng
	${MV} ${DESTDIR}${PREFIX}/etc/bash_completion.d/_pkg.bash \
		${DESTDIR}${EGDIR}/bash_completion.d/_pkg.bash
	${RMDIR} ${DESTDIR}${PREFIX}/etc/bash_completion.d
	${MV} ${DESTDIR}${PREFIX}/etc/periodic/daily/411.pkg-backup \
		${DESTDIR}${EGDIR}/periodic/daily/411.pkg-backup
	${MV} ${DESTDIR}${PREFIX}/etc/periodic/daily/490.status-pkg-changes \
		${DESTDIR}${EGDIR}/periodic/daily/490.status-pkg-changes
	${RMDIR} ${DESTDIR}${PREFIX}/etc/periodic/daily
	${MV} ${DESTDIR}${PREFIX}/etc/periodic/security/410.pkg-audit \
		${DESTDIR}${EGDIR}/periodic/security/410.pkg-audit
	${MV} ${DESTDIR}${PREFIX}/etc/periodic/security/460.pkg-checksum \
		${DESTDIR}${EGDIR}/periodic/security/460.pkg-checksum
	${RMDIR} ${DESTDIR}${PREFIX}/etc/periodic/security
	${MV} ${DESTDIR}${PREFIX}/etc/periodic/weekly/400.status-pkg \
		${DESTDIR}${EGDIR}/periodic/weekly/400.status-pkg
	${RMDIR} ${DESTDIR}${PREFIX}/etc/periodic/weekly
	${MV} ${DESTDIR}${PREFIX}/etc/pkg.conf.sample \
		${DESTDIR}${EGDIR}/pkg.conf.sample

.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} != "FreeBSD" && ${OPSYS} != "DragonFly" && ${OPSYS} != "NetBSD"
.include "../../archivers/libarchive/buildlink3.mk"
.endif
.include "../../mk/bsd.pkg.mk"