syslinux-9999.ebuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 flag-o-matic toolchain-funcs
  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="05ac953c23f90b2328d393f7eecde96e41aed067"
  9. EGIT_SUBMODULES=()
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS=""
  13. IUSE="custom-cflags"
  14. RDEPEND="
  15. sys-apps/util-linux
  16. sys-fs/mtools
  17. dev-perl/Crypt-PasswdMD5
  18. dev-perl/Digest-SHA1"
  19. DEPEND="${RDEPEND}
  20. dev-lang/nasm
  21. app-arch/upx
  22. >=sys-boot/gnu-efi-3.0u
  23. virtual/os-headers"
  24. # This ebuild is a departure from the old way of rebuilding everything in syslinux
  25. # This departure is necessary since hpa doesn't support the rebuilding of anything other
  26. # than the installers.
  27. # These are executables which come precompiled and are run by the boot loader
  28. QA_PREBUILT="usr/share/${PN}/*.c32"
  29. QA_PRESTRIPPED="usr/share/syslinux/efi64/ldlinux.e64"
  30. # removed all the unpack/patching stuff since we aren't rebuilding the core stuff anymore
  31. PATCHES=(
  32. "${FILESDIR}"/0001-fix-gcc-13-build.patch
  33. "${FILESDIR}"/0002-gfxboot-menu-label.patch
  34. "${FILESDIR}"/0004-gnu-efi-from-arch.patch
  35. "${FILESDIR}"/0005-gnu-efi-version-compatibility.patch
  36. "${FILESDIR}"/0015-efi-main.c-include-efisetjmp.h.patch
  37. "${FILESDIR}"/0017-Replace-builtin-strlen-that-appears-to-get-optimized.patch
  38. "${FILESDIR}"/0016-strip-gnu-property.patch
  39. "${FILESDIR}"/0017-single-load-segment.patch
  40. "${FILESDIR}"/0018-prevent-pow-optimization.patch
  41. #"${FILESDIR}"/0025-reproducible-build.patch
  42. "${FILESDIR}"/syslinux-6.04_pre1-fcommon.patch #705730
  43. "${FILESDIR}"/acpi_off.patch
  44. )
  45. src_prepare() {
  46. default
  47. rm -f gethostip #bug 137081
  48. # Don't prestrip or override user LDFLAGS, bug #305783
  49. local SYSLINUX_MAKEFILES="extlinux/Makefile linux/Makefile mtools/Makefile \
  50. sample/Makefile utils/Makefile"
  51. sed -i ${SYSLINUX_MAKEFILES} -e '/^LDFLAGS/d' || die "sed failed"
  52. sed -i mk/efi.mk mk/syslinux.mk -e "/^LIBDIR/s|\/lib|\/$(get_libdir)|g" || die "sed failed"
  53. # disable debug and development flags to reduce bootloader size
  54. truncate --size 0 mk/devel.mk
  55. append-ldflags "--no-dynamic-linker"
  56. append-cflags "-fno-PIE"
  57. if use custom-cflags; then
  58. sed -i ${SYSLINUX_MAKEFILES} \
  59. -e 's|-g -Os||g' \
  60. -e 's|-Os||g' \
  61. -e 's|CFLAGS[[:space:]]\+=|CFLAGS +=|g' \
  62. || die "sed custom-cflags failed"
  63. else
  64. QA_FLAGS_IGNORED="
  65. /sbin/extlinux
  66. /usr/bin/memdiskfind
  67. /usr/bin/gethostip
  68. /usr/bin/isohybrid
  69. /usr/bin/syslinux
  70. "
  71. fi
  72. case ${ARCH} in
  73. amd64) loaderarch="efi64" ;;
  74. x86) loaderarch="efi32" ;;
  75. *) ewarn "Unsupported architecture, building installers only." ;;
  76. esac
  77. # building with ld.gold causes problems, bug #563364
  78. if tc-ld-is-gold; then
  79. ewarn "Building syslinux with the gold linker may cause problems, see bug #563364"
  80. if [[ -z "${I_KNOW_WHAT_I_AM_DOING}" ]]; then
  81. tc-ld-disable-gold
  82. ewarn "set I_KNOW_WHAT_I_AM_DOING=1 to override this."
  83. else
  84. ewarn "Continuing anyway as requested."
  85. fi
  86. fi
  87. tc-export AR CC LD OBJCOPY RANLIB
  88. }
  89. _emake() {
  90. emake \
  91. AR="${AR}" \
  92. CC="${CC}" \
  93. LD="${LD}" \
  94. OBJCOPY="${OBJCOPY}" \
  95. RANLIB="${RANLIB}" \
  96. "$@"
  97. }
  98. src_compile() {
  99. # build system abuses the LDFLAGS variable to pass arguments to ld
  100. unset LDFLAGS
  101. _emake spotless
  102. if [[ ! -z ${loaderarch} ]]; then
  103. _emake ${loaderarch}
  104. fi
  105. _emake bios
  106. _emake installer
  107. }
  108. src_install() {
  109. # parallel install fails sometimes
  110. einfo "loaderarch=${loaderarch}"
  111. _emake -j1 INSTALLROOT="${D}" MANDIR=/usr/share/man bios ${loaderarch} install
  112. dodoc README NEWS doc/*.txt
  113. }