aboutsummaryrefslogtreecommitdiff
path: root/devel/p4d/Makefile
blob: 2d55b14d79999acaaeb828a09e5ae03b095381ee (plain) (blame)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# New ports collection makefile for:	perforce
# Date created:				3 Mai 2000
# Whom:					sam@inf.enst.fr
#
# $FreeBSD$
#

PORTNAME=	perforce
PORTVERSION=	${VERSION}
PORTREVISION=	${REVISION}
PORTEPOCH=	1
CATEGORIES=	devel
MASTER_SITES=	ftp://ftp.perforce.com/pub/perforce/r${PORTVERSION}/bin.${PLATFORM}/ \
		http://filehost.perforce.com/perforce/r${PORTVERSION}/bin.${PLATFORM}/
EXTRACT_SUFX=
DISTFILES=	${BIN_FILES} ${SBIN_FILES}
EXTRACT_ONLY=	# none

MAINTAINER=	lth@FreeBSD.org
COMMENT=	Perforce client and server

ONLY_FOR_ARCHS=	i386 amd64 alpha
DIST_SUBDIR=	perforce/${VERSION}/${ARCH}
MD5_FILE=	${MASTERDIR}/distinfo.${PLATFORM}

#
# This is a kludge.  I don't know a better way to set PORTVERSION and
# PORTREVISION such that pkg_version figures out an update is needed
#
ARCH!=	/usr/bin/uname -p
ARCH?=	i386

.if (${ARCH} == i386) || (${ARCH} == amd64)
VERSION=	06.1
REVISION=	4
BIN_FILES=	p4
SBIN_FILES=	p4d p4ftpd p4p p4web
REL_NOTES=	http://www.perforce.com/perforce/doc.061/user/relnotes.txt
.elif ${ARCH} == alpha
VERSION=	99.1
REVISION=	1
PLATFORM=	freebsdaxp
BIN_FILES=	p4
SBIN_FILES=	p4d
REL_NOTES=	http://www.perforce.com/perforce/doc.991/user/relnotes.txt
.else
VERSION=	0
IGNORE=		unsupported platform, sorry
.endif

# End of kludge

RESTRICTED=	Restricted distribution

NO_WRKSUBDIR=	yes

PLIST_FILES=	${BIN_FILES:S+^+bin/+g} \
		${SBIN_FILES:S+^+sbin/+g}

.include <bsd.port.pre.mk>

# Figure out what to install
.if (${ARCH} == i386) || (${ARCH} == amd64)
.if ${OSVERSION} > 504000
.if ${ARCH} == amd64
PLATFORM=	freebsd54x86_64
.else
PLATFORM=	freebsd54x86
.endif
.elif ${OSVERSION} > 400000
PLATFORM=	freebsd4
.else
IGNORE=		only supported on FreeBSD 4.x and greater
.endif
.endif

.if (${ARCH} == amd64) && (${OSVERSION} < 504000)
IGNORE=		amd64 is only supported on FreeBSD 5.4 and later
.endif

# Add compatability dependencies.
.if ${OSVERSION} > 600000
LIB_DEPENDS+=	c_r.5:${PORTSDIR}/misc/compat5x
.elif (${OSVERSION} < 504000) && (${OSVERSION} > 500000)
LIB_DEPENDS+=	c_r.4:${PORTSDIR}/misc/compat4x
.endif

# These variables are all configurable.
PERFORCE_USER?=		p4admin
PERFORCE_UID?=		94
PERFORCE_GROUP?=	p4admin
PERFORCE_GID?=		94
PERFORCE_HOME?=		${LOCALBASE}/perforce
PERFORCE_ROOT?=		${PERFORCE_HOME}/root
PERFORCE_LOGS?=		${PERFORCE_HOME}/logs
PERFORCE_PORT?=		1666
PERFORCE_CACHE?=	${PERFORCE_HOME}/cache
PERFORCE_TARGET?=	perforce:1666

pre-everything::
	@${ECHO} "If the checksums fail, try doing 'make distclean'"
	@${ECHO} "to force getting the latest binaries from Perforce."
	@${ECHO} ""
	@${ECHO} "Read the release notes for this release to determine"
	@${ECHO} "how to migrate the database to the new version.  In"
	@${ECHO} "most instances, it is done automatically.  However,"
	@${ECHO} "sometimes it must be done manually."
	@${ECHO} ""
	@${ECHO} "The release notes for this version are at"
	@${ECHO} ${REL_NOTES}
	@${ECHO} ""
	@${ECHO} "Checkpoint and backup your data before installing!"

do-build:
	${SED}	-e "s,@PERFORCE_ROOT@,${PERFORCE_ROOT},g" \
		-e "s,@PERFORCE_LOGS@,${PERFORCE_LOGS},g" \
		-e "s,@PERFORCE_USER@,${PERFORCE_USER},g" \
		-e "s,@PERFORCE_PORT@,${PERFORCE_PORT},g" \
		-e "s,@PERFORCE_CACHE@,${PERFORCE_CACHE},g" \
		-e "s,@PERFORCE_TARGET@,${PERFORCE_TARGET},g" \
		< ${FILESDIR}/perforce.conf.in > ${WRKSRC}/perforce.conf
	${SED} -e "s,@PREFIX@,${PREFIX},g" \
		< ${FILESDIR}/perforce.sh.in > ${WRKSRC}/perforce.sh

pre-su-install:
	${SETENV} PKG_PREFIX=${PREFIX} \
		PERFORCE_USER=${PERFORCE_USER} \
		PERFORCE_UID=${PERFORCE_UID} \
		PERFORCE_GROUP=${PERFORCE_GROUP} \
		PERFORCE_GID=${PERFORCE_GID} \
		PERFORCE_HOME=${PERFORCE_HOME} \
		PERFORCE_ROOT=${PERFORCE_ROOT} \
		PERFORCE_LOGS=${PERFORCE_LOGS} \
		${SH} ${PKGDIR}/pkg-install ${PORTNAME} PRE-INSTALL

do-install:
.for f in ${BIN_FILES}
	${INSTALL_PROGRAM} ${_DISTDIR}/${f} ${PREFIX}/bin/
.endfor
.for f in ${SBIN_FILES}
	${INSTALL_PROGRAM} ${_DISTDIR}/${f} ${PREFIX}/sbin/
.endfor
	${INSTALL_DATA} ${WRKSRC}/perforce.conf ${PREFIX}/etc/perforce.conf.default; \
	if [ ! -f ${PREFIX}/etc/perforce.conf ]; then \
		${CP} -p ${PREFIX}/etc/perforce.conf.default ${PREFIX}/etc/perforce.conf; \
	fi
	${INSTALL_SCRIPT} ${WRKSRC}/perforce.sh ${PREFIX}/etc/rc.d/

post-install:
	${ECHO_CMD} "@unexec ${RMDIR} ${PERFORCE_ROOT} ${PERFORCE_LOGS} ${PERFORCE_HOME} 2>/dev/null || true" >> ${TMPPLIST}

.include <bsd.port.post.mk>