Skip to content

Instantly share code, notes, and snippets.

@SpotlightKid SpotlightKid/PKGBUILD
Last active Jan 25, 2017

Embed
What would you like to do?
PKGBUILD for micropython AUR package
# Maintainer: Kyle Keen <keenerd@gmail.com>
# Contributor: Christopher Arndt <aur -at- chrisarndt -dot- de>
pkgbase=micropython
pkgname=(micropython micropython-lib)
pkgver=1.8.7
_libver=1.8.6
# stupid submodules
_axver=67d27df4b5d097e146599fc4fb160a2adcbf5632
_bdbver=dab957dacddcbf6cbc85d42df62e189e4877bb72
pkgrel=2
pkgdesc="Python 3 for microcontrollers, with stdlib (unix version)."
arch=('i686' 'x86_64')
url="http://micropython.org/"
license=('MIT')
depends=('readline' 'libffi')
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/$_axver.tar.gz"
"bdb-$_bdbver.tgz::https://github.com/pfalcon/berkeley-db-1.xx/archive/$_bdbver.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=('80fd6b88c05ed20886acfd2fb1ea2e11'
'e0b313e7d6378f52607844fd30d79630'
'701612578417d80ac511130ac79b981f'
'24a2f6113a710e3e9711756796bba4ed')
# todo:
# fix 'imported as namespace package' warnings from stdlib
prepare() {
cd "$srcdir/micropython-$pkgver/lib"
# fix submodules
rmdir axtls
rmdir berkeley-db-1.xx
ln -s "$srcdir/axtls-$_axver" axtls
ln -s "$srcdir/berkeley-db-1.xx-$_bdbver" berkeley-db-1.xx
}
build() {
cd "$srcdir/micropython-$pkgver/unix"
make CWARN="-Wall" axtls
make
cd "$srcdir/micropython-lib-$_libver"
make
}
check() {
cd "$srcdir/micropython-$pkgver/unix"
#make test
}
package_micropython() {
cd "$srcdir/micropython-$pkgver/unix"
make PREFIX="$pkgdir/usr" 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
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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.