1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-17 19:39:43 +00:00

lang/micropython: Update to 1.17

* Switch to GCC because building with Clang leads to a broken
  "mpy-cross" binary, which segfaults if issued with several parameters
  during build.

* REINPLACE_CMD should not be used to replace static content, hence
  convert those occurrences into patches.

* Also update pkg-descr and sort variables a bit according to the PHB.

Reviewed by:	decke (earlier revision)
Approved by:	kai (python, maintainer)
Differential Revision:	https://reviews.freebsd.org/D31855
This commit is contained in:
Kai Knoblich 2021-09-09 11:10:17 +02:00
parent 57d484328a
commit 31d9698334
7 changed files with 102 additions and 33 deletions

View File

@ -1,48 +1,45 @@
PORTNAME= micropython
PORTVERSION= 1.5.1
PORTVERSION= 1.17
DISTVERSIONPREFIX= v
PORTREVISION= 4
CATEGORIES= lang python
MAINTAINER= python@FreeBSD.org
COMMENT= Implementation of the Python language for microcontrollers
LICENSE= MIT
LIB_DEPENDS= libffi.so:devel/libffi
USES= gmake pkgconfig python:3.4+,build readline shebangfix
USE_GITHUB= yes
PLIST_FILES= bin/micropython
LICENSE_FILE= ${WRKSRC}/LICENSE
BROKEN_armv6= fails to assemble: error: invalid operand for instruction
BROKEN_armv7= fails to assemble: error: invalid operand for instruction
WRKSRC_SUBDIR= unix
LIB_DEPENDS= libffi.so:devel/libffi
SHEBANG_FILES= ../tools/make-frozen.py
MAKE_ARGS+= V=1
MAKE_ENV+= PYTHON=${PYTHON_CMD} CFLAGS_EXTRA="${CPPFLAGS} ${CFLAGS}"
USES= gmake pkgconfig python:,build
USE_GCC= yes
USE_GITHUB= yes
GH_TUPLE= micropython:axtls:531cab9:axtls \
pfalcon:berkeley-db-1.xx:35aaec4:bdb
MAKE_ARGS+= CC=${CC} CPP="${CC} -E" V=1
MAKE_ENV+= CFLAGS_EXTRA="${CPPFLAGS} ${CFLAGS} -Wno-float-conversion" COPT=""
# With aarch64 (QEMU) the float_parse and the float_parse_doubleprec tests
# fail as they give a different output.
TEST_TARGET= test
post-patch:
@${REINPLACE_CMD} -e 's|-Werror||;/^COPT =/d; \
s|ls -1 -v|ls -1|' ${WRKSRC}/Makefile
@${REINPLACE_CMD} -e 's|re_exec|mp_re_exec|' \
${WRKSRC}/../extmod/modure.c
@${REINPLACE_CMD} -e 's|AS =|AS ?=|;s|LD =|LD ?=|; \
s|CC =|CC ?=|;s|PYTHON =|PYTHON ?=|' \
${WRKSRC}/../py/mkenv.mk
@${REINPLACE_CMD} -e 's|libc\.so\.6|libc\.so\.7|;' \
${WRKSRC}/../tests/unix/ffi_callback.py \
${WRKSRC}/../tests/unix/ffi_float.py
BINARY_ALIAS= python3=${PYTHON_CMD}
BUILD_WRKSRC= ${WRKSRC}/ports/unix
TEST_WRKSRC= ${WRKSRC}/ports/unix
PLIST_FILES= bin/micropython
post-extract:
@${RM} -r ${WRKSRC}/lib/axtls ${WRKSRC}/lib/berkeley-db-1.xx
@${RLN} ${WRKSRC_axtls} ${WRKSRC}/lib/axtls
@${RLN} ${WRKSRC_bdb} ${WRKSRC}/lib/berkeley-db-1.xx
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/micropython ${STAGEDIR}${PREFIX}/bin
pre-test:
@${RM} ${WRKSRC}/../tests/basics/memoryerror.py
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/micropython ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View File

@ -1,2 +1,7 @@
SHA256 (micropython-micropython-v1.5.1_GH0.tar.gz) = 95cc34089a1e40a992065ff9c9b67c121674c3bd6136a50882054fcac27485c2
SIZE (micropython-micropython-v1.5.1_GH0.tar.gz) = 6635550
TIMESTAMP = 1630664518
SHA256 (micropython-micropython-v1.17_GH0.tar.gz) = c21dbf8144237b3dbe3847c9ad5264cd0f3104eb078c810b3986004cce8fcd70
SIZE (micropython-micropython-v1.17_GH0.tar.gz) = 6467563
SHA256 (micropython-axtls-531cab9_GH0.tar.gz) = cd1b9bf60d34e86e62046dd595ddb34b3960d36f44bf7a31d67e253a5bc24fe1
SIZE (micropython-axtls-531cab9_GH0.tar.gz) = 1325384
SHA256 (pfalcon-berkeley-db-1.xx-35aaec4_GH0.tar.gz) = 9c696582ce47557556c7d6a14c96236ae5913124d15a63d3a78b384336d1a817
SIZE (pfalcon-berkeley-db-1.xx-35aaec4_GH0.tar.gz) = 273515

View File

@ -0,0 +1,26 @@
* Avoid making all warnings into errors
* Extra optimizations via COPT should be overwritable
--- mpy-cross/Makefile.orig 2021-09-01 14:07:13 UTC
+++ mpy-cross/Makefile
@@ -17,7 +17,7 @@ INC += -I$(BUILD)
INC += -I$(TOP)
# compiler settings
-CWARN = -Wall -Werror
+CWARN = -Wall
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
@@ -25,9 +25,9 @@ CFLAGS += -fdata-sections -ffunction-sections -fno-asy
# Debugging/Optimization
ifdef DEBUG
CFLAGS += -g
-COPT = -O0
+COPT ?= -O0
else
-COPT = -Os #-DNDEBUG
+COPT ?= -Os #-DNDEBUG
endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.

View File

@ -0,0 +1,13 @@
* Avoid making warnings into errors
--- ports/unix/Makefile.orig 2021-09-04 05:19:26 UTC
+++ ports/unix/Makefile
@@ -38,7 +38,7 @@ INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
-CWARN = -Wall -Werror
+CWARN = -Wall
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)

View File

@ -0,0 +1,13 @@
Required to let pass the test "ffi_callback" successfully
--- tests/unix/ffi_callback.py.orig 2021-09-04 05:46:01 UTC
+++ tests/unix/ffi_callback.py
@@ -16,7 +16,7 @@ def ffi_open(names):
raise err
-libc = ffi_open(("libc.so", "libc.so.0", "libc.so.6", "libc.dylib"))
+libc = ffi_open(("libc.so", "libc.so.0", "libc.so.7", "libc.dylib"))
qsort = libc.func("v", "qsort", "piip")

View File

@ -0,0 +1,13 @@
Required to let pass the test "ffi_float" successfully
--- tests/unix/ffi_float.py.orig 2021-09-04 05:47:22 UTC
+++ tests/unix/ffi_float.py
@@ -17,7 +17,7 @@ def ffi_open(names):
raise err
-libc = ffi_open(("libc.so", "libc.so.0", "libc.so.6", "libc.dylib"))
+libc = ffi_open(("libc.so", "libc.so.0", "libc.so.7", "libc.dylib"))
try:
strtof = libc.func("f", "strtof", "sp")

View File

@ -1,4 +1,6 @@
Micro Python is a lean and fast implementation of the Python 3 programming
language that is optimised to run on a microcontroller.
Micro Python is a lean and efficient implementation of the Python 3
programming language that includes a small subset of the Python
standard library and is optimised to run on microcontrollers and in
constrained environments.
WWW: https://www.micropython.org/