src 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/usr/bin/env bash
  2. #
  3. # helper script: generate the source release archive
  4. #
  5. # Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
  6. # Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
  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. printf 'Building the source release archive\n'
  24. if [ -f "version" ]; then
  25. # _src release archive is being used
  26. version="$(cat version)"
  27. versiondate="$(cat versiondate)"
  28. else
  29. # git repo is being used
  30. version="$(git describe --tags HEAD)"
  31. versiondate="$(git show -s --format=%ct)"
  32. fi
  33. versiondir="release/oldbuildsystem/${version}"
  34. distname="libreboot_${version}_src"
  35. distdir="${versiondir}/${distname}"
  36. printf 'Deleting old source release archives\n'
  37. rm -f "${distdir}.tar.xz"
  38. rm -Rf "${distdir:?}/"
  39. mkdir -p "${distdir}/"
  40. printf 'Copying sources to %s/\n' "${distdir}"
  41. for resource in *; do
  42. if [ "${resource}" = "release" ]; then
  43. continue
  44. fi
  45. cp -R "${resource}" "${distdir}/"
  46. done
  47. # this has to be done before generating
  48. # the "version" file
  49. if [ ! -f "version" ]; then
  50. # generate ChangeLog and NEWS files
  51. rm -f "ChangeLog" "NEWS"
  52. git log > "${distdir}/ChangeLog"
  53. cp "${distdir}/ChangeLog" "${distdir}/NEWS"
  54. else
  55. # building from release archive
  56. cp "ChangeLog" "${distdir}/"
  57. cp "NEWS" "${distdir}/"
  58. fi
  59. if [ -f "RELEASE" ]; then
  60. rm -f "${distdir}/ChangeLog"
  61. rm -f "${distdir}/NEWS"
  62. cp "RELEASE" "${distdir}/ChangeLog"
  63. cp "RELEASE" "${distdir}/NEWS"
  64. fi
  65. # include version information
  66. printf '%s\n' "${version}" >"${distdir}/version"
  67. # include version date information
  68. printf '%s\n' "${versiondate}" >"${distdir}/versiondate"
  69. printf 'Cleaning files in %s/\n' "${distdir}"
  70. # Clean old builds.
  71. (cd "${distdir}/" && ./oldbuild clean all)
  72. printf '\n'
  73. # Delete Git repositories and properties and Subversion administrative
  74. # directories and properties.
  75. rm -Rf "${distdir}/bucts/".git*
  76. rm -Rf "${distdir}/flashrom/".git*
  77. rm -Rf "${distdir}/grub/".git*
  78. rm -Rf "${distdir}/seabios/".git*
  79. rm -f "${distdir}"/*.vim
  80. # Delete useless files.
  81. rm -Rf "${distdir}/TODO/"
  82. rm -f "${distdir}/push"
  83. # Delete the deblob scripts.
  84. # Since the source archive doesn't distribute the download scripts and already
  85. # comes with a deblobbed coreboot, the deblobbing scripts aren't needed at all.
  86. rm -Rf "${distdir}/resources/utilities/coreboot-libre/"
  87. # Download scripts not needed, because the modules already exist
  88. # in the src release archive
  89. rm -f "${distdir}/download"
  90. rm -Rf "${distdir}/resources/scripts/helpers/download/"
  91. rm -Rf "${distdir}/resources/grub/patch/"
  92. rm -Rf "${distdir}/resources/memtest86plus/patch/"
  93. # ich9deblob: There are certain files in there that the user most likely does
  94. # not want to share.
  95. rm -f "${distdir}/resources/utilities/ich9deblob/"*.bin
  96. rm -f "${distdir}/resources/utilities/ich9deblob/"*.rom
  97. rm -f "${distdir}/resources/utilities/ich9deblob/mk"*.[ch]
  98. rm -f "${distdir}/mk"*.[ch]
  99. rm -f "${distdir}/"*.bin
  100. rm -f "${distdir}/"*.rom
  101. # Remove any GRUB payload ELF executables that may exist
  102. rm -f "${distdir}/resources/utilities/grub-assemble/grub_txtmode.elf"
  103. rm -f "${distdir}/resources/utilities/grub-assemble/grub_vesafb.elf"
  104. printf 'Creating %s.tar.xz\n' "${distdir}"
  105. (cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz")
  106. rm -Rf "${distdir:?}/"
  107. printf 'Source release archive is stored in %s/\n' "${versiondir}"