blob: a29dbe63bf1cb451977b84d94ee02d6ac8d6b772 (
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# Maintainer: Kyle Keen <keenerd@gmail.com>
pkgbase=micropython
pkgname=(micropython micropython-lib)
pkgver=1.11
_libver=1.9.3
# stupid submodules
_axver=1.8.2
_ffiver=3.2.1
pkgrel=1
pkgdesc="Python3 for microcontrollers, with stdlib. (unix version)"
arch=('i686' 'x86_64')
url="http://micropython.org/"
license=('MIT')
depends=('readline' 'libffi' 'mbedtls')
makedepends=('python' 'python-setuptools' 'git')
options=('!emptydirs')
source=("mpy-$pkgver.tgz::https://github.com/micropython/micropython/archive/v$pkgver.tar.gz"
"mlib-$_libver.tgz::https://github.com/micropython/micropython-lib/archive/v$_libver.tar.gz"
"axtls-$_axver.tgz::https://github.com/pfalcon/axtls/archive/v$_axver.tar.gz" # completely broken
"ffi-$_ffiver.tgz::https://github.com/libffi/libffi/archive/v$_ffiver.tar.gz"
"bdb.tgz::https://github.com/pfalcon/berkeley-db-1.xx/archive/embedded.tar.gz") # submodule with no releases!
# What about the lwip submodule? The repo is GONE. You didn't need an IP stack anyway.
# Maybe http://download.savannah.gnu.org/releases/lwip/lwip-2.0.0.zip is it?
md5sums=('ccd9dfd01738a85f2e8bd84ac465960c'
'1752ce13e851a671a07ce3f7a807b21c'
'e11da4ef04499030d1eff69b474f34f0'
'9066486bcab807f7ddaaf2596348c1db'
'SKIP')
# todo:
# fix 'imported as namespace package' warnings from stdlib
prepare() {
cd "$srcdir/micropython-$pkgver/lib"
# fix submodules
rmdir axtls
rmdir libffi
rmdir berkeley-db-1.xx
ln -s "$srcdir/axtls-$_axver" axtls
ln -s "$srcdir/libffi-$_ffiver" libffi
ln -s "$srcdir/berkeley-db-1.xx-embedded" berkeley-db-1.xx
# fix makefile
cd "$srcdir/micropython-$pkgver/ports/unix"
sed -i 's|/local||' Makefile
sed -i 's|git clean -d -x -f||' Makefile
# use mbedtls
sed -i 's/MICROPY_PY_USSL = 1/MICROPY_PY_USSL = 0/' mpconfigport.mk
sed -i 's/MICROPY_SSL_AXTLS = 1/MICROPY_SSL_AXTLS = 0/' mpconfigport.mk
sed -i 's/MICROPY_SSL_MBEDTLS = 0/MICROPY_SSL_MBEDTLS = 1/' mpconfigport.mk
}
build() {
cd "$srcdir/micropython-$pkgver/ports/unix"
#make libffi
#make V=1 deplibs
make
cd "$srcdir/micropython-lib-$_libver"
make
}
check() {
cd "$srcdir/micropython-$pkgver/ports/unix"
#make test
}
package_micropython() {
cd "$srcdir/micropython-$pkgver/ports/unix"
make DESTDIR="$pkgdir" install
cd "$srcdir/micropython-$pkgver"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_micropython-lib() {
cd "$srcdir/micropython-lib-$_libver"
for _d in $(find -mindepth 1 -maxdepth 1 -type d); do
# todo, figure out what provides this
# maybe importlib.metadata in python 3.8?
if grep -qr 'import metadata' ./$_d/*; then
error "Skipping $_d (bad import)"
continue
fi
if [[ ! -f $_d/setup.py ]]; then
error "Skipping $_d (no setup)"
continue
fi
msg "Installing $_d"
cd $_d
python3 setup.py install --prefix=/usr --root="$pkgdir" --install-lib='/usr/lib/micropython'
cd ..
done
# micropython doesn't support pyc
find "$pkgdir" -name '*.pyc' -delete
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
|