syslinux-6.04_pre3-r1.ebuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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
  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="458a54133ecdf1685c02294d812cb562fe7bf4c3"
  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}"/acpi_off.patch
  33. "${FILESDIR}"/0002-gfxboot-menu-label.patch
  34. #"${FILESDIR}"/0003-memdisk-Force-ld-output-format-to-32-bits.patch
  35. "${FILESDIR}"/0004-gnu-efi-from-arch.patch
  36. "${FILESDIR}"/0005-gnu-efi-version-compatibility.patch
  37. "${FILESDIR}"/0015-efi-main.c-include-efisetjmp.h.patch
  38. "${FILESDIR}"/0017-Replace-builtin-strlen-that-appears-to-get-optimized.patch
  39. "${FILESDIR}"/0016-strip-gnu-property.patch
  40. "${FILESDIR}"/0017-single-load-segment.patch
  41. "${FILESDIR}"/0018-prevent-pow-optimization.patch
  42. #"${FILESDIR}"/0025-reproducible-build.patch
  43. #"${FILESDIR}"/0006-The-VPrint-definition-is-now-part-of-the-exports-of-.patch
  44. #"${FILESDIR}"/0007-Update-the-longjump-calls-to-fit-the-new-declaration.patch
  45. "${FILESDIR}"/syslinux-6.04_pre1-fcommon.patch #705730
  46. "${FILESDIR}"/syslinux-6.04_pre3-debug.c-fix-printf-include.patch
  47. )
  48. src_prepare() {
  49. default
  50. rm -f gethostip #bug 137081
  51. # Don't prestrip or override user LDFLAGS, bug #305783
  52. local SYSLINUX_MAKEFILES="extlinux/Makefile linux/Makefile mtools/Makefile \
  53. sample/Makefile utils/Makefile"
  54. sed -i ${SYSLINUX_MAKEFILES} -e '/^LDFLAGS/d' || die "sed failed"
  55. sed -i mk/efi.mk mk/syslinux.mk -e "/^LIBDIR/s|\/lib|\/$(get_libdir)|g" || die "sed failed"
  56. # disable debug and development flags to reduce bootloader size
  57. truncate --size 0 mk/devel.mk
  58. append-ldflags "--no-dynamic-linker"
  59. append-cflags "-fno-PIE"
  60. if use custom-cflags; then
  61. sed -i ${SYSLINUX_MAKEFILES} \
  62. -e 's|-g -Os||g' \
  63. -e 's|-Os||g' \
  64. -e 's|CFLAGS[[:space:]]\+=|CFLAGS +=|g' \
  65. || die "sed custom-cflags failed"
  66. else
  67. QA_FLAGS_IGNORED="
  68. /sbin/extlinux
  69. /usr/bin/memdiskfind
  70. /usr/bin/gethostip
  71. /usr/bin/isohybrid
  72. /usr/bin/syslinux
  73. "
  74. fi
  75. case ${ARCH} in
  76. amd64) loaderarch="efi64" ;;
  77. x86) loaderarch="efi32" ;;
  78. *) ewarn "Unsupported architecture, building installers only." ;;
  79. esac
  80. # building with ld.gold causes problems, bug #563364
  81. if tc-ld-is-gold; then
  82. ewarn "Building syslinux with the gold linker may cause problems, see bug #563364"
  83. if [[ -z "${I_KNOW_WHAT_I_AM_DOING}" ]]; then
  84. tc-ld-disable-gold
  85. ewarn "set I_KNOW_WHAT_I_AM_DOING=1 to override this."
  86. else
  87. ewarn "Continuing anyway as requested."
  88. fi
  89. fi
  90. tc-export AR CC LD OBJCOPY RANLIB
  91. }
  92. _emake() {
  93. emake \
  94. AR="${AR}" \
  95. CC="${CC}" \
  96. LD="${LD}" \
  97. OBJCOPY="${OBJCOPY}" \
  98. RANLIB="${RANLIB}" \
  99. "$@"
  100. }
  101. src_compile() {
  102. # build system abuses the LDFLAGS variable to pass arguments to ld
  103. unset LDFLAGS
  104. _emake spotless
  105. if [[ ! -z ${loaderarch} ]]; then
  106. _emake ${loaderarch}
  107. fi
  108. _emake bios
  109. _emake installer
  110. }
  111. src_install() {
  112. # parallel install fails sometimes
  113. einfo "loaderarch=${loaderarch}"
  114. _emake -j1 INSTALLROOT="${D}" MANDIR=/usr/share/man bios ${loaderarch} install
  115. dodoc README NEWS doc/*.txt
  116. }