Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-virt / recipes-connectivity / etcd / etcd_git.bb
1
2 SUMMARY = "A distributed key-value store for shared config and service discovery"
3 DESCRIPTION = " \
4     etcd is a distributed reliable key-value store for the most critical data \
5     of a distributed system, with a focus on being: \
6     \
7     * Simple: well-defined, user-facing API (gRPC) \
8     * Secure: automatic TLS with optional client cert authentication \
9     * Fast: benchmarked 10,000 writes/sec \
10     * Reliable: properly distributed using Raft \
11 "
12 HOMEPAGE = "https://github.com/coreos/etcd"
13 LICENSE = "Apache-2.0"
14 LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
15
16 SRC_URI = " \
17     git://github.com/coreos/etcd.git;branch=release-3.3 \
18     "
19
20 SRCREV = "94745a4eed0425653b3b4275a208d38babceeaec"
21 PV = "3.3.15+git${SRCPV}"
22
23 S = "${WORKDIR}/git"
24
25 inherit go goarch systemd useradd
26
27 USERADD_PACKAGES = "${PN}"
28 USERADD_PARAM_${PN} = " \
29     --system --shell ${sbindir}/nologin --comment 'etcd user' \
30     --home-dir ${localstatedir}/lib --groups etcd --gid etcd etcd \
31     "
32 GROUPADD_PARAM_${PN} = "etcd"
33
34 TARGET_CC_ARCH += "${LDFLAGS}"
35 GO_IMPORT = "import"
36
37 do_compile() {
38         export GOARCH="${TARGET_GOARCH}"
39
40         # Setup vendor directory so that it can be used in GOPATH.
41         #
42         # Go looks in a src directory under any directory in GOPATH but
43         # uses 'vendor' instead of 'vendor/src'. We can fix this with a symlink.
44         #
45         # We also need to link in the ipallocator directory as that is not under
46         # a src directory.
47         export GOPATH="${B}/src/import/"
48         mkdir -p ${B}/src/import/src/github.com/coreos/
49         ln -s ${S}/src/import ${B}/src/import/src/github.com/coreos/etcd
50
51         # Pass the needed cflags/ldflags so that cgo
52         # can find the needed headers files and libraries
53         export CGO_ENABLED="1"
54         export CFLAGS=""
55         export LDFLAGS=""
56         export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
57         export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
58
59         if [ "${TARGET_ARCH}" = "x86_64" ]; then
60                 export GOARCH="amd64"
61         elif [ "${TARGET_ARCH}" = "i586" ]; then
62                 export GOARCH="386"
63         fi
64
65         ./src/import/build
66 }
67
68 do_install() {
69         install -d ${D}/${bindir}
70         install -m 0755 ${B}/bin/etcd ${D}/${bindir}/etcd
71         install -m 0755 ${B}/bin/etcdctl ${D}/${bindir}/etcdctl
72
73         install -d ${D}${systemd_system_unitdir}
74         install -m 0644 ${S}/src/import/contrib/systemd/etcd.service ${D}${systemd_system_unitdir}
75
76         # etcd state is in /var/lib/etcd
77         install -d ${D}${sysconfdir}/tmpfiles.d
78         echo "d ${localstatedir}/lib/${BPN} 0755 etcd etcd -" \
79                 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
80
81         # we aren't creating a user, so we need to comment out this line
82         sed -i '/User/s/^/#/' ${D}${systemd_unitdir}/system/etcd.service
83 }
84
85 deltask compile_ptest_base
86
87 RDEPENDS_${PN} = "bash"
88
89 # During packaging etcd gets the warning "no GNU hash in elf binary"
90 # This issue occurs due to compiling without ldflags, but a
91 # solution has yet to be found. For now we ignore this error with
92 # the line below.
93 #INSANE_SKIP_${PN} = "ldflags"