@@ -23,11 +23,12 @@ lto=${lto:-false}
23
23
# Default to linux building if nothing else set
24
24
host=${host:- linux}
25
25
EXE=" "
26
+ MKSPIFFSTGT=" linux"
26
27
case " $host " in
27
28
linux) HOST=" x86_64-linux-gnu" ; AHOST=" x86_64-pc-linux-gnu" ; EXT=" .x86_64" ;;
28
- win32) HOST=" i686-w64-mingw32" ; AHOST=" i686-mingw32" ; EXT=" .win32" ; EXE=" .exe" ;;
29
- win64) HOST=" x86_64-w64-mingw32" ; AHOST=" x86_64-mingw32" ; EXT=" .win64" ; EXE=" .exe" ;;
30
- osx) HOST=" x86_64-apple-darwin14" ; AHOST=" x86_64-apple-darwin" ; EXT=" .osx" ;;
29
+ win32) HOST=" i686-w64-mingw32" ; AHOST=" i686-mingw32" ; EXT=" .win32" ; EXE=" .exe" ; MKSPIFFSTGT= ' windows ' ; ;
30
+ win64) HOST=" x86_64-w64-mingw32" ; AHOST=" x86_64-mingw32" ; EXT=" .win64" ; EXE=" .exe" ; MKSPIFFSTGT= ' windows ' ; ;
31
+ osx) HOST=" x86_64-apple-darwin14" ; AHOST=" x86_64-apple-darwin" ; EXT=" .osx" ; MKSPIFFSTGT= ' osx ' ; ;
31
32
arm64) HOST=" aarch64-linux-gnu" ; AHOST=" aarch64-linux-gnu" ; EXT=" .arm64" ;;
32
33
rpi) HOST=" arm-linux-gnueabihf" ; AHOST=" arm-linux-gnueabihf" ; EXT=" .rpi" ;;
33
34
* ) echo " Specify host as linux, win32, win64, osx, arm64, or rpi" ; exit 2;;
@@ -49,8 +50,51 @@ clean()
49
50
cleangit gcc-xtensa
50
51
cleangit newlib-xtensa
51
52
cleangit lx106-hal
53
+ cleangit mkspiffs
54
+ cleangit esptool
52
55
}
53
56
57
+ distclean ()
58
+ {
59
+ clean
60
+ rm -rf * .json * .tar.gz * .zip xtensa-lx106-elf.*
61
+ }
62
+
63
+ maketool ()
64
+ {
65
+ if [ ! -r arena/jobdone-${tool} ]; then
66
+ echo " -------- ${tool} "
67
+ ( rm -rf arena/${tool} ;
68
+ cp -a dl/${tool} arena/${tool} ;
69
+ pushd arena/${tool} ;
70
+ TARGET_OS=${MKSPIFFSTGT} CC=${HOST} -gcc CXX=${HOST} -g++ STRIP=${HOST} -strip \
71
+ make clean ${tool}${EXE} BUILD_CONFIG_NAME=" -arduino-esp8266" ${extra_opts} ;
72
+ popd ;
73
+ mkdir -p ${install} /${tool} ;
74
+ cp -a arena/${tool} /${tool}${EXE} ${install} /${tool} /.;
75
+ pushd arena/${tool} && name=${tool} -$( git rev-parse --short HEAD) && popd ;
76
+ pushd ${install} ;
77
+ tarball=${HOST} -$name .${tarext} ;
78
+ ${tarcmd} ${taropts} ../${tarball} ${tool} ;
79
+ popd ;
80
+ makejson;
81
+ touch arena/jobdone-${tool} ;
82
+ ) >& $log .${tool} .log
83
+ fi
84
+ }
85
+
86
+ makejson ()
87
+ {
88
+ tarballsize=$( stat -c%s ${tarball} )
89
+ tarballsha256=$( sha256sum ${tarball} | cut -f1 -d" " )
90
+ ( echo ' {' &&
91
+ echo ' "host": "' $AHOST ' ",' &&
92
+ echo ' "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/' ${rel} -${subrel} ' /' ${tarball} ' ",' &&
93
+ echo ' "archiveFileName": "' ${tarball} ' ",' &&
94
+ echo ' "checksum": "SHA-256:' ${tarballsha256} ' ",' &&
95
+ echo ' "size": "' ${tarballsize} ' "' &&
96
+ echo ' }' ) > ${tarball} .json
97
+ }
54
98
55
99
install ()
56
100
{
@@ -80,27 +124,9 @@ install()
80
124
git=$( git rev-parse --short HEAD)
81
125
ver=${rel} -${git} -${subrel}
82
126
pkgfile=${arduino} /package/package_esp8266com_index.template.json
83
- (cat << EOF
84
- import glob
85
- import json
86
- import os
87
- with open("$pkgfile ") as f:
88
- data = json.load(f)
89
- for i in range(0, len(data["packages"][0]["platforms"][0]["toolsDependencies"])):
90
- if data["packages"][0]["platforms"][0]["toolsDependencies"][i]["name"] == "xtensa-lx106-elf-gcc":
91
- data["packages"][0]["platforms"][0]["toolsDependencies"][i]["version"] = "$ver "
92
- for i in range(0, len(data["packages"][0]["tools"])):
93
- if data["packages"][0]["tools"][i]["name"] == "xtensa-lx106-elf-gcc":
94
- data["packages"][0]["tools"][i]["version"] = "$ver "
95
- data["packages"][0]["tools"][i]["systems"] = []
96
- for j in glob.glob("*xtensa-lx106-elf*"+"$git "+"*json"):
97
- with open(j) as s:
98
- part = json.load(s)
99
- data["packages"][0]["tools"][i]["systems"].append(part)
100
- print json.dumps(data, indent=3, separators=(',',': '))
101
- EOF
102
- ) | python > $pkgfile .new
103
- mv -f ${pkgfile} .new ${pkgfile}
127
+ ./patch_json.py --pkgfile " ${pkgfile} " --tool xtensa-lx106-elf-gcc --ver " ${ver} " --glob ' *xtensa-lx106-elf*.json'
128
+ ./patch_json.py --pkgfile " ${pkgfile} " --tool esptool --ver " ${ver} " --glob ' *esptool*json'
129
+ ./patch_json.py --pkgfile " ${pkgfile} " --tool mkspiffs --ver " ${ver} " --glob ' *mkspiffs*json'
104
130
echo " Install done"
105
131
}
106
132
@@ -141,6 +167,17 @@ configurenewlibinstall+=${configurenewlibcom}
141
167
configurenewlib=" --prefix=${install} "
142
168
configurenewlib+=${configurenewlibcom}
143
169
170
+
171
+ if [ " ${EXE} " == " " ]; then
172
+ tarext=" tar.gz"
173
+ tarcmd=" tar"
174
+ taropts=" zcf"
175
+ else
176
+ tarext=" zip"
177
+ tarcmd=" zip"
178
+ taropts=" -rq"
179
+ fi
180
+
144
181
if $lto ; then
145
182
export CFLAGS_FOR_TARGET=' -mlongcalls -flto -Wl,-flto -Os -g'
146
183
export CXXFLAGS_FOR_TARGET=' -mlongcalls -flto -Wl,-flto -Os -g'
@@ -157,9 +194,10 @@ export LD_LIBRARY_PATH="${installnative}/lib"
157
194
158
195
case " $1 " in
159
196
clean) clean; exit 0;;
197
+ distclean) distclean; exit 0;;
160
198
build) : ;;
161
199
install) install; exit 0;;
162
- * ) echo " need 'clean', 'build', or 'install'" ; exit 1;;
200
+ * ) echo " need 'clean', 'distclean', ' build', or 'install'" ; exit 1;;
163
201
esac
164
202
165
203
@@ -185,10 +223,13 @@ if [ ! -r arena/downloaded ]; then
185
223
test -d binutils-gdb-xtensa || git clone ${gitopt} https://github.com/earlephilhower/binutils-gdb-xtensa.git
186
224
test -d gcc-xtensa || git clone https://github.com/earlephilhower/gcc-xtensa.git
187
225
test -d newlib-xtensa || git clone ${gitopt} https://github.com/earlephilhower/newlib-xtensa.git
188
- test -d lx106-hal || git clone ${gitopt} https://github.com/earlephilhower/lx106-hal.git
226
+ test -d lx106-hal || git clone https://github.com/earlephilhower/lx106-hal.git
227
+ test -d mkspiffs || git clone https://github.com/earlephilhower/mkspiffs.git
228
+ test -d esptool || git clone https://github.com/earlephilhower/esptool-ck.git esptool
189
229
)
190
230
191
231
( cd dl/gcc-xtensa && git reset --hard && git checkout ${xtensa_branch} )
232
+ ( cd dl/mkspiffs && git submodule update )
192
233
193
234
# download and put tools directly in gcc directory
194
235
# let gcc's configure deal with them in place
259
300
touch arena/patched
260
301
fi
261
302
262
-
263
303
# configure build install binutils
264
304
if [ ! -r arena/binutils/jobdone ]; then
265
305
echo " -------- gdb+binutils"
@@ -292,7 +332,6 @@ if [ ! -r arena/gcc/jobdone-newlib ]; then
292
332
touch arena/gcc/jobdone-newlib
293
333
fi
294
334
295
-
296
335
if [ ! -r arena/gcc/jobdone-stage2 ]; then
297
336
echo " -------- gcc-stage2"
298
337
# stage 2 (build libstdc++)
@@ -330,23 +369,13 @@ for sh in post/${gcc}*.sh; do
330
369
done
331
370
332
371
echo " -------- creating package tgz"
333
- if [ " $EXE " == " .exe" ]; then
334
- tarball=$HOST .xtensa-lx106-elf-$( git rev-parse --short HEAD) .zip
335
- (rm -rf pkg && mkdir pkg && cd pkg && cp -a ../xtensa-lx106-elf${EXT} xtensa-lx106-elf && zip -rq ../${tarball} xtensa-lx106-elf/)
336
- else
337
- tarball=$HOST .xtensa-lx106-elf-$( git rev-parse --short HEAD) .tar.gz
338
- (rm -rf pkg && mkdir pkg && cd pkg && cp -a ../xtensa-lx106-elf${EXT} xtensa-lx106-elf && tar zcf ../${tarball} xtensa-lx106-elf/)
339
- fi
340
- tarballsize=$( stat -c%s ${tarball} )
341
- tarballsha256=$( sha256sum ${tarball} | cut -f1 -d" " )
342
- ( echo ' {' &&
343
- echo ' "host": "' $AHOST ' ",' &&
344
- echo ' "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/' ${rel} -${subrel} ' /' ${tarball} ' ",' &&
345
- echo ' "archiveFileName": "' ${tarball} ' ",' &&
346
- echo ' "checksum": "SHA-256:' ${tarballsha256} ' ",' &&
347
- echo ' "size": "' ${tarballsize} ' "' &&
348
- echo ' }' ) > ${tarball} .json
349
- rm -rf pkg
372
+ tarball=$HOST .xtensa-lx106-elf-$( git rev-parse --short HEAD) .${tarext}
373
+ (rm -rf pkg && mkdir pkg && cd pkg && cp -a ../xtensa-lx106-elf${EXT} xtensa-lx106-elf && ${tarcmd} ${taropts} ../${tarball} xtensa-lx106-elf/)
374
+ makejson
375
+
376
+ tool=mkspiffs CPPFLAGS=" -DSPIFFS_USE_MAGIC_LENGTH=0 -DSPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1" maketool
377
+
378
+ tool=esptool extra_opts=' ' maketool
350
379
351
380
echo " all done (${install} )"
352
381
rm -f ${unfinished}
0 commit comments