syslinux-6.04_pre1-r5.ebuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Copyright 1999-2023 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit git-r3 toolchain-funcs flag-o-matic
  5. DESCRIPTION="SYSLINUX, PXELINUX, ISOLINUX, EXTLINUX and MEMDISK bootloaders"
  6. HOMEPAGE="https://www.syslinux.org/"
  7. EGIT_REPO_URI="https://repo.or.cz/syslinux"
  8. EGIT_COMMIT="bd91041bff259cf4303fa6bbb0b6bce33fa7c1e8"
  9. EGIT_SUBMODULES=()
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="-* amd64 x86"
  13. IUSE="custom-cflags abi_x86_32 abi_x86_64 +bios +efi"
  14. REQUIRED_USE="|| ( bios efi )
  15. efi? ( || ( abi_x86_32 abi_x86_64 ) )"
  16. BDEPEND="
  17. dev-lang/perl
  18. bios? ( dev-lang/nasm )
  19. efi? ( >=sys-boot/gnu-efi-3.0u )
  20. app-arch/upx
  21. "
  22. RDEPEND="
  23. sys-apps/util-linux
  24. sys-fs/mtools
  25. dev-perl/Crypt-PasswdMD5
  26. dev-perl/Digest-SHA1
  27. "
  28. DEPEND="${RDEPEND}
  29. virtual/os-headers
  30. "
  31. QA_PREBUILT="usr/share/${PN}/*.c32"
  32. QA_EXECSTACK="usr/share/syslinux/*"
  33. QA_WX_LOAD="usr/share/syslinux/*"
  34. QA_PRESTRIPPED="usr/share/syslinux/.*"
  35. QA_FLAGS_IGNORED=".*"
  36. PATCHES=(
  37. #"${FILESDIR}"/syslinux-6.04_pre1-acpi_off.patch
  38. "${FILESDIR}"/syslinux-6.03-sysmacros.patch
  39. "${FILESDIR}"/0002-gfxboot-menu-label.patch
  40. "${FILESDIR}"/0003-memdisk-Force-ld-output-format-to-32-bits.patch
  41. "${FILESDIR}"/0004-gnu-efi-from-arch.patch
  42. "${FILESDIR}"/0004-Inherit-toolchain-vars-from-environment.patch
  43. "${FILESDIR}"/0005-gnu-efi-version-compatibility.patch
  44. "${FILESDIR}"/0015-efi-main.c-include-efisetjmp.h.patch
  45. "${FILESDIR}"/0017-Replace-builtin-strlen-that-appears-to-get-optimized.patch
  46. "${FILESDIR}"/0016-strip-gnu-property.patch
  47. "${FILESDIR}"/0017-single-load-segment.patch
  48. "${FILESDIR}"/0018-prevent-pow-optimization.patch
  49. #"${FILESDIR}"/0025-reproducible-build.patch
  50. "${FILESDIR}"/0006-The-VPrint-definition-is-now-part-of-the-exports-of-.patch
  51. "${FILESDIR}"/0007-Update-the-longjump-calls-to-fit-the-new-declaration.patch
  52. "${FILESDIR}"/syslinux-6.04_pre1-fcommon.patch #705730
  53. "${FILESDIR}"/syslinux-6.04_pre3-debug.c-fix-printf-include.patch
  54. )
  55. src_prepare() {
  56. default
  57. rm -f gethostip #bug 137081
  58. # Don't prestrip or override user LDFLAGS, bug #305783
  59. local SYSLINUX_MAKEFILES="extlinux/Makefile linux/Makefile mtools/Makefile \
  60. sample/Makefile utils/Makefile"
  61. sed -i ${SYSLINUX_MAKEFILES} -e '/^LDFLAGS/d' || die "sed failed"
  62. sed -i mk/efi.mk mk/syslinux.mk -e "/^LIBDIR/s|\/lib|\/$(get_libdir)|g" || die "sed failed"
  63. # disable debug and development flags to reduce bootloader size
  64. truncate --size 0 mk/devel.mk
  65. append-ldflags "--no-dynamic-linker"
  66. append-cflags "-fno-PIE"
  67. if use custom-cflags; then
  68. sed -i ${SYSLINUX_MAKEFILES} \
  69. -e 's|-g -Os||g' \
  70. -e 's|-Os||g' \
  71. -e 's|CFLAGS[[:space:]]\+=|CFLAGS +=|g' \
  72. || die "sed custom-cflags failed"
  73. fi
  74. # building with ld.gold causes problems, bug #563364
  75. if tc-ld-is-gold; then
  76. ewarn "Building syslinux with the gold linker may cause problems, see bug #563364"
  77. if [[ -z "${I_KNOW_WHAT_I_AM_DOING}" ]]; then
  78. tc-ld-disable-gold
  79. ewarn "set I_KNOW_WHAT_I_AM_DOING=1 to override this."
  80. else
  81. ewarn "Continuing anyway as requested."
  82. fi
  83. fi
  84. }
  85. src_compile() {
  86. filter-lto #863722
  87. local DATE=$(date -u -r NEWS +%Y%m%d)
  88. local HEXDATE=$(printf '0x%08x' "${DATE}")
  89. tc-export AR CC LD OBJCOPY RANLIB
  90. unset CFLAGS LDFLAGS
  91. if use bios; then
  92. emake bios DATE="${DATE}" HEXDATE="${HEXDATE}"
  93. fi
  94. if use efi; then
  95. if use abi_x86_32; then
  96. emake efi32 DATE="${DATE}" HEXDATE="${HEXDATE}"
  97. fi
  98. if use abi_x86_64; then
  99. emake efi64 DATE="${DATE}" HEXDATE="${HEXDATE}"
  100. fi
  101. fi
  102. }
  103. src_install() {
  104. local firmware=( $(usev bios) )
  105. if use efi; then
  106. use abi_x86_32 && firmware+=( efi32 )
  107. use abi_x86_64 && firmware+=( efi64 )
  108. fi
  109. local args=(
  110. INSTALLROOT="${ED}"
  111. MANDIR='$(DATADIR)/man'
  112. "${firmware[@]}"
  113. install
  114. )
  115. emake -j1 "${args[@]}"
  116. if use bios; then
  117. mv "${ED}"/usr/bin/keytab-{lilo,syslinux} || die
  118. fi
  119. einstalldocs
  120. dostrip -x /usr/share/syslinux
  121. }