-
Notifications
You must be signed in to change notification settings - Fork 56
/
build-cross.sh
executable file
·40 lines (37 loc) · 1.62 KB
/
build-cross.sh
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
#!/bin/bash
name=mklittlefs-$(git rev-parse --short HEAD)
rel=${rel:=-2.5.0}
subrel=${subrel:-2}
rm -f *.json *.gz *.zip
build ()
{(
TARGET_OS=${tgt} CC=${pfx}-gcc CXX=${pfx}-g++ STRIP=${pfx}-strip make clean mklittlefs${exe} BUILD_CONFIG_NAME="-arduino-esp8266" CPPFLAGS="-DSPIFFS_USE_MAGIC_LENGTH=0 -DSPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1"
rm -rf tmp
mkdir -p tmp/mklittlefs
mv mklittlefs${exe} tmp/mklittlefs/.
cd tmp
if [ "${exe}" == "" ]; then
tarball=${pfx}-$name.tar.gz
tar zcvf ../${tarball} mklittlefs
else
tarball=${pfx}-$name.zip
zip -rq ../${tarball} mklittlefs
fi
cd ..
rm -rf tmp
tarballsize=$(stat -c%s ${tarball})
tarballsha256=$(sha256sum ${tarball} | cut -f1 -d" ")
( echo ' {' &&
echo ' "host": "'$AHOST'",' &&
echo ' "url": "https://github.com/earlephilhower/mklittlefs/releases/download/'${rel}-${subrel}'/'${tarball}'",' &&
echo ' "archiveFileName": "'${tarball}'",' &&
echo ' "checksum": "SHA-256:'${tarballsha256}'",' &&
echo ' "size": "'${tarballsize}'"' &&
echo ' }') > ${tarball}.json
)}
tgt=osx pfx=x86_64-apple-darwin15 exe="" AHOST="x86_64-apple-darwin" build
tgt=windows pfx=x86_64-w64-mingw32 exe=".exe" AHOST="x86_64-mingw32" build
tgt=windows pfx=i686-w64-mingw32 exe=".exe" AHOST="i686-mingw32" build
tgt=linux pfx=arm-linux-gnueabihf exe="" AHOST="arm-linux-gnueabihf" build
tgt=linux pfx=aarch64-linux-gnu exe="" AHOST="aarch64-linux-gnu" build
tgt=linux pfx=x86_64-linux-gnu exe="" AHOST="x86_64-pc-linux-gnu" build