commit:     b932ffe8e0c938200d104c096112986cf0f49683
Author:     Daniella Kicsak <nosqrt <AT> outlook <DOT> com>
AuthorDate: Thu Jun 20 12:42:16 2024 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Jul 26 07:40:31 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b932ffe8

dev-lang/micropython: add 1.23.0

Signed-off-by: Daniella Kicsak <nosqrt <AT> outlook.com>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-lang/micropython/Manifest                      |  1 +
 .../files/micropython-1.23.0-gcc13-build-fix.patch | 11 ++++
 dev-lang/micropython/micropython-1.23.0.ebuild     | 73 ++++++++++++++++++++++
 3 files changed, 85 insertions(+)

diff --git a/dev-lang/micropython/Manifest b/dev-lang/micropython/Manifest
index 74304d0b18d1..16e444cbe41a 100644
--- a/dev-lang/micropython/Manifest
+++ b/dev-lang/micropython/Manifest
@@ -1 +1,2 @@
 DIST micropython-1.17.tar.xz 56606868 BLAKE2B 
a6338d173de646764c1573ebabdb9818746a479fd2dd618f9be9955881e3829c4d89da4602934e71655734ec1c6f2150a6ac2c54a5fed9bee998905a00d5c6ea
 SHA512 
8074214040e35ae1ca99721ec442f4cef70fa03380b7662016c55cb3acff9178fc54140c0d818c9581389b4daaade142ecf75b65a2919c666a50255423a39a54
+DIST micropython-1.23.0.tar.xz 85748224 BLAKE2B 
3fca138bbe9a676c671812625ac374e82c3c91bb41db32557747ea4d28941de92be80bbf2e642f9094427dbcf6ee285c63ddad66510287074edb716017599384
 SHA512 
16f065bbbed1469587597193e7131ed9278ca2b22c8614098b5c79060f853db2a5a38ffe85688126cee86a5cb110d74840f50be4b009a687d7d310b54de2b2b5

diff --git 
a/dev-lang/micropython/files/micropython-1.23.0-gcc13-build-fix.patch 
b/dev-lang/micropython/files/micropython-1.23.0-gcc13-build-fix.patch
new file mode 100644
index 000000000000..bf418bcd7421
--- /dev/null
+++ b/dev-lang/micropython/files/micropython-1.23.0-gcc13-build-fix.patch
@@ -0,0 +1,11 @@
+--- a/py/mkrules.mk    2024-06-09 04:22:17.760512031 +1000
++++ b/py/mkrules.mk    2024-06-09 21:02:24.926427912 +1000
+@@ -234,9 +234,6 @@
+ # we may want to compile using Thumb, but link with non-Thumb libc.
+       $(Q)$(CC) -o $@ $^ $(LIB) $(LDFLAGS)
+ ifndef DEBUG
+-ifdef STRIP
+-      $(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $@
+-endif
+ endif
+       $(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $@

diff --git a/dev-lang/micropython/micropython-1.23.0.ebuild 
b/dev-lang/micropython/micropython-1.23.0.ebuild
new file mode 100644
index 000000000000..740c69961ef7
--- /dev/null
+++ b/dev-lang/micropython/micropython-1.23.0.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="Python implementation for microcontrollers"
+HOMEPAGE="https://github.com/micropython/micropython";
+SRC_URI="https://micropython.org/resources/source/${P}.tar.xz";
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+       dev-libs/libffi:=
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-gcc13-build-fix.patch"
+)
+
+src_prepare() {
+       default
+       cd ports/unix || die
+
+       # 1) don't die on compiler warning
+       # 2) remove /usr/local prefix references in favour of /usr
+       # 3) enforce our CFLAGS
+       # 4) enforce our LDFLAGS
+       sed -e 's#-Werror##g;' \
+               -e 's#\/usr\/local#\/usr#g;' \
+               -e "s#^CFLAGS = \(.*\)#CFLAGS = \1 ${CFLAGS}#g" \
+               -e "s#^LDFLAGS = \(.*\)#LDFLAGS = \1 ${LDFLAGS}#g" \
+               -i Makefile || die "can't patch Makefile"
+}
+
+src_compile() {
+       # Build the cross-compiler first. Build fails without this.
+       einfo ""
+       einfo "Building the mpy-crosscompiler."
+       einfo ""
+       cd "${S}/mpy-cross" || die
+       emake CC="$(tc-getCC)"
+
+       # Finally, build the unix port.
+       einfo ""
+       einfo "Building the micropython unix port."
+       einfo ""
+       cd "${S}/ports/unix" || die
+       emake CC="$(tc-getCC)"
+}
+
+src_test() {
+       cd ports/unix || die
+       emake CC="$(tc-getCC)" test
+}
+
+src_install() {
+       pushd ports/unix > /dev/null || die
+       emake CC="$(tc-getCC)" DESTDIR="${D}" install
+       popd > /dev/null || die
+
+       # remove .git files
+       find tools -type f -name '.git*' -exec rm {} \; || die
+
+       dodoc -r tools
+       einstalldocs
+}

Reply via email to