From: Andy Green Date: Thu, 4 May 2017 18:17:28 +0000 (+0800) Subject: esp32: mac build: use gstat if exists X-Git-Tag: accepted/tizen/4.0/unified/20171012.191640~121 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e304d7bba7ecf8ec6e9b8ab7b621b45d82ff3c2f;p=platform%2Fupstream%2Flibwebsockets.git esp32: mac build: use gstat if exists --- diff --git a/scripts/esp32.mk b/scripts/esp32.mk index 9d2581a..0049fe6 100644 --- a/scripts/esp32.mk +++ b/scripts/esp32.mk @@ -18,18 +18,20 @@ export FAC .PHONY: romfs.img pack.img: + GNUSTAT=stat ;\ + if [ `which gstat 2>/dev/null` ] ; then GNUSTAT=gstat ; fi ;\ DIRNAME=$$(basename $$(pwd) | tr -d '\n') ;\ cp $(COMPONENT_PATH)/../build/$(PROJECT_NAME).bin $(COMPONENT_PATH)/../build/$$DIRNAME.bin ; \ genromfs -f $(COMPONENT_PATH)/../build/romfs.img -d $(COMPONENT_PATH)/../romfs-files ; \ - RLEN=$$(stat -c %s $(COMPONENT_PATH)/../build/romfs.img) ;\ - LEN=$$(stat -c %s $(COMPONENT_PATH)/../build/$$DIRNAME.bin) ;\ + RLEN=$$($$GNUSTAT -c %s $(COMPONENT_PATH)/../build/romfs.img) ;\ + LEN=$$($$GNUSTAT -c %s $(COMPONENT_PATH)/../build/$$DIRNAME.bin) ;\ printf " Original length: 0x%06x (%8d)\n" $$LEN $$LEN ; \ printf %02x $$(( $$RLEN % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ printf %02x $$(( ( $$RLEN / 256 ) % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ printf %02x $$(( ( $$RLEN / 65536 ) % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ printf %02x $$(( ( $$RLEN / 16777216 ) % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ cat $(COMPONENT_PATH)/../build/romfs.img >>$(COMPONENT_PATH)/../build/$$DIRNAME.bin ; \ - LEN=$$(stat -c %s $(COMPONENT_PATH)/../build/$$DIRNAME.bin) ;\ + LEN=$$($$GNUSTAT -c %s $(COMPONENT_PATH)/../build/$$DIRNAME.bin) ;\ UNIXTIME=$$(date +%s | tr -d '\n') ; \ echo -n -e "{\r\n \"schema\": \"lws1\",\r\n \"model\": \"$(CONFIG_LWS_MODEL_NAME)\",\r\n \"builder\": \"" > $(jbi) ;\ hostname | tr -d '\n' >> $(jbi) ;\ @@ -46,13 +48,13 @@ pack.img: echo -n -e "\",\r\n \"file\": \""$$DIRNAME-$$UNIXTIME.bin >> $(jbi) ;\ echo -n -e "\",\r\n \"factory\": \"$(FAC)" >> $(jbi) ;\ echo -n -e "\"\r\n}" >> $(jbi) ;\ - JLEN=$$(stat -c %s $(jbi)) ;\ + JLEN=$$($$GNUSTAT -c %s $(jbi)) ;\ printf %02x $$(( $$JLEN % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ printf %02x $$(( ( $$JLEN / 256 ) % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ printf %02x $$(( ( $$JLEN / 65536 ) % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ printf %02x $$(( ( $$JLEN / 16777216 ) % 256 )) | xxd -r -p >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ cat $(jbi) >> $(COMPONENT_PATH)/../build/$$DIRNAME.bin ;\ - LEN=$$(stat -c %s $(COMPONENT_PATH)/../build/$$DIRNAME.bin) ;\ + LEN=$$($$GNUSTAT -c %s $(COMPONENT_PATH)/../build/$$DIRNAME.bin) ;\ cp $(COMPONENT_PATH)/../build/$$DIRNAME.bin $(COMPONENT_PATH)/../build/$$DIRNAME-$$UNIXTIME.bin ;\ printf " After ROMFS + Build info: 0x%06x (%8d)\n" $$LEN $$LEN