Andrew Geissler | 028142b | 2023-05-05 11:29:21 -0500 | [diff] [blame] | 1 | DESCRIPTION = "etcd is a distributed key-value store for distributed systems" |
| 2 | HOMEPAGE = "https://etcd.io/" |
| 3 | |
| 4 | LICENSE = "Apache-2.0" |
| 5 | LIC_FILES_CHKSUM = "file://${S}/${GO_INSTALL}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" |
| 6 | |
| 7 | SRC_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 Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 11 | file://etcd.service \ |
| 12 | file://etcd-existing.conf \ |
| 13 | file://etcd-new.service \ |
| 14 | file://etcd-new.path \ |
Andrew Geissler | 028142b | 2023-05-05 11:29:21 -0500 | [diff] [blame] | 15 | " |
| 16 | |
| 17 | SRCREV = "215b53cf3b48ee761f4c40908b3874b2e5e95e9f" |
| 18 | UPSTREAM_CHECK_COMMITS = "1" |
| 19 | |
| 20 | GO_IMPORT = "go.etcd.io/etcd/v3" |
| 21 | GO_INSTALL = "src/${GO_IMPORT}/" |
| 22 | |
| 23 | RDEPENDS:${PN}-dev = " \ |
| 24 | bash \ |
| 25 | " |
| 26 | |
| 27 | export GO111MODULE="on" |
| 28 | |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 29 | inherit go systemd pkgconfig features_check |
Andrew Geissler | 028142b | 2023-05-05 11:29:21 -0500 | [diff] [blame] | 30 | |
| 31 | # Go based binaries do not handle being stripped |
| 32 | INHIBIT_PACKAGE_STRIP = "1" |
| 33 | INHIBIT_SYSROOT_STRIP = "1" |
| 34 | |
| 35 | # network is required by go to get dependent packages |
| 36 | do_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 |
| 43 | go_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 Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 56 | REQUIRED_DISTRO_FEATURES = "systemd" |
| 57 | SYSTEMD_PACKAGES = "${PN}" |
| 58 | SYSTEMD_SERVICE:${PN}:append = " etcd.service etcd-new.service etcd-new.path" |
| 59 | |
Andrew Geissler | 028142b | 2023-05-05 11:29:21 -0500 | [diff] [blame] | 60 | do_install:append() { |
| 61 | install -d ${D}${bindir}/ |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 62 | 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 Geissler | 028142b | 2023-05-05 11:29:21 -0500 | [diff] [blame] | 70 | } |
| 71 | |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 72 | FILES:${PN}:append = " ${sysconfdir}/etcd.d/etcd-existing.conf" |
| 73 | |