tobuild 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/bash
  2. # helper: prepare a small source archive for those utils
  3. # that don't easily cross-compile. Then the tarball can be extracted
  4. # on those systems with the target architecture, and compiled.
  5. #
  6. # Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. [ "x${DEBUG+set}" = 'xset' ] && set -v
  22. set -u -e
  23. if [ -f "version" ]; then
  24. # _src release archive is being used
  25. version="$(cat version)"
  26. else
  27. # git repo is being used
  28. version="$(git describe --tags HEAD)"
  29. fi
  30. versiondir="release/${version}"
  31. distname="libreboot_${version}_tobuild"
  32. distdir="${versiondir}/${distname}"
  33. printf "Creating source archive for flashrom and bucts\n"
  34. # delete the old data
  35. rm -Rf "${distdir:?}/"
  36. rm -f "${distdir}.tar.xz"
  37. # this is where they will go
  38. mkdir -p "${distdir}/"
  39. # flashrom
  40. cp -R "flashrom/" "${distdir}/"
  41. rm -f "${distdir}/flashrom/flashrom_lenovobios_sst"
  42. rm -f "${distdir}/flashrom/flashrom_lenovobios_macronix"
  43. (cd "${distdir}/flashrom/" && make clean)
  44. mkdir -p "${distdir}/resources/flashrom/"
  45. cp -R "resources/flashrom/patch/" "${distdir}/resources/flashrom/"
  46. # bucts
  47. cp -R "bucts/" "${distdir}/"
  48. (cd "${distdir}/bucts/" && make clean)
  49. mkdir -p "${distdir}/resources/bucts/"
  50. cp -R "resources/bucts/patch/" "${distdir}/resources/bucts/"
  51. # the build script will be needed
  52. cp build "${distdir}/"
  53. # needed build scripts (helpers)
  54. mkdir -p "${distdir}/resources/scripts/helpers/build/"
  55. mkdir -p "${distdir}/resources/scripts/helpers/build/module/"
  56. mkdir -p "${distdir}/resources/scripts/helpers/build/clean/"
  57. cp "resources/scripts/helpers/build/clean/bucts" "${distdir}/resources/scripts/helpers/build/clean/"
  58. cp "resources/scripts/helpers/build/clean/flashrom" "${distdir}/resources/scripts/helpers/build/clean/"
  59. cp "resources/scripts/helpers/build/module/bucts" "${distdir}/resources/scripts/helpers/build/module/"
  60. cp "resources/scripts/helpers/build/module/flashrom" "${distdir}/resources/scripts/helpers/build/module/"
  61. cp "resources/scripts/misc/powertop.trisquel7" "${distdir}/"
  62. printf '%s\n' "${version}" >"${distdir}/version"
  63. # that is all. now tar it up
  64. (cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz")
  65. # and delete the directory
  66. rm -Rf "${distdir:?}/"
  67. printf "\n"
  68. printf "Tar archive created: %s\n" "${distdir}.tar.xz"
  69. printf "NOTE: don't forget to add ARM binaries for flashrom.\n"
  70. printf "NOTE: don't forget to add i386 binaries for flashrom/bucts.\n"
  71. printf "The archive %s.tar.xz has been created with everything needed to build these utilities.\n\n" "${distname}"