summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 63ff5bcebbab7ca2e3211b499b48f2de6007a66e (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
#Maintainer: Sam Bazley <samb1999@hotmail.co.uk>
pkgname=esp-open-sdk-git
pkgver=1
pkgrel=5
pkgdesc="Free and open (as much as possible) integrated SDK for ESP8266 chips"
arch=("i686" "x86_64")
url="https://github.com/pfalcon/esp-open-sdk"
makedepends=("git" "gperf" "help2man" "unzip")
depends=("python" "python2" "python-pyserial" "python2-pyserial" "esptool")
provides=("esp-open-sdk")
conflicts=("esp-open-sdk")
options=("!strip")

source=("git+https://github.com/pfalcon/esp-open-sdk.git")
md5sums=("SKIP")

pkgver() {
    cd esp-open-sdk
    git show -s --format=%ci HEAD | cut -d ' ' -f1-2 | sed -r 's/[^0-9]//g'
}

prepare() {
    cd "$srcdir"/esp-open-sdk
    git submodule init
    git submodule deinit esptool
    git submodule update
    patch Makefile < "$startdir"/Makefile.patch
    patch crosstool-config-overrides \
        < "$startdir"/crosstool-config-overrides.patch
    patch examples/blinky/Makefile < "$startdir"/blinky_Makefile.patch
}

build() {
    cd "$srcdir"/esp-open-sdk
    CPPFLAGS= CFLAGS= CXXFLAGS= LDFLAGS= LD_LIBRARY_PATH= make
    cp sdk/lib/libgcc.a xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5
}

package() {
    cd "$startdir"
    mkdir -p "$pkgdir"/etc/profile.d
    install -m755 esp-open-sdk-git.sh "$pkgdir"/etc/profile.d

    mkdir -p "$pkgdir"/opt/esp-open-sdk
    cd "$srcdir"/esp-open-sdk/
    cp -dpr --no-preserve=ownership sdk "$pkgdir"/opt/esp-open-sdk
    cp -dpr --no-preserve=ownership \
        `find -type d -maxdepth 1 -name "ESP8266_*"` "$pkgdir"/opt/esp-open-sdk
    cp -dpr --no-preserve=ownership xtensa-lx106-elf "$pkgdir"/opt/esp-open-sdk

    ln -s "$pkgdir"/opt/esp-open-sdk/ESP8266_*/driver_lib/include/driver/ "$pkgdir"/opt/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/include/
}