blob: 0794158a524524b4a0450d08b6fa9519da1f9554 [file] [log] [blame]
Andrew Geissler028142b2023-05-05 11:29:21 -05001DESCRIPTION = "etcd is a distributed key-value store for distributed systems"
2HOMEPAGE = "https://etcd.io/"
3
4LICENSE = "Apache-2.0"
5LIC_FILES_CHKSUM = "file://${S}/${GO_INSTALL}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
6
7SRC_URI = " \
8 git://github.com/etcd-io/etcd;branch=release-3.5;protocol=https \
9 file://0001-xxhash-bump-to-v2.1.2.patch;patchdir=src/${GO_IMPORT} \
10 file://0001-test_lib.sh-remove-gobin-requirement-during-build.patch;patchdir=src/${GO_IMPORT} \
Andrew Geissler3eeda902023-05-19 10:14:02 -050011 file://etcd.service \
12 file://etcd-existing.conf \
13 file://etcd-new.service \
14 file://etcd-new.path \
Andrew Geissler028142b2023-05-05 11:29:21 -050015"
16
17SRCREV = "215b53cf3b48ee761f4c40908b3874b2e5e95e9f"
18UPSTREAM_CHECK_COMMITS = "1"
19
20GO_IMPORT = "go.etcd.io/etcd/v3"
21GO_INSTALL = "src/${GO_IMPORT}/"
22
23RDEPENDS:${PN}-dev = " \
24 bash \
25"
26
27export GO111MODULE="on"
28
Andrew Geissler3eeda902023-05-19 10:14:02 -050029inherit go systemd pkgconfig features_check
Andrew Geissler028142b2023-05-05 11:29:21 -050030
31# Go based binaries do not handle being stripped
32INHIBIT_PACKAGE_STRIP = "1"
33INHIBIT_SYSROOT_STRIP = "1"
34
35# network is required by go to get dependent packages
36do_compile[network] = "1"
37
38# Need to build etcd out of where it is extracted to
39# Need to directly call build script vs. "make build"
40# because "make build" executes the generated binaries
41# at the end of the build which do not run correctly
42# when cross compiling for another machine
43go_do_compile:prepend() {
44 cd ${GO_INSTALL}
45 ./build.sh
46
47
48 # Lots of discussion in go community about how it sets packages to
49 # read-only by default -> https://github.com/golang/go/issues/31481
50 # etcd is going to need some upstream work to support it.
51 # For now, set the packages which are read-only back to
52 # writeable so things like "bitbake -c cleanall etcd" will work.
53 chmod u+w -R ${WORKDIR}/build/pkg/mod
54}
55
Andrew Geissler3eeda902023-05-19 10:14:02 -050056REQUIRED_DISTRO_FEATURES = "systemd"
57SYSTEMD_PACKAGES = "${PN}"
58SYSTEMD_SERVICE:${PN}:append = " etcd.service etcd-new.service etcd-new.path"
59
Andrew Geissler028142b2023-05-05 11:29:21 -050060do_install:append() {
61 install -d ${D}${bindir}/
Andrew Geissler3eeda902023-05-19 10:14:02 -050062 install -m 0755 ${D}${libdir}/go/src/go.etcd.io/etcd/v3/bin/etcd ${D}${bindir}
63 install -m 0755 ${D}${libdir}/go/src/go.etcd.io/etcd/v3/bin/etcdctl ${D}${bindir}
64 install -m 0755 ${D}${libdir}/go/src/go.etcd.io/etcd/v3/bin/etcdutl ${D}${bindir}
65 install -m 0644 ${WORKDIR}/etcd-existing.conf -D -t ${D}${sysconfdir}/etcd.d
66 install -d ${D}${systemd_system_unitdir}
67 install -m 0644 ${WORKDIR}/etcd.service ${D}${systemd_system_unitdir}/
68 install -m 0644 ${WORKDIR}/etcd-new.service ${D}${systemd_system_unitdir}/
69 install -m 0644 ${WORKDIR}/etcd-new.path ${D}${systemd_system_unitdir}/
Andrew Geissler028142b2023-05-05 11:29:21 -050070}
71
Andrew Geissler3eeda902023-05-19 10:14:02 -050072FILES:${PN}:append = " ${sysconfdir}/etcd.d/etcd-existing.conf"
73