aboutsummaryrefslogtreecommitdiffstats
path: root/lang/micropython
diff options
context:
space:
mode:
authormva <mva@FreeBSD.org>2014-06-07 19:16:08 +0800
committermva <mva@FreeBSD.org>2014-06-07 19:16:08 +0800
commit0a69fa10885fae1d86f5ee9ef45ae686244f9d8c (patch)
tree5265f5701ff1f6d0f792542c35c3928af6d5a06d /lang/micropython
parent24edc39118fe7fe007da41b02eb46077514f6de3 (diff)
downloadfreebsd-ports-gnome-0a69fa10885fae1d86f5ee9ef45ae686244f9d8c.tar.gz
freebsd-ports-gnome-0a69fa10885fae1d86f5ee9ef45ae686244f9d8c.tar.zst
freebsd-ports-gnome-0a69fa10885fae1d86f5ee9ef45ae686244f9d8c.zip
Micro Python is a lean and fast implementation of the Python 3 programming
language that is optimised to run on a microcontroller. WWW: http://www.micropython.org
Diffstat (limited to 'lang/micropython')
-rw-r--r--lang/micropython/Makefile45
-rw-r--r--lang/micropython/distinfo2
-rw-r--r--lang/micropython/files/patch-builtinimport.c14
-rw-r--r--lang/micropython/files/patch-modtime.c11
-rw-r--r--lang/micropython/files/patch-objfun.c14
-rw-r--r--lang/micropython/files/patch-runtime.c14
-rw-r--r--lang/micropython/pkg-descr4
7 files changed, 104 insertions, 0 deletions
diff --git a/lang/micropython/Makefile b/lang/micropython/Makefile
new file mode 100644
index 000000000000..bdd2b3c7fed6
--- /dev/null
+++ b/lang/micropython/Makefile
@@ -0,0 +1,45 @@
+# $FreeBSD$
+
+PORTNAME= micropython
+PORTVERSION= 1.0.1
+CATEGORIES= lang python
+
+MAINTAINER= mva@FreeBSD.org
+COMMENT= Implementation of the Python language for microcontrollers
+
+LICENSE= MIT
+
+LIB_DEPENDS= libffi.so:${PORTSDIR}/devel/libffi
+
+USE_PYTHON_BUILD= yes
+USES= gmake shebangfix pkgconfig
+
+USE_GITHUB= yes
+GH_ACCOUNT= micropython
+GH_PROJECT= micropython
+GH_TAGNAME= v1.0.1
+GH_COMMIT= a56f31d
+
+PLIST_FILES= bin/micropython
+
+WRKSRC= ${WRKDIR}/${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT}/unix
+
+SHEBANG_FILES= ../py/py-version.sh
+bash_CMD?= /bin/sh
+MAKE_ARGS+= V=1
+MAKE_ENV+= PYTHON=${PYTHON_CMD}
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|-Werror||;s|-ldl||' ${WRKSRC}/Makefile
+ @${REINPLACE_CMD} -e 's|AS =|AS ?=|;s|LD =|LD ?=|; \
+ s|CC =|CC ?=|;s|PYTHON =|PYTHON ?=|' \
+ ${WRKSRC}/../py/mkenv.mk
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/micropython ${STAGEDIR}${PREFIX}/bin
+
+regression-test: build
+ ${RM} ${WRKSRC}/../tests/basics/memoryerror.py
+ cd ${WRKSRC} && ${MAKE_CMD} test
+
+.include <bsd.port.mk>
diff --git a/lang/micropython/distinfo b/lang/micropython/distinfo
new file mode 100644
index 000000000000..230f91b5e5d4
--- /dev/null
+++ b/lang/micropython/distinfo
@@ -0,0 +1,2 @@
+SHA256 (micropython-1.0.1.tar.gz) = 6fcd4e7987a9691025c24d1b2c2946ff0d7fb912f3869dfcee52143dfbd8a4e2
+SIZE (micropython-1.0.1.tar.gz) = 4693643
diff --git a/lang/micropython/files/patch-builtinimport.c b/lang/micropython/files/patch-builtinimport.c
new file mode 100644
index 000000000000..b88a23b5d958
--- /dev/null
+++ b/lang/micropython/files/patch-builtinimport.c
@@ -0,0 +1,14 @@
+--- ../py/builtinimport.c.orig 2014-06-05 06:09:16.000000000 +0200
++++ ../py/builtinimport.c 2014-06-05 06:09:56.000000000 +0200
+@@ -28,7 +28,11 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <assert.h>
++#ifndef __FreeBSD__
+ #include <alloca.h>
++#else
++#include <stdlib.h>
++#endif
+
+ #include "mpconfig.h"
+ #include "nlr.h"
diff --git a/lang/micropython/files/patch-modtime.c b/lang/micropython/files/patch-modtime.c
new file mode 100644
index 000000000000..0a8fd1312463
--- /dev/null
+++ b/lang/micropython/files/patch-modtime.c
@@ -0,0 +1,11 @@
+--- modtime.c.orig 2014-06-05 20:07:38.000000000 +0200
++++ modtime.c 2014-06-06 07:58:58.000000000 +0200
+@@ -59,6 +59,8 @@
+ #define CLOCK_DIV 1000.0
+ #elif defined(MP_CLOCKS_PER_SEC) && (MP_CLOCKS_PER_SEC == 1000) // WIN32
+ #define CLOCK_DIV 1.0
++#elif defined(__FreeBSD__) && (MP_CLOCKS_PER_SEC == 128)
++#define CLOCK_DIV (1.0 / 128.0)
+ #else
+ #error Unsupported clock() implementation
+ #endif
diff --git a/lang/micropython/files/patch-objfun.c b/lang/micropython/files/patch-objfun.c
new file mode 100644
index 000000000000..fe0ee281fd9e
--- /dev/null
+++ b/lang/micropython/files/patch-objfun.c
@@ -0,0 +1,14 @@
+--- ../py/objfun.c.orig 2014-06-04 22:09:47.000000000 +0200
++++ ../py/objfun.c 2014-06-04 22:10:16.000000000 +0200
+@@ -27,7 +27,11 @@
+ #include <stdbool.h>
+ #include <string.h>
+ #include <assert.h>
++#ifndef __FreeBSD__
+ #include <alloca.h>
++#else
++#include <stdlib.h>
++#endif
+
+ #include "mpconfig.h"
+ #include "nlr.h"
diff --git a/lang/micropython/files/patch-runtime.c b/lang/micropython/files/patch-runtime.c
new file mode 100644
index 000000000000..264f57ecc377
--- /dev/null
+++ b/lang/micropython/files/patch-runtime.c
@@ -0,0 +1,14 @@
+--- ../py/runtime.c.orig 2014-06-04 22:05:32.000000000 +0200
++++ ../py/runtime.c 2014-06-04 22:06:16.000000000 +0200
+@@ -27,7 +27,11 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <assert.h>
++#ifndef __FreeBSD__
+ #include <alloca.h>
++#else
++#include <stdlib.h> /* alloca() */
++#endif
+
+ #include "mpconfig.h"
+ #include "nlr.h"
diff --git a/lang/micropython/pkg-descr b/lang/micropython/pkg-descr
new file mode 100644
index 000000000000..6ab219e88c4a
--- /dev/null
+++ b/lang/micropython/pkg-descr
@@ -0,0 +1,4 @@
+Micro Python is a lean and fast implementation of the Python 3 programming
+language that is optimised to run on a microcontroller.
+
+WWW: http://www.micropython.org