Merge branch 'org.openembedded.dev' of git@git.openembedded.net:openembedded into...
[openembedded.git] / recipes / p4 / p4.inc
1 # p4 .bb build file
2 # Copyright (C) 2006, Advanced Micro Devices, Inc.  All Rights Reserved
3 # Released under the MIT license (see /COPYING)
4
5 DESCRIPTION = "Perforce client and server binaries"
6 HOMEPAGE = "http://www.perforce.com"
7 LICENSE = "Perforce"
8
9 def p4_arch(d):
10         import bb, re
11         arch = bb.data.getVar('TARGET_ARCH', d, 1)
12         os = bb.data.getVar('TARGET_OS', d, 1)
13
14         if re.match("^linux.*$", os):
15                 r = re.compile("([0-9]+\.[0-9]+).*")
16                 m = r.match(base_read_file(bb.data.expand('${STAGING_KERNEL_DIR}/kernel-abiversion', d)));
17                 os = "linux"
18                 if m and re.match("^.*86.*$", arch):
19                         os = "linux%s" % m.group(1).replace('.','')
20
21         if re.match("^i.86$", arch):
22                 arch = "x86"
23         elif arch == "x86_64":
24                 arch = "amd64"
25         elif re.match("^mips.*$", arch):
26                 arch = "mips"
27
28         return "%s%s" % (os, arch)
29
30 P4ARCH = "${@p4_arch(d)}"
31 P4BASEURL = "http://filehost.perforce.com/perforce/r${PV}/bin.${P4ARCH}"
32
33 #Because these files are all named the same thing, regardless of version or arch
34 PREMIRRORS=""
35 DL_DIR="${WORKDIR}/${P4ARCH}"
36
37 SRC_URI="\
38         ${P4BASEURL}/p4 \
39         ${P4BASEURL}/p4api.tar \
40         ${P4BASEURL}/p4d \
41         ${P4BASEURL}/p4ftpd \
42         ${P4BASEURL}/p4p \
43         ${P4BASEURL}/p4web"
44 S = "${WORKDIR}"
45
46 PACKAGES += " ${PN}-server"
47 FILES_${PN} = " ${bindir}/p4"
48 FILES_${PN}-server = " ${bindir}/p4d ${bindir}/p4ftpd ${bindir}/p4p ${bindir}/p4web"
49
50 do_stage() {
51         install -d ${STAGING_INCDIR}/p4api
52         install -m 0644 *.h ${STAGING_INCDIR}/p4api/
53
54         oe_libinstall -a libclient ${STAGING_LIBDIR}
55         oe_libinstall -a librpc ${STAGING_LIBDIR}
56         oe_libinstall -a libsupp ${STAGING_LIBDIR}
57 }
58
59 do_install() {
60         install -d ${D}${bindir}
61         install -d ${D}${includedir}/p4api
62         install -d ${D}${libdir}
63
64         install -m 0644 *.h ${D}${includedir}/p4api/
65         for p4bin in p4 p4d p4ftpd p4p p4web ; do
66                 install -m 0755 $p4bin ${D}${bindir}/
67         done
68
69         oe_libinstall -a libclient ${D}${libdir}/
70         oe_libinstall -a librpc ${D}${libdir}/
71         oe_libinstall -a libsupp ${D}${libdir}/
72 }