summaryrefslogtreecommitdiff
path: root/lang/micropython
diff options
context:
space:
mode:
authorhauke <hauke@pkgsrc.org>2017-11-29 15:13:31 +0000
committerhauke <hauke@pkgsrc.org>2017-11-29 15:13:31 +0000
commit80adefcdfc7957689bdd7b4acac869cf835be103 (patch)
treee4240e2c3f064ce210bbff0f19f71109b335894f /lang/micropython
parent691ce2543150e1692d4a0906194c41ca4a1bc5f7 (diff)
downloadpkgsrc-80adefcdfc7957689bdd7b4acac869cf835be103.tar.gz
Update lang/micropython to v1.9.2.
Changes are many, but upstream does not maintain a changelog.
Diffstat (limited to 'lang/micropython')
-rw-r--r--lang/micropython/DESCR2
-rw-r--r--lang/micropython/Makefile31
-rw-r--r--lang/micropython/PLIST8
-rw-r--r--lang/micropython/distinfo19
-rw-r--r--lang/micropython/patches/patch-lib_utils_printf.c17
-rw-r--r--lang/micropython/patches/patch-mpy-cross_mpconfigport.h15
-rw-r--r--lang/micropython/patches/patch-py_mkenv.mk15
-rw-r--r--lang/micropython/patches/patch-py_obj.h15
-rw-r--r--lang/micropython/patches/patch-unix_Makefile57
-rw-r--r--lang/micropython/patches/patch-unix_mpconfigport.h10
-rw-r--r--lang/micropython/patches/patch-unix_mpthreadport.c21
11 files changed, 132 insertions, 78 deletions
diff --git a/lang/micropython/DESCR b/lang/micropython/DESCR
index 8fd69d11c73..1f31d4e54e3 100644
--- a/lang/micropython/DESCR
+++ b/lang/micropython/DESCR
@@ -11,3 +11,5 @@ bytearray, tuple, list, dict, set, frozenset, array.array,
collections.namedtuple, classes and instances. Builtin modules
include sys, time, and struct. Note that only subset of Python 3.4
functionality is implemented for the data types and modules.
+
+Documentation is at <http://docs.micropython.org/en/latest/>.
diff --git a/lang/micropython/Makefile b/lang/micropython/Makefile
index 7e0807865d5..6b02a60e1d9 100644
--- a/lang/micropython/Makefile
+++ b/lang/micropython/Makefile
@@ -1,27 +1,42 @@
-# $NetBSD: Makefile,v 1.2 2016/03/22 19:01:17 joerg Exp $
+# $NetBSD: Makefile,v 1.3 2017/11/29 15:13:31 hauke Exp $
-DISTNAME= micropython-1.5.2
+DISTNAME= micropython-1.9.2
CATEGORIES= lang
-MASTER_SITES= ${MASTER_SITE_GITHUB:=micropython/}
-GITHUB_TAG= v1.5.2
+MASTER_SITES= http://micropython.org/resources/source/
+EXTRACT_SUFX= .tar.xz
MAINTAINER= agc@NetBSD.org
HOMEPAGE= https://micropython.org/
-COMMENT= Embedded version of python
+COMMENT= Embedded version of python 3
LICENSE= mit
DIST_SUBDIR= ${PKGNAME_NOREV}
BUILD_DIRS= unix
-USE_TOOLS+= gmake pkg-config
+USE_TOOLS+= pax gmake pkg-config
AUTO_MKDIRS= yes
-MAKE_FLAGS+= PYTHON=${PYTHONBIN}
+PYTHON_VERSIONS_INCOMPATIBLE= 27
+PYTHON_FOR_BUILD_ONLY= yes
+
+MAKE_ENV+= PYTHON=${PYTHONBIN:Q}
+MAKE_ENV+= MICROPY_CPYTHON3=${PYTHONBIN:Q}
REPLACE_PYTHON+= tools/make-frozen.py
+REPLACE_PYTHON+= tests/run-tests
-PYTHON_FOR_BUILD_ONLY= yes
+pre-configure:
+ cd ${WRKSRC}/lib/axtls && ${GMAKE} clean
+
+pre-build:
+ cd ${WRKSRC}/unix && ${GMAKE} axtls
+
+do-test:
+ cd ${WRKSRC}/unix && env ${MAKE_ENV} ${GMAKE} test
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/unix/micropython ${DESTDIR}${PREFIX}/bin
.include "../../devel/libffi/buildlink3.mk"
.include "../../lang/python/application.mk"
diff --git a/lang/micropython/PLIST b/lang/micropython/PLIST
index 82190a86257..d0d815638fa 100644
--- a/lang/micropython/PLIST
+++ b/lang/micropython/PLIST
@@ -1,3 +1,7 @@
-@comment $NetBSD: PLIST,v 1.1 2016/01/18 07:54:51 agc Exp $
+@comment $NetBSD: PLIST,v 1.2 2017/11/29 15:13:31 hauke Exp $
bin/micropython
-bin/pip-micropython
+@pkgdir share/examples/micropython/unix
+@pkgdir share/examples/micropython/network
+@pkgdir share/examples/micropython/hwapi
+@pkgdir share/examples/micropython/embedding
+@pkgdir share/examples/micropython/SDdatalogger
diff --git a/lang/micropython/distinfo b/lang/micropython/distinfo
index 85a5fa53b21..e487682705c 100644
--- a/lang/micropython/distinfo
+++ b/lang/micropython/distinfo
@@ -1,9 +1,12 @@
-$NetBSD: distinfo,v 1.3 2016/03/25 21:11:16 joerg Exp $
+$NetBSD: distinfo,v 1.4 2017/11/29 15:13:31 hauke Exp $
-SHA1 (micropython-1.5.2/micropython-1.5.2.tar.gz) = 493cf36aa722b50b6034efb8de6433dcea546b0f
-RMD160 (micropython-1.5.2/micropython-1.5.2.tar.gz) = 0f5c316ecd716734fe8e1dbdf9a360ef6f126b85
-SHA512 (micropython-1.5.2/micropython-1.5.2.tar.gz) = 309dcb20a3369ac5bec92a6a5cd8af37d671fc2a8e3b6a36c4c49d1f4730eaaa46dffb2351eb5783de12f045069554c22ee70c0100cf98ab09138ef42594a65a
-Size (micropython-1.5.2/micropython-1.5.2.tar.gz) = 6673101 bytes
-SHA1 (patch-py_obj.h) = f148e1e88ef6347c93fca5d367b36be805267f74
-SHA1 (patch-unix_Makefile) = e40d7413ec1140e6a408b82708f1749b3cb879bb
-SHA1 (patch-unix_mpconfigport.h) = a93806f5db48cc61096a899ea3558afc46468ff1
+SHA1 (micropython-1.9.2/micropython-1.9.2.tar.xz) = c14b2e7ebaefe86e60f4b11cf738947cf8204fba
+RMD160 (micropython-1.9.2/micropython-1.9.2.tar.xz) = 9c22131546c3e49bfa28b5f71994b20ee819d094
+SHA512 (micropython-1.9.2/micropython-1.9.2.tar.xz) = 67d070d47c19a100d164f9b4e4ec7eba10cf5ee49089f5f4d6a8338a9d72d6cffa41c2f6de73c8b169ba8011961b8ef197241fa5bea6813f77f65ef4cf2f4e4b
+Size (micropython-1.9.2/micropython-1.9.2.tar.xz) = 6699860 bytes
+SHA1 (patch-lib_utils_printf.c) = 6c152cd10a5fb0091d1149a0a50b202df6a6e931
+SHA1 (patch-mpy-cross_mpconfigport.h) = 78cf0865c60bf8fbbecb318e4f0597662076459e
+SHA1 (patch-py_mkenv.mk) = ff844cd4bcb6f9a2a27e02a62a066b4b70899c88
+SHA1 (patch-unix_Makefile) = 51a636af55719e454f1464aa7c1c06c0808de56a
+SHA1 (patch-unix_mpconfigport.h) = 544c0217ffcc8755adbb8c63a4b325af9b7ff8a2
+SHA1 (patch-unix_mpthreadport.c) = 5a021a4b1b7426ea7bae302870a04008381ee9c7
diff --git a/lang/micropython/patches/patch-lib_utils_printf.c b/lang/micropython/patches/patch-lib_utils_printf.c
new file mode 100644
index 00000000000..62105091004
--- /dev/null
+++ b/lang/micropython/patches/patch-lib_utils_printf.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-lib_utils_printf.c,v 1.1 2017/11/29 15:13:32 hauke Exp $
+
+Undefine macro names we intend to implement as functions
+
+--- lib/utils/printf.c.orig 2017-08-23 01:50:10.000000000 +0000
++++ lib/utils/printf.c
+@@ -40,6 +40,10 @@
+ #endif
+
+ #undef putchar // Some stdlibs have a #define for putchar
++
++#undef snprintf
++#undef vsnprintf
++
+ int printf(const char *fmt, ...);
+ int vprintf(const char *fmt, va_list ap);
+ int putchar(int c);
diff --git a/lang/micropython/patches/patch-mpy-cross_mpconfigport.h b/lang/micropython/patches/patch-mpy-cross_mpconfigport.h
new file mode 100644
index 00000000000..b57960b533e
--- /dev/null
+++ b/lang/micropython/patches/patch-mpy-cross_mpconfigport.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-mpy-cross_mpconfigport.h,v 1.1 2017/11/29 15:13:32 hauke Exp $
+
+Modern *BSDs heclare alloca() in <stdlib.h>
+
+--- mpy-cross/mpconfigport.h.orig 2017-08-23 01:50:10.000000000 +0000
++++ mpy-cross/mpconfigport.h
+@@ -115,7 +115,7 @@ typedef long mp_off_t;
+ #endif
+
+ // We need to provide a declaration/definition of alloca()
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+ #include <stdlib.h>
+ #elif defined( _WIN32 )
+ #include <malloc.h>
diff --git a/lang/micropython/patches/patch-py_mkenv.mk b/lang/micropython/patches/patch-py_mkenv.mk
new file mode 100644
index 00000000000..cd5f92b35bb
--- /dev/null
+++ b/lang/micropython/patches/patch-py_mkenv.mk
@@ -0,0 +1,15 @@
+$NetBSD: patch-py_mkenv.mk,v 1.1 2017/11/29 15:13:32 hauke Exp $
+
+Set the Python's name in pkg Makefile
+
+--- py/mkenv.mk.orig 2017-11-01 00:19:56.000000000 +0000
++++ py/mkenv.mk
+@@ -42,7 +42,7 @@ ECHO = @echo
+ CP = cp
+ MKDIR = mkdir
+ SED = sed
+-PYTHON = python
++PYTHON ?= python
+
+ AS = $(CROSS_COMPILE)as
+ CC = $(CROSS_COMPILE)gcc
diff --git a/lang/micropython/patches/patch-py_obj.h b/lang/micropython/patches/patch-py_obj.h
deleted file mode 100644
index 6acf8e9b57c..00000000000
--- a/lang/micropython/patches/patch-py_obj.h
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-py_obj.h,v 1.1 2016/03/22 19:01:17 joerg Exp $
-
-Avoid Undefined Behavior.
-
---- py/obj.h.orig 2016-03-02 16:07:50.524241926 +0000
-+++ py/obj.h
-@@ -81,7 +81,7 @@ typedef struct _mp_obj_base_t mp_obj_bas
- static inline bool MP_OBJ_IS_SMALL_INT(mp_const_obj_t o)
- { return ((((mp_int_t)(o)) & 1) != 0); }
- #define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)(o)) >> 1)
--#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
-+#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) * 2) | 1))
-
- static inline bool MP_OBJ_IS_QSTR(mp_const_obj_t o)
- { return ((((mp_int_t)(o)) & 3) == 2); }
diff --git a/lang/micropython/patches/patch-unix_Makefile b/lang/micropython/patches/patch-unix_Makefile
index 1ea96a9a9bd..ff1e541990c 100644
--- a/lang/micropython/patches/patch-unix_Makefile
+++ b/lang/micropython/patches/patch-unix_Makefile
@@ -1,54 +1,31 @@
-$NetBSD: patch-unix_Makefile,v 1.1 2016/03/22 19:01:17 joerg Exp $
+$NetBSD: patch-unix_Makefile,v 1.2 2017/11/29 15:13:32 hauke Exp $
-Invoke gmake properly
+cpp(1) only accepts one file for input, we want cc -E here.
---- unix/Makefile.orig 2015-12-31 14:43:19.000000000 +0000
+Set up for pkgsrc install
+
+--- unix/Makefile.orig 2017-08-23 01:50:11.000000000 +0000
+++ unix/Makefile
-@@ -149,14 +149,13 @@ test: $(PROG) ../tests/run-tests
+@@ -73,6 +73,7 @@ LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead
+ else
+ # Use gcc syntax for map file
+ LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
++CPP = $(CC) -E
+ endif
+ LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
+
+@@ -193,12 +194,10 @@ test: $(PROG) $(TOP)/tests/run-tests
# install micropython in /usr/local/bin
TARGET = micropython
-PREFIX = $(DESTDIR)/usr/local
-BINDIR = $(PREFIX)/bin
-+BINDIR = $(DESTDIR)${PREFIX}/bin
- PIPSRC = ../tools/pip-micropython
- PIPTARGET = pip-micropython
++BINDIR = $(DESTDIR)$(PREFIX)/bin
install: micropython
-- install -D $(TARGET) $(BINDIR)/$(TARGET)
-- install -D $(PIPSRC) $(BINDIR)/$(PIPTARGET)
+- install -d $(BINDIR)
+- install $(TARGET) $(BINDIR)/$(TARGET)
+ ${BSD_INSTALL_PROGRAM} $(TARGET) $(BINDIR)/$(TARGET)
-+ ${BSD_INSTALL_SCRIPT} $(PIPSRC) $(BINDIR)/$(PIPTARGET)
# uninstall micropython
uninstall:
-@@ -196,12 +195,12 @@ $(BUILD)/_frozen_upip.c: $(BUILD)/frozen
- ../tools/make-frozen.py $(dir $^) > $@
-
- # Select latest upip version available
--UPIP_TARBALL := $(shell ls -1 -v ../tools/micropython-upip-*.tar.gz | tail -n1)
-+UPIP_TARBALL := $(shell ls -1 ../tools/micropython-upip-*.tar.gz | tail -n1)
-
- $(BUILD)/frozen_upip/upip.py: $(UPIP_TARBALL)
- $(ECHO) "MISC Preparing upip as frozen module"
- $(Q)rm -rf $(BUILD)/micropython-upip-*
-- $(Q)tar -C $(BUILD) -xz -f $^
-+ $(Q)tar -C $(BUILD) -x -z -f $^
- $(Q)rm -rf $(dir $@)
- $(Q)mkdir -p $(dir $@)
- $(Q)cp $(BUILD)/micropython-upip-*/upip*.py $(dir $@)
-@@ -224,10 +223,10 @@ libffi:
- cd ../lib/libffi; ./autogen.sh
- mkdir -p ../lib/libffi/build_dir; cd ../lib/libffi/build_dir; \
- ../configure $(CROSS_COMPILE_HOST) --prefix=$$PWD/out CC="$(CC)" CXX="$(CXX)" LD="$(LD)"; \
-- make install-exec-recursive; make -C include install-data-am
-+ ${MAKE} install-exec-recursive; ${MAKE} -C include install-data-am
-
- axtls:
- cd ../lib/axtls; cp config/upyconfig config/.config
-- cd ../lib/axtls; make oldconfig -B
-- cd ../lib/axtls; make clean
-- cd ../lib/axtls; make all CC="$(CC)" LD="$(LD)"
-+ cd ../lib/axtls; ${MAKE} oldconfig -B
-+ cd ../lib/axtls; ${MAKE} clean
-+ cd ../lib/axtls; ${MAKE} all CC="$(CC)" LD="$(LD)"
diff --git a/lang/micropython/patches/patch-unix_mpconfigport.h b/lang/micropython/patches/patch-unix_mpconfigport.h
index bc689acf6dc..95988522e6f 100644
--- a/lang/micropython/patches/patch-unix_mpconfigport.h
+++ b/lang/micropython/patches/patch-unix_mpconfigport.h
@@ -1,16 +1,16 @@
-$NetBSD: patch-unix_mpconfigport.h,v 1.1 2016/03/22 19:01:17 joerg Exp $
+$NetBSD: patch-unix_mpconfigport.h,v 1.2 2017/11/29 15:13:32 hauke Exp $
-Generalise for all BSDs
+Modern *BSDs heclare alloca() in <stdlib.h>
---- unix/mpconfigport.h.orig 2015-12-31 14:43:19.000000000 +0000
+--- unix/mpconfigport.h.orig 2017-08-23 01:50:11.000000000 +0000
+++ unix/mpconfigport.h
-@@ -261,7 +261,8 @@ void mp_hal_dupterm_tx_strn(const char *
+@@ -291,7 +291,8 @@ void mp_unix_mark_exec(void);
// We need to provide a declaration/definition of alloca()
// unless support for it is disabled.
#if !defined(MICROPY_NO_ALLOCA) || MICROPY_NO_ALLOCA == 0
-#ifdef __FreeBSD__
+#include <sys/param.h>
-+#if (defined(BSD) && BSD >= 199506)
++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#include <stdlib.h>
#else
#include <alloca.h>
diff --git a/lang/micropython/patches/patch-unix_mpthreadport.c b/lang/micropython/patches/patch-unix_mpthreadport.c
new file mode 100644
index 00000000000..ad056022fbc
--- /dev/null
+++ b/lang/micropython/patches/patch-unix_mpthreadport.c
@@ -0,0 +1,21 @@
+$NetBSD: patch-unix_mpthreadport.c,v 1.1 2017/11/29 15:13:32 hauke Exp $
+
+NetBSD does not (yet) #define PTHREAD_STACK_MIN
+
+--- unix/mpthreadport.c.orig 2017-08-23 01:50:11.000000000 +0000
++++ unix/mpthreadport.c
+@@ -140,11 +140,13 @@ void mp_thread_create(void *(*entry)(voi
+ *stack_size = 8192 * BYTES_PER_WORD;
+ }
+
++#ifdef PTHREAD_STACK_MIN /* NetBSD */
+ // minimum stack size is set by pthreads
+ if (*stack_size < PTHREAD_STACK_MIN) {
+ *stack_size = PTHREAD_STACK_MIN;
+ }
+-
++#endif /* PTHREAD_STACK_MIN */
++
+ // set thread attributes
+ pthread_attr_t attr;
+ int ret = pthread_attr_init(&attr);