slackbuilds/_unmaintained/ap/esptool/SlackBuild

57 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
CWD=$(pwd)
PRGNAM=$(basename $CWD)
GITHUB_REPO=espressif/esptool
VERSION=${VERSION:-latest}
BUILD=1
ARCH=noarch
HOME=/home/gwh
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
REPOSITORY=/var/cache/SlackBuilds.gwh/$PRGNAM
PREFIX=/usr
rm -fr $PKG $TMP/$PRGNAM
mkdir -p $TMP
# mise en place
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY
cd $REPOSITORY
git pull --all
cp -R $REPOSITORY $TMP/$PRGNAM
cd $TMP/$PRGNAM
[ "x$VERSION" == "xlatest" ] && VERSION=$(git tag --sort=-version:refname | head -n1)
[ "x$VERSION" == "x" ] && VERSION=trunk
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
python setup.py install --root $PKG
python3 setup.py install --root $PKG
VERSION=$(ls /usr/lib$(uname -m | grep -o 64)/python*/site-packages/| grep "$PRGNAM-.*-py.*\.egg-info" | grep -o "[0-9.]*" | head -n1)_$VERSION
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (ESP8266 and ESP32 serial bootloader utility)
$PRGNAM:
$PRGNAM: A Python-based, open source, platform independent, utility to
$PRGNAM: communicate with the ROM bootloader in Espressif ESP8266 & ESP32
$PRGNAM: chips.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/${GITHUB_REPO}
EOF
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$(echo $VERSION | tr - .)-$ARCH-$BUILD$TAG.txz