multibuild.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # Copyright 2013 Luke Dashjr
  3. #
  4. # This program is free software; you can redistribute it and/or modify it
  5. # under the terms of the GNU General Public License as published by the Free
  6. # Software Foundation; either version 3 of the License, or (at your option)
  7. # any later version. See COPYING for more details.
  8. set -e
  9. set -x
  10. reporoot="$1" # .../files/bfgminer/BFGMINER_VERSION/openwrt/OPENWRT_VERSION
  11. test -n "$reporoot"
  12. reporoot="$(realpath "$reporoot")"
  13. test -n "$reporoot"
  14. cd "openwrt-src/"
  15. test -d "$reporoot"
  16. vcfgdir='vanilla_configs'
  17. vcfglist="$(
  18. ls -d "$vcfgdir"/*.config* |
  19. perl -ple 's[.*/][]' |
  20. sort -n
  21. )"
  22. BITSTREAM_PKG_PATH='../../../../bitstreams/openwrt/' # Relative to reporoot
  23. BITSTREAMS=(
  24. fpgaminer_402-1
  25. ztex-ufm1_15b1_121126-1
  26. ztex-ufm1_15d4_121126-1
  27. ztex-ufm1_15y1_121126-1
  28. )
  29. if [ -d "${reporoot}/${BITSTREAM_PKG_PATH}" ]; then
  30. (
  31. for bs in ${BITSTREAMS[@]}; do
  32. if ! [ -r "${reporoot}/${BITSTREAM_PKG_PATH}/bitstream-${bs}_all.ipk" ]; then
  33. echo "Cannot find ${bs} bitstream package" >&2
  34. exit 1
  35. fi
  36. done
  37. )
  38. else
  39. echo 'Cannot find bitstreams directory' >&2
  40. exit 1
  41. fi
  42. plat1=''
  43. for cfn in $vcfglist; do
  44. plat="$(perl -ple 's/^(\d+)\.config\.(\w+?)_\w+$/$2/ or $_=""' <<<"$cfn")"
  45. test -n "$plat" ||
  46. continue
  47. platlist+=("$plat")
  48. cp -v "$vcfgdir/$cfn" .config
  49. yes '' | make oldconfig
  50. make {tools,toolchain}/install package/bfgminer/{clean,compile}
  51. mkdir "$reporoot/$plat" -pv
  52. cp -v "bin/$plat/packages/"b{fgminer,itforce}*_${plat}.ipk "$reporoot/$plat/"
  53. if [ -d "$reporoot/${BITSTREAM_PKG_PATH}" ]; then
  54. (
  55. cd "$reporoot/$plat"
  56. for bs in ${BITSTREAMS[@]}; do
  57. ln -vfs "../${BITSTREAM_PKG_PATH}/bitstream-${bs}_all.ipk" .
  58. done
  59. )
  60. fi
  61. staging_dir/host/bin/ipkg-make-index "$reporoot/$plat/" > "$reporoot/$plat/Packages"
  62. gzip -9 < "$reporoot/$plat/Packages" > "$reporoot/$plat/Packages.gz"
  63. done