summaryrefslogtreecommitdiff
path: root/packages/p4/p4.inc
blob: 9439f736744bb313f18b9cb042507b2ddd534855 (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
# p4 .bb build file
# Copyright (C) 2006, Advanced Micro Devices, Inc.  All Rights Reserved
# Released under the MIT license (see /COPYING)

DESCRIPTION = "Perforce client and server binaries"
HOMEPAGE = "http://www.perforce.com"
LICENSE = "Perforce"

def p4_arch(d):
	import bb, re
	arch = bb.data.getVar('TARGET_ARCH', d, 1)
	os = bb.data.getVar('TARGET_OS', d, 1)

	if re.match("^linux.*$", os):
		r = re.compile("([0-9]+\.[0-9]+).*")
		m = r.match(base_read_file(bb.data.expand('${STAGING_KERNEL_DIR}/kernel-abiversion', d)));
		os = "linux"
		if m and re.match("^.*86.*$", arch):
			os = "linux%s" % m.group(1).replace('.','')

	if re.match("^i.86$", arch):
		arch = "x86"
	elif arch == "x86_64":
		arch = "amd64"
	elif re.match("^mips.*$", arch):
		arch = "mips"

	return "%s%s" % (os, arch)

P4ARCH = "${@p4_arch(d)}"
P4BASEURL = "http://filehost.perforce.com/perforce/r${PV}/bin.${P4ARCH}"

#Because these files are all named the same thing, regardless of version or arch
PREMIRRORS=""
DL_DIR="${WORKDIR}/${P4ARCH}"

SRC_URI="\
	${P4BASEURL}/p4 \
	${P4BASEURL}/p4api.tar \
	${P4BASEURL}/p4d \
	${P4BASEURL}/p4ftpd \
	${P4BASEURL}/p4p \
	${P4BASEURL}/p4web"
S = "${WORKDIR}"

PACKAGES += " ${PN}-server"
FILES_${PN} = " ${bindir}/p4"
FILES_${PN}-server = " ${bindir}/p4d ${bindir}/p4ftpd ${bindir}/p4p ${bindir}/p4web"

do_stage() {
	install -d ${STAGING_INCDIR}/p4api
	install -m 0644 *.h ${STAGING_INCDIR}/p4api/

	oe_libinstall -a libclient ${STAGING_LIBDIR}
	oe_libinstall -a librpc ${STAGING_LIBDIR}
	oe_libinstall -a libsupp ${STAGING_LIBDIR}
}

do_install() {
	install -d ${D}${bindir}
	install -d ${D}${includedir}/p4api
	install -d ${D}${libdir}

	install -m 0644 *.h ${D}${includedir}/p4api/
	for p4bin in p4 p4d p4ftpd p4p p4web ; do
		install -m 0755 $p4bin ${D}${bindir}/
	done

	oe_libinstall -a libclient ${D}${libdir}/
	oe_libinstall -a librpc ${D}${libdir}/
	oe_libinstall -a libsupp ${D}${libdir}/
}