Yocto recipe: Git

This is a short post give a sample of Yocto recipe which fetches source codes from git server.

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
SUMMARY = "Example"
DESCRIPTION = "Recipes for Example"
LICENSE = "GPL-2.0"
AUTHOR = "Alex Li(Alex.Li@xxxx.com)"
#Path of your LICENSE file and checksum
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"

#Build dependencies
DEPENDS += "boost ark-base ark-log"
#Run time dependencies
RDEPENDS_${PN} = "ark-base ark-log boost-program-options"

#Your git repo address, will be usedby ${SRC_URI}
${PN}_REPO = "github.com/codingspirit/example.git"
#Set to ${AUTOREV} to automatically fetch the newest commit, you can set specific commit id as well
SRCREV_${PN} = "${AUTOREV}"

#Files need to be installed into target need to declare in recipe
FILES_${PN} += "/example/*"

#Set git source, name, protocol, branch, git clone destination. You can use "branch=branchname" to specify branch to require bitbake check after fetching
#"nobranch=1" will skip branch check
SRC_URI = " \
git://${${PN}_REPO};name=${PN};protocol=https;nobranch=1;destsuffix=git/${PN} \
"
# Path of source code. We set it to "git/${PN}" in SRC_URI
S = "${WORKDIR}/git/${PN}"
# Build path, ${BPN} means "The bare name of the recipe"
B = "${WORKDIR}/${BPN}"

inherit cmake