summaryrefslogtreecommitdiff
path: root/recipes-support/snapd/snapd_2.25.bb
blob: 7ea5349faae45c2476ffbcad523f60960bf35928 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
SUMMARY = "The snapd and snap tools enable systems to work with .snap files."
HOMEPAGE = "https://www.snapcraft.io"
LICENSE = "GPL-3.0"
LIC_FILES_CHKSUM = "file://${WORKDIR}/${PN}-${PV}/COPYING;md5=d32239bcb673463ab874e80d47fae504"

SRC_URI = " \
	https://github.com/snapcore/snapd/releases/download/${PV}/snapd_${PV}.vendor.tar.xz \
	file://0001-cmd-make-rst2man-optional.patch \
"

SRC_URI[md5sum] = "453ffdc2ecdbb7058ac193f81ac37135"
SRC_URI[sha256sum] = "accd4c94049ce79443ff995c27111f3851e9896bbad502dd5d341f8847645b90"

GO_IMPORT = "github.com/snapcore/snapd"

DEPENDS += " \
	virtual/${TARGET_PREFIX}go \
	glib-2.0 \
	python3-docutils-native \
	udev \
	xfsprogs \
"

RDEPENDS_${PN} += " \
	ca-certificates \
	kernel-module-squashfs \
"

S = "${WORKDIR}/${PN}-${PV}"

ARM_INSTRUCTION_SET = "arm"

EXTRA_OECONF += " \
	--disable-apparmor \
	--disable-seccomp \
	--libexecdir=${libdir}/snapd \
"

inherit systemd go autotools pkgconfig python3native

# Our tools build with autotools are inside the cmd subdirectory
# and we need to tell the autotools class to look in there.
AUTOTOOLS_SCRIPT_PATH = "${S}/cmd"

SYSTEMD_SERVICE_${PN} = "snapd.service"

do_configure_prepend() {
	(cd ${S} ; ./mkversion.sh ${PV})
}
do_configure_append() {
	go_do_configure
}

do_compile() {
	# Ensure we our component at the right place in our GOPATH
	mkdir -p ${STAGING_LIBDIR}/${TARGET_SYS}/go/src/github.com/snapcore
	ln -sf ${S} ${STAGING_LIBDIR}/${TARGET_SYS}/go/src/github.com/snapcore/snapd

	for d in snap snapd snap-exec snapctl; do
		GOPATH=${STAGING_LIBDIR}/${TARGET_SYS}/go ${GO} build -x github.com/snapcore/snapd/cmd/$d
	done

	oe_runmake
}

do_install() {
	install -d ${D}${libdir}/snapd
	install -d ${D}${bindir}
	install -d ${D}${systemd_unitdir}/system
	install -d ${D}/var/lib/snapd
	install -d ${D}/var/lib/snapd/snaps
	install -d ${D}/var/lib/snapd/lib/gl
	install -d ${D}/var/lib/snapd/desktop
	install -d ${D}/var/snap
	install -d ${D}${sysconfdir}/profile.d

	oe_runmake -C ${B} install DESTDIR=${D}
	oe_runmake -C ${S}/data/systemd install DESTDIR=${D}

	install -m 0755 ${B}/snapd ${D}${libdir}/snapd/
	install -m 0755 ${B}/snap-exec ${D}${libdir}/snapd/
	install -m 0755 ${B}/snap ${D}${bindir}
	install -m 0755 ${B}/snapctl ${D}${bindir}

	echo "PATH=\$PATH:/snap/bin" > ${D}${sysconfdir}/profile.d/20-snap.sh
}

RDEPENDS_${PN} += "squashfs-tools"
FILES_${PN} += " \
	${systemd_unitdir}/system/ \
	/var/lib/snapd \
	/var/snap \
	${baselib}/udev/snappy-app-dev \
"

# ERROR: snapd-2.23.5-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary:
# '.../snapd/usr/lib/snapd/snap-exec' [ldflags]
INSANE_SKIP_${PN} = "ldflags"