2 # Copyright (C) 2019 Wind River Systems, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 SUMMARY = "A distributed key-value store for shared config and service discovery"
18 etcd is a distributed reliable key-value store for the most critical data \
19 of a distributed system, with a focus on being: \
21 * Simple: well-defined, user-facing API (gRPC) \
22 * Secure: automatic TLS with optional client cert authentication \
23 * Fast: benchmarked 10,000 writes/sec \
24 * Reliable: properly distributed using Raft \
26 HOMEPAGE = "https://github.com/coreos/etcd"
27 LICENSE = "Apache-2.0"
28 LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
31 git://github.com/coreos/etcd.git;branch=release-3.3 \
34 SRCREV = "94745a4eed0425653b3b4275a208d38babceeaec"
35 PV = "3.3.15+git${SRCPV}"
39 inherit go goarch systemd useradd
41 USERADD_PACKAGES = "${PN}"
42 USERADD_PARAM_${PN} = " \
43 --system --shell ${sbindir}/nologin --comment 'etcd user' \
44 --home-dir ${localstatedir}/lib --groups etcd --gid etcd etcd \
46 GROUPADD_PARAM_${PN} = "etcd"
48 TARGET_CC_ARCH += "${LDFLAGS}"
52 export GOARCH="${TARGET_GOARCH}"
54 # Setup vendor directory so that it can be used in GOPATH.
56 # Go looks in a src directory under any directory in GOPATH but
57 # uses 'vendor' instead of 'vendor/src'. We can fix this with a symlink.
59 # We also need to link in the ipallocator directory as that is not under
61 export GOPATH="${B}/src/import/"
62 mkdir -p ${B}/src/import/src/github.com/coreos/
63 ln -s ${S}/src/import ${B}/src/import/src/github.com/coreos/etcd
65 # Pass the needed cflags/ldflags so that cgo
66 # can find the needed headers files and libraries
67 export CGO_ENABLED="1"
70 export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
71 export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
73 if [ "${TARGET_ARCH}" = "x86_64" ]; then
75 elif [ "${TARGET_ARCH}" = "i586" ]; then
83 install -d ${D}/${bindir}
84 install -m 0755 ${B}/bin/etcd ${D}/${bindir}/etcd
85 install -m 0755 ${B}/bin/etcdctl ${D}/${bindir}/etcdctl
87 install -d ${D}${systemd_system_unitdir}
88 install -m 0644 ${S}/src/import/contrib/systemd/etcd.service ${D}${systemd_system_unitdir}
90 # etcd state is in /var/lib/etcd
91 install -d ${D}${sysconfdir}/tmpfiles.d
92 echo "d ${localstatedir}/lib/${BPN} 0755 etcd etcd -" \
93 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
95 # we aren't creating a user, so we need to comment out this line
96 sed -i '/User/s/^/#/' ${D}${systemd_unitdir}/system/etcd.service
99 deltask compile_ptest_base
101 RDEPENDS_${PN} = "bash"
103 # During packaging etcd gets the warning "no GNU hash in elf binary"
104 # This issue occurs due to compiling without ldflags, but a
105 # solution has yet to be found. For now we ignore this error with
107 #INSANE_SKIP_${PN} = "ldflags"