mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Use jq to generate package json
This commit is contained in:
82
package/build_boards_manager_package.sh
Executable file
82
package/build_boards_manager_package.sh
Executable file
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# Set REMOTE_URL environment variable to the address where the package will be
|
||||
# available for download. This gets written into package json file.
|
||||
if [ -z "$REMOTE_URL" ]; then
|
||||
REMOTE_URL="http://localhost:8000"
|
||||
echo "REMOTE_URL not defined, using default"
|
||||
fi
|
||||
echo "Remote: $REMOTE_URL"
|
||||
|
||||
# Figure out how will the package be called
|
||||
ver=`git describe --tags --always`
|
||||
package_name=esp8266-$ver
|
||||
echo "Version: $ver"
|
||||
echo "Package name: $package_name"
|
||||
|
||||
# Create directory for the package
|
||||
outdir=versions/$ver/$package_name
|
||||
srcdir=$PWD/..
|
||||
rm -rf versions/$ver
|
||||
mkdir -p $outdir
|
||||
|
||||
# Some files should be excluded from the package
|
||||
cat << EOF > exclude.txt
|
||||
.git
|
||||
.gitignore
|
||||
.travis.yml
|
||||
package
|
||||
EOF
|
||||
# Also include all files which are ignored by git
|
||||
git ls-files --other --ignored --exclude-standard --directory >> exclude.txt
|
||||
# Now copy files to $outdir
|
||||
rsync -a --exclude-from 'exclude.txt' $srcdir/ $outdir/
|
||||
rm exclude.txt
|
||||
|
||||
# Get additional libraries (TODO: add them as git submodule or subtree?)
|
||||
wget -q -O SoftwareSerial.zip https://github.com/plerup/espsoftwareserial/archive/38259afcab9c291dbb6216f827d9a3738abf1868.zip
|
||||
unzip -q SoftwareSerial.zip
|
||||
rm -rf SoftwareSerial.zip
|
||||
mv espsoftwareserial-* SoftwareSerial
|
||||
mv SoftwareSerial $outdir/libraries
|
||||
|
||||
# For compatibility, on OS X we need GNU sed which is usually called 'gsed'
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
SED=gsed
|
||||
else
|
||||
SED=sed
|
||||
fi
|
||||
|
||||
# Do some replacements in platform.txt file, which are required because IDE
|
||||
# handles tool paths differently when package is installed in hardware folder
|
||||
cat $srcdir/platform.txt | \
|
||||
$SED 's/runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-lx106-elf//g' | \
|
||||
$SED 's/runtime.tools.esptool.path={runtime.platform.path}\/tools\/esptool//g' | \
|
||||
$SED 's/tools.esptool.path={runtime.platform.path}\/tools\/esptool/tools.esptool.path=\{runtime.tools.esptool.path\}/g' | \
|
||||
$SED 's/tools.mkspiffs.path={runtime.platform.path}\/tools\/mkspiffs/tools.mkspiffs.path=\{runtime.tools.mkspiffs.path\}/g' \
|
||||
> $outdir/platform.txt
|
||||
|
||||
# Zip the package
|
||||
pushd versions/$ver
|
||||
echo "Making $package_name.zip"
|
||||
zip -qr $package_name.zip $package_name
|
||||
rm -rf $package_name
|
||||
|
||||
# Calculate SHA sum and size
|
||||
sha=`shasum -a 256 $package_name.zip | cut -f 1 -d ' '`
|
||||
size=`/bin/ls -l $package_name.zip | awk '{print $5}'`
|
||||
echo Size: $size
|
||||
echo SHA-256: $sha
|
||||
|
||||
echo "Making package_esp8266com_index.json"
|
||||
cat $srcdir/package/package_esp8266com_index.template.json | \
|
||||
jq ".packages[0].platforms[0].version = \"$ver\" | \
|
||||
.packages[0].platforms[0].url = \"$REMOTE_URL/versions/$ver/$package_name.zip\" |\
|
||||
.packages[0].platforms[0].archiveFileName = \"$package_name.zip\" |\
|
||||
.packages[0].platforms[0].checksum = \"SHA-256:$sha\" |\
|
||||
.packages[0].platforms[0].size = \"$size\" |\
|
||||
.packages[0].platforms[0].help.online = \"$REMOTE_URL/versions/$ver/doc/reference.html\"" \
|
||||
> package_esp8266com_index.json
|
||||
|
||||
popd
|
193
package/package_esp8266com_index.template.json
Normal file
193
package/package_esp8266com_index.template.json
Normal file
@ -0,0 +1,193 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "esp8266",
|
||||
"maintainer": "ESP8266 Community",
|
||||
"websiteURL": "https://github.com/esp8266/Arduino",
|
||||
"email": "ivan@esp8266.com",
|
||||
"help": {
|
||||
"online": "http://esp8266.com/arduino"
|
||||
},
|
||||
"platforms": [
|
||||
{
|
||||
"name": "esp8266",
|
||||
"architecture": "esp8266",
|
||||
"version": "",
|
||||
"category": "ESP8266",
|
||||
"url": "",
|
||||
"archiveFileName": "",
|
||||
"checksum": "",
|
||||
"size": "",
|
||||
"help": {
|
||||
"online": ""
|
||||
},
|
||||
"boards": [
|
||||
{
|
||||
"name": "Generic ESP8266 Module"
|
||||
},
|
||||
{
|
||||
"name": "Olimex MOD-WIFI-ESP8266(-DEV)"
|
||||
},
|
||||
{
|
||||
"name": "NodeMCU 0.9 (ESP-12 Module)"
|
||||
},
|
||||
{
|
||||
"name": "NodeMCU 1.0 (ESP-12E Module)"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit HUZZAH ESP8266 (ESP-12)"
|
||||
},
|
||||
{
|
||||
"name": "SparkFun Thing"
|
||||
},
|
||||
{
|
||||
"name": "SweetPea ESP-210"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": [
|
||||
{
|
||||
"packager": "esp8266",
|
||||
"name": "esptool",
|
||||
"version": "0.4.6"
|
||||
},
|
||||
{
|
||||
"packager": "esp8266",
|
||||
"name": "xtensa-lx106-elf-gcc",
|
||||
"version": "1.20.0-26-gb404fb9-2"
|
||||
},
|
||||
{
|
||||
"packager": "esp8266",
|
||||
"name": "mkspiffs",
|
||||
"version": "0.1.2"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tools": [
|
||||
{
|
||||
"name": "esptool",
|
||||
"version": "0.4.6",
|
||||
"systems": [
|
||||
{
|
||||
"host": "i686-mingw32",
|
||||
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-win32.zip",
|
||||
"archiveFileName": "esptool-0.4.6-win32.zip",
|
||||
"checksum": "SHA-256:0248bf78514a3195f583e29218ca7828a66e13c6e5545a078f1c1257033e4927",
|
||||
"size": "17481"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-apple-darwin",
|
||||
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-osx.tar.gz",
|
||||
"archiveFileName": "esptool-0.4.6-osx.tar.gz",
|
||||
"checksum": "SHA-256:0fe87ba7e29ee90a9fc72492aada8c0796f9e8f8a1c594b6b26cee2610d09bb3",
|
||||
"size": "20926"
|
||||
},
|
||||
{
|
||||
"host": "i386-apple-darwin",
|
||||
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-osx.tar.gz",
|
||||
"archiveFileName": "esptool-0.4.6-osx.tar.gz",
|
||||
"checksum": "SHA-256:0fe87ba7e29ee90a9fc72492aada8c0796f9e8f8a1c594b6b26cee2610d09bb3",
|
||||
"size": "20926"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-pc-linux-gnu",
|
||||
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-linux64.tar.gz",
|
||||
"archiveFileName": "esptool-0.4.6-linux64.tar.gz",
|
||||
"checksum": "SHA-256:f9f456e9a42bb2597126c513cb8865f923fb978865d4838b9623d322216b74d0",
|
||||
"size": "12885"
|
||||
},
|
||||
{
|
||||
"host": "i686-pc-linux-gnu",
|
||||
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-linux32.tar.gz",
|
||||
"archiveFileName": "esptool-0.4.6-linux32.tar.gz",
|
||||
"checksum": "SHA-256:85275ca03a82bfc456f5a84e86962ca1e470ea2e168829c38ca29ee668831d93",
|
||||
"size": "13417"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "xtensa-lx106-elf-gcc",
|
||||
"version": "1.20.0-26-gb404fb9-2",
|
||||
"systems": [
|
||||
{
|
||||
"host": "i686-mingw32",
|
||||
"url": "http://arduino.esp8266.com/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
|
||||
"archiveFileName": "win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
|
||||
"checksum": "SHA-256:10476b9c11a7a90f40883413ddfb409f505b20692e316c4e597c4c175b4be09c",
|
||||
"size": "153527527"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-apple-darwin",
|
||||
"url": "http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
|
||||
"archiveFileName": "osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
|
||||
"checksum": "SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
|
||||
"size": "35385382"
|
||||
},
|
||||
{
|
||||
"host": "i386-apple-darwin",
|
||||
"url": "http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
|
||||
"archiveFileName": "osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
|
||||
"checksum": "SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
|
||||
"size": "35385382"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-pc-linux-gnu",
|
||||
"url": "http://arduino.esp8266.com/linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
|
||||
"archiveFileName": "linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
|
||||
"checksum": "SHA-256:46f057fbd8b320889a26167daf325038912096d09940b2a95489db92431473b7",
|
||||
"size": "30262903"
|
||||
},
|
||||
{
|
||||
"host": "i686-pc-linux-gnu",
|
||||
"url": "http://arduino.esp8266.com/linux32-xtensa-lx106-elf.tar.gz",
|
||||
"archiveFileName": "linux32-xtensa-lx106-elf.tar.gz",
|
||||
"checksum": "SHA-256:b24817819f0078fb05895a640e806e0aca9aa96b47b80d2390ac8e2d9ddc955a",
|
||||
"size": "32734156"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mkspiffs",
|
||||
"version": "0.1.2",
|
||||
"systems": [
|
||||
{
|
||||
"host": "i686-mingw32",
|
||||
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-windows.zip",
|
||||
"archiveFileName": "mkspiffs-0.1.2-windows.zip",
|
||||
"checksum": "SHA-256:0a29119b8458b61a877408f7995e4944623a712e0d313a2c2f76af9ab55cc9f2",
|
||||
"size": "230802"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-apple-darwin",
|
||||
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-osx.tar.gz",
|
||||
"archiveFileName": "mkspiffs-0.1.2-osx.tar.gz",
|
||||
"checksum": "SHA-256:df656fae21a41c1269ea50cb53752dcaf6a4e1437255f3a9fb50b4025549b58e",
|
||||
"size": "115091"
|
||||
},
|
||||
{
|
||||
"host": "i386-apple-darwin",
|
||||
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-osx.tar.gz",
|
||||
"archiveFileName": "mkspiffs-0.1.2-osx.tar.gz",
|
||||
"checksum": "SHA-256:df656fae21a41c1269ea50cb53752dcaf6a4e1437255f3a9fb50b4025549b58e",
|
||||
"size": "115091"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-pc-linux-gnu",
|
||||
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-linux64.tar.gz",
|
||||
"archiveFileName": "mkspiffs-0.1.2-linux64.tar.gz",
|
||||
"checksum": "SHA-256:1a1dd81b51daf74c382db71b42251757ca4136e8762107e69feaa8617bac315f",
|
||||
"size": "46281"
|
||||
},
|
||||
{
|
||||
"host": "i686-pc-linux-gnu",
|
||||
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-linux32.tar.gz",
|
||||
"archiveFileName": "mkspiffs-0.1.2-linux32.tar.gz",
|
||||
"checksum": "SHA-256:e990d545dfcae308aabaac5fa9e1db734cc2b08167969e7eedac88bd0839667c",
|
||||
"size": "45272"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user