diff --git a/tools/sdk/lib/compare/sdk-compare-includes b/tools/sdk/lib/compare/sdk-compare-includes new file mode 100755 index 000000000..22ea26256 --- /dev/null +++ b/tools/sdk/lib/compare/sdk-compare-includes @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +# released to public domain + +help() +{ + cat << eof + +usage: $1 + +Compare include files against sdk's + +eof + exit 1 +} + + +sdk="$1" +me="$0" +core=${me%/*}/../../../.. + +[ -r "$sdk/lib/libnet80211.a" ] || help "$0" + +for f in $(cd "$sdk"; find include -type f); do + diff -bu "$sdk/$f" "$core/tools/sdk/$f" || true +done | sed \ + -e 's/^+#ifdef.*cplusplus//g' \ + -e 's/^+extern "C"//g' \ + -e 's/^+}$//g' \ + -e 's/^+#endif//g' \ + -e 's/^+[ \t]*$//g' \ diff --git a/tools/sdk/lib/compare/sdk-compare-libs b/tools/sdk/lib/compare/sdk-compare-libs new file mode 100755 index 000000000..8b083c355 --- /dev/null +++ b/tools/sdk/lib/compare/sdk-compare-libs @@ -0,0 +1,109 @@ +#!/bin/bash + +set -e + +# released to public domain + +help() +{ + cat << eof + +usage: $1 [-v] + +For each binary-only library file from ESP-NONOS-SDK, this script searches for +the exact commits and reports matching versions and commit urls. + +The argument must be the ESP-NONOS-SDK git-cloned directory. It is left +unmodified, and is locally cloned to work with. The local copy is then +removed. + +Because of libmain.a local tweaks, comparison is done for each .a file by +extracting object files, removing the potentially modified ones +(mem_manager.o time.o user_interface.o eagle_lwip_if.o) and doing a md5 +check against the core files. + +eof + exit 1 +} + + +verbose=false +[ "$1" = "-v" ] && { shift; verbose=true; } +sdk="$1" +me="$0" +core=$(cd ${me%/*}/../../../..; pwd) + + +[ -r "$sdk/lib/libnet80211.a" ] || help "$0" +[ -r "$core/tools/xtensa-lx106-elf/bin" ] || help "$0" + +tmp=$(pwd)/NONOSDK.deleteme + +cat << eof + +nonos-sdk = '$sdk' +core root directory = '$core' +temporary nonos-sdk clone = '$tmp' + +If libmain.a is not found, it should be the one around the same libpp.a's commit + +eof + +md5() +{ + mkdir temp + cd temp + PATH="$core/tools/xtensa-lx106-elf/bin:$PATH" xtensa-lx106-elf-ar x "$1" + rm -f mem_manager.o time.o user_interface.o eagle_lwip_if.o + cat *.o | md5sum + cd .. + rm -rf temp +} + +search() +{ + rm -rf "$tmp" + git clone $sdk "$tmp" 1>&2 + cd "$tmp" + git reset --hard 1>&2 + + corelibs=$(cd "$core/tools/sdk/lib"; ls *.a) + commits=$(git log|grep ^commit\ | tac | sed 's,commit ,,') + + for f in $corelibs; do + + git checkout master 1>&2 # needed + + if [ -r "$tmp/lib/$f" ]; then + + coremd5=$(md5 "$core/tools/sdk/lib/$f") + found=false + + for i in $commits; do + git reset --hard 1>&2 + git checkout $i 1>&2 + + [ -d "$tmp/lib" ] || continue + + espmd5=$(md5 "$tmp/lib/$f") + if [ "$espmd5" = "$coremd5" ]; then + tag=$(git describe --tag) + echo "$tag - https://github.com/espressif/ESP8266_NONOS_SDK/commit/$i - $f" + found=true + break + fi + done + + $found || echo "NOTFOUND - $f" + fi + + done + + cd .. + rm -rf "$tmp" +} + +$verbose && search +$verbose || search 2>/dev/null + +echo "all done"