build.sh 860 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. list="x86_64-linux-gnu-gcc i686-linux-gnu-gcc arm-linux-gnueabi-gcc aarch64-linux-gnu-gcc sparc64-linux-gnu-gcc mips-linux-gnu-gcc powerpc-linux-gnu-gcc"
  3. declare -A alias=( [i686-linux-gnu-gcc]=x86-linux-gnu-gcc )
  4. declare -a compilers
  5. IFS= read -ra candidates <<< "$list"
  6. # first select platforms/compilers
  7. for cc in ${candidates[@]}
  8. do
  9. # check compiler first
  10. if ! command -v $cc &> /dev/null; then
  11. continue
  12. fi
  13. if [[ $# == 0 ]]; then
  14. compilers+=($cc)
  15. continue
  16. fi
  17. for arg in $@
  18. do
  19. if [[ ${alias[$cc]:-$cc} =~ $arg ]]; then
  20. compilers+=($cc)
  21. fi
  22. done
  23. done
  24. for cc in ${compilers[@]}
  25. do
  26. IFS=- read -r platform host dummy <<< ${alias[$cc]:-$cc}
  27. make clean && make CC=$cc
  28. mkdir -p ../targets/$host/$platform
  29. cp libalac.a $_
  30. done
  31. mkdir -p ../targets/include
  32. cp ALACAudioTypes.h $_
  33. cp ALACEncoder.h $_
  34. cp ALACDecoder.h $_