aboutsummaryrefslogtreecommitdiffstats
path: root/dev-util/pico-sdk/pico-sdk-1.4.0.ebuild
blob: 65941e90558a2725a290004107c6389ca2e8f9c4 (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
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CYW43_COMMIT="195dfcc10bb6f379e3dea45147590db2203d3c7b"
LWIP_COMMIT="239918ccc173cb2c2a62f41a40fd893f57faf1d6"
TINYUSB_COMMIT="4bfab30c02279a0530e1a56f4a7c539f2d35a293"

DESCRIPTION="Raspberry Pi Pico SDK"
HOMEPAGE="https://github.com/raspberrypi/pico-sdk/"
IUSE="cyw43 examples lwip tinyusb"
SRC_URI="https://github.com/raspberrypi/${PN}/archive/refs/tags/${PV}.zip -> ${PN}-${PV}.zip
		cyw43? ( https://github.com/georgerobotics/cyw43-driver/archive/${CYW43_COMMIT}.zip -> ${P}-cyw43.zip )
		examples? ( https://github.com/raspberrypi/pico-examples/archive/refs/tags/sdk-${PV}.zip -> ${P}-examples.zip )
		lwip? ( https://git.savannah.gnu.org/cgit/lwip.git/snapshot/lwip-${LWIP_COMMIT}.tar.gz -> ${P}-lwip.tar.gz )
		tinyusb? ( https://github.com/hathach/tinyusb/archive/${TINYUSB_COMMIT}.zip -> ${P}-tinyusb.zip )"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64"

DEPEND="
	cross-arm-none-eabi/binutils
	cross-arm-none-eabi/gcc[cxx]
	cross-arm-none-eabi/newlib"

RDEPEND="${DEPEND}"
BDEPEND="dev-util/cmake"

src_prepare() {
	if use cyw43
	then
		einfo "Including the cyw43 driver"
		rmdir "${S}/lib/cyw43-driver"
		mv "${WORKDIR}/cyw43-driver-${CYW43_COMMIT}" "${S}/lib/cyw43-driver" || die "Failed to install cyw43 driver"
	fi
	if use examples
	then
		einfo "Including examples"
		mv "${WORKDIR}/pico-examples-sdk-${PV}" "${S}/examples" || die "Failed to install examples"
	fi
	if use lwip
	then
		einfo "Including the lwip IP Stack"
		rmdir "${S}/lib/lwip"
		mv "${WORKDIR}/lwip-${LWIP_COMMIT}" "${S}/lib/lwip" || die "Failed to install lwip"
	fi
	if use tinyusb
	then
		einfo "Including the tinyusb USB Stack"
		rmdir "${S}/lib/tinyusb"
		mv "${WORKDIR}/tinyusb-${TINYUSB_COMMIT}" "${S}/lib/tinyusb" || die "Failed to install tinyusb"
	fi
	eapply_user
}

src_compile() {
	return
}

src_install() {
	dodoc README.md CONTRIBUTING.md
	mkdir "${D}/opt"
	cp -R "${S}" "${D}/opt/"
	ln -s "${PN}-${PV}" "${D}/opt/${PN}"
}

pkg_postinst() {
	einfo "When compiling your projects set PICO_SDK_PATH to /opt/${PN}"
	einfo "or include(/opt/pico-sdk/pico_sdk_init.cmake) in your CMakeLists.txt"
}