Guest User

Untitled

a guest
Apr 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4.  
  5. CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  6.  
  7. # Delete all -Werror strings from configure.ac
  8. # Don't treat warnings as errors!
  9. sed -i "s/ -Werror//" $CWD/configure.ac
  10.  
  11. # Generate automake files
  12. autoreconf -i
  13.  
  14. # Configure: Disable all codes except QR code, disable all unneccesary features
  15. # This may produce red error messages, but it is safe to ignore them (it assumes that
  16. # emscripten is GCC and uses invalid parameters on it)
  17. emconfigure ./configure --enable-codes=ean --without-x --without-jpeg --without-imagemagick --without-npapi --without-gtk --without-python --without-qt --without-xshm --disable-video --disable-pthread
  18.  
  19. # Compile!
  20. emmake make
  21.  
  22. # Glue javascript and compiled code together
  23. emcc -O1 -I`pwd`/include ./templates/zbar-main.c ./zbar/.libs/libzbar.a --js-library ./templates/zbar-callbacks.js -o ./decoder-content.js
  24. sed '//* EMSCRIPTEN_CODE *//r ./decoder-content.js' ./templates/zbar-processor-wrapper.js > ./decoder.js
  25.  
  26. echo ""
  27. echo "If everything worked, there should now be a functional decoder.js file"
  28. echo "Use any JavaScript Minifier to reduce its file size and thereby server bandwidth"
  29. echo "The resulting decoder.min.js will be used by QRScanJS"
  30.  
  31. CWD="%( cd "%( dirname "%{BASH_SOURCE[0]}" )" && %cd% )" || exit /b 1
  32.  
  33. call jrepl -i "s/ -Werror//" %CWD/configure.ac || exit /b 1
  34.  
  35. autoreconf -i || exit /b 1
  36.  
  37. emconfigure ./configure --enable-codes=ean --without-x --without-jpeg --without-imagemagick --without-npapi --without-gtk --without-python --without-qt --without-xshm --disable-video --disable-pthread || exit /b 1
  38.  
  39. emmake make || exit /b 1
  40.  
  41. emcc -O1 -I`%cd%`/include ./templates/zbar-main.c ./zbar/.libs/libzbar.a --js-library ./templates/zbar-callbacks.js -o ./decoder-content.js || exit /b 1
  42. call jrepl '//* EMSCRIPTEN_CODE *//r ./decoder-content.js' ./templates/zbar-processor-wrapper.js > ./decoder.js
  43.  
  44. echo ""
  45. echo "If everything worked, there should now be a functional decoder.js file"
  46. echo "Use any JavaScript Minifier to reduce its file size and thereby server bandwidth"
  47. echo "The resulting decoder.min.js will be used by QRScanJS"
Add Comment
Please, Sign In to add comment