build-linux-arm.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. # Linux build, optimised for ARM devices
  3. if [ ! -e configure ]; then
  4. echo "Creating configure..."
  5. rm -rf autom4te.cache
  6. rm -f Makefile.in aclocal.m4 autom4te.cache compat/Makefile.in
  7. rm -f compile config.guess config.sub config.status configure
  8. rm -f cpuminer-config.h.in depcomp install-sh missing
  9. if ./autogen.sh; then
  10. echo " => done."
  11. else
  12. exit 1
  13. fi
  14. fi
  15. if [ -e Makefile ]; then
  16. echo "Cleaning previous build..."
  17. make distclean
  18. echo " => done."
  19. fi
  20. echo "Configuring..."
  21. # --disable-assembly: some ASM code doesn't build on ARM
  22. # Note: we don't enable -flto, it doesn't bring anything here but slows down
  23. # the build a lot. If needed, just add -flto to the CFLAGS string.
  24. # normal build.
  25. ./configure --with-crypto --with-curl --disable-assembly CC=gcc CXX=g++ CFLAGS="-Ofast -fuse-linker-plugin -ftree-loop-if-convert-stores -march=native" LDFLAGS="-march=native"
  26. # debug build
  27. #./configure --with-crypto --with-curl --disable-assembly CC=gcc CXX=g++ CFLAGS="-O0 -g3 -fuse-linker-plugin -ftree-loop-if-convert-stores -march=native" LDFLAGS="-g3 -march=native"
  28. [ $? = 0 ] || exit $?
  29. echo " => done."
  30. if [ -z "$NPROC" ]; then
  31. NPROC=$(nproc 2>/dev/null)
  32. NPROC=${NPROC:-1}
  33. fi
  34. echo "Compiling on $NPROC processes..."
  35. make -j $NPROC
  36. if [ $? != 0 ]; then
  37. echo "Compilation failed (make=$?)".
  38. echo "Common causes: missing libjansson-dev libcurl4-openssl-dev libssl-dev"
  39. echo "If you pulled updates into this directory, remove configure and try again."
  40. exit 1
  41. fi
  42. echo " => done."
  43. echo '$ ls -l cpuminer'
  44. ls -l cpuminer
  45. echo "Stripping..."
  46. strip -s cpuminer
  47. [ $? = 0 ] || exit $?
  48. echo " => done."