p4 - Initial add.
[vuplus_openembedded] / packages / 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 HOMEPAGE = "http://www.perforce.com"
6 DESCRIPTION = "Perforce client and server binaries"
7 MAINTAINER = "Raymond Danks <info-linux@geode.amd.com>"
8 LICENSE = "Perforce"
9
10 def get_kernelmajorversion(p):
11         import re
12         r = re.compile("([0-9]+\.[0-9]+).*")
13         m = r.match(p);
14         if m:
15                 return m.group(1)
16         return None
17
18 def p4_arch(d):
19         import bb, re
20         arch = bb.data.getVar('TARGET_ARCH', d, 1)
21         os = bb.data.getVar('TARGET_OS', d, 1)
22
23         if re.match("^linux.*$", os):
24                 r = re.compile("([0-9]+\.[0-9]+).*")
25                 m = r.match(base_read_file(bb.data.expand('${STAGING_KERNEL_DIR}/kernel-abiversion', d)));
26                 os = "linux"
27                 if m and re.match("^.*86.*$", arch):
28                         os = "linux%s" % m.group(1).replace('.','')
29
30         if re.match("^i.86$", arch):
31                 arch = "x86"
32         elif arch == "x86_64":
33                 arch = "amd64"
34         elif re.match("^mips.*$", arch):
35                 arch = "mips"
36
37         return "%s%s" % (os, arch)
38
39 P4ARCH="${@p4_arch(d)}"
40 P4BASEURL="http://filehost.perforce.com/perforce/r${PV}/bin.${P4ARCH}"
41 S="${WORKDIR}"
42
43 #Because these files are all named the same thing, regardless of version or arch
44 PREMIRRORS=""
45 DL_DIR="${WORKDIR}/${P4ARCH}"
46
47 SRC_URI="\
48         ${P4BASEURL}/p4 \
49         ${P4BASEURL}/p4api.tar \
50         ${P4BASEURL}/p4d \
51         ${P4BASEURL}/p4ftpd \
52         ${P4BASEURL}/p4p \
53         ${P4BASEURL}/p4web"
54
55 PACKAGES += " ${PN}-server"
56 FILES_${PN} = " ${bindir}/p4"
57 FILES_${PN}-server = " ${bindir}/p4d ${bindir}/p4ftpd ${bindir}/p4p ${bindir}/p4web"
58
59 do_stage() {
60         install -d ${STAGING_INCDIR}/p4api
61         install -m 0644 *.h ${STAGING_INCDIR}/p4api/
62
63         oe_libinstall -a libclient ${STAGING_LIBDIR}
64         oe_libinstall -a librpc ${STAGING_LIBDIR}
65         oe_libinstall -a libsupp ${STAGING_LIBDIR}
66 }
67
68 do_install() {
69         install -d ${D}${bindir}
70         install -d ${D}${includedir}/p4api
71         install -d ${D}${libdir}
72
73         install -m 0644 *.h ${D}${includedir}/p4api/
74         for p4bin in p4 p4d p4ftpd p4p p4web ; do
75                 install -m 0755 $p4bin ${D}${bindir}/
76         done
77
78         oe_libinstall -a libclient ${D}${libdir}/
79         oe_libinstall -a librpc ${D}${libdir}/
80         oe_libinstall -a libsupp ${D}${libdir}/
81 }