Diff refind-0.14.0.2 with a refind-0.14.0.2-r1

/usr/portage/sys-boot/refind/refind-0.14.0.2-r1.ebuild 2023-10-09 14:52:35.448368500 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
inherit toolchain-funcs secureboot
6
inherit optfeature secureboot toolchain-funcs
7 7

  
8 8
DESCRIPTION="The UEFI Boot Manager by Rod Smith"
9 9
HOMEPAGE="https://www.rodsbooks.com/refind/"
......
13 13
SLOT="0"
14 14
KEYWORDS="~amd64 ~x86"
15 15
FS_USE="btrfs +ext2 +ext4 hfs +iso9660 ntfs reiserfs"
16
IUSE="${FS_USE} custom-cflags doc"
16
IUSE="${FS_USE} doc"
17 17

  
18 18
DEPEND="sys-boot/gnu-efi"
19 19

  
20
DOCS=( README.txt )
20
# for ld.bfd and objcopy
21
BDEPEND="sys-devel/binutils"
21 22

  
22
pkg_pretend() {
23
	if use custom-cflags; then
24
		ewarn
25
		ewarn "You have enabled building with USE=custom-cflags. Be aware that"
26
		ewarn "using this can result in EFI binaries that fail to run and may"
27
		ewarn "fail to build at all. This is strongly advised against by upstream."
28
		ewarn
29
		ewarn "See https://bugs.gentoo.org/598587#c3 for more information"
30
		ewarn
23
DOCS=( README.txt NEWS.txt )
24

  
25
PATCHES=( "${FILESDIR}"/${P}-clang.patch )
26

  
27
checktools() {
28
	if [[ ${MERGE_TYPE} != "binary" ]]; then
29
		# bug #832018
30
		tc-export LD
31
		tc-ld-force-bfd
32
		# the makefile calls LD directly, so try to fix LD too
33
		LD="${LD/.lld/.bfd}"
34
		tc-ld-is-lld "${LD}" && die "Linking with lld produces broken executables and may lead to unbootable system"
35

  
36
		# bug #732256
37
		# llvm-objcopy does not support EFI target, try to use binutils objcopy or fail
38
		tc-export OBJCOPY
39
		OBJCOPY="${OBJCOPY/llvm-/}"
40
		LANG=C LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' || die "${OBJCOPY} (objcopy) does not support EFI target"
31 41
	fi
32 42
}
33 43

  
44
pkg_pretend() {
45
	checktools
46
}
47

  
34 48
pkg_setup() {
35 49
	if use x86; then
36 50
		export EFIARCH=ia32
......
40 54
		export BUILDARCH=x86_64
41 55
	fi
42 56
	secureboot_pkg_setup
57

  
58
	# this does not only check, but also exports LD and OBJCOPY
59
	checktools
43 60
}
44 61

  
45 62
src_prepare() {
46 63
	default
47 64

  
48
	# bug 598647 - PIE not supported
65
	# bug #598647 - PIE not supported
49 66
	sed -e '/^CFLAGS/s/$/ -fno-PIE/' -i Make.common || die
50 67
	sed -e '1 i\.NOTPARALLEL:' -i filesystems/Makefile || die
51 68

  
69
	# bug #881131, bug #832018
70
	sed -e 's/-fno-tree-loop-distribute-patterns/-ffreestanding/' -i Make.common || die
71

  
52 72
	cp "${FILESDIR}"/refind-sbat-gentoo-${PV}.csv refind-sbat-gentoo.csv || die
53 73
}
54 74

  
......
58 78
	for fs in ${FS_USE}; do
59 79
		fs=${fs#+}
60 80
		if use "${fs}"; then
61
			fs_names+=(${fs})
81
			fs_names+=( ${fs} )
62 82
		fi
63 83
	done
64
	fs_names=("${fs_names[@]/%/_gnuefi}")
84
	fs_names=( "${fs_names[@]/%/_gnuefi}" )
65 85

  
66 86
	# Prepare flags
67 87
	local make_flags=(
68 88
		ARCH="${BUILDARCH}"
69 89
		CC="$(tc-getCC)"
70 90
		AS="$(tc-getAS)"
71
		LD="$(tc-getLD)"
91
		LD="${LD}"
72 92
		AR="$(tc-getAR)"
73 93
		RANLIB="$(tc-getRANLIB)"
74
		OBJCOPY="$(tc-getOBJCOPY)"
75
		GNUEFILIB="/usr/$(get_libdir)"
76
		EFILIB="/usr/$(get_libdir)"
77
		EFICRT0="/usr/$(get_libdir)"
94
		OBJCOPY="${OBJCOPY}"
95
		GNUEFILIB="${ESYSROOT}/usr/$(get_libdir)"
96
		EFILIB="${ESYSROOT}/usr/$(get_libdir)"
97
		EFICRT0="${ESYSROOT}/usr/$(get_libdir)"
78 98
		FILESYSTEMS="${fs_names[*]}"
79 99
		FILESYSTEMS_GNUEFI="${fs_names[*]}"
80 100
		REFIND_SBAT_CSV=refind-sbat-gentoo.csv
81 101
	)
82
	if use custom-cflags; then
83
		make_flags=(CFLAGS="${CFLAGS} -fno-tree-loop-distribute-patterns" "${make_flags[@]}")
84
	fi
85 102

  
86 103
	emake "${make_flags[@]}" all_gnuefi
87 104
}
......
89 106
src_install() {
90 107
	exeinto "/usr/$(get_libdir)/${PN}"
91 108
	doexe refind-install
92
	dosym "../$(get_libdir)/${PN}/refind-install" "/usr/sbin/refind-install"
109
	dosym -r "/usr/$(get_libdir)/${PN}/refind-install" "/usr/sbin/refind-install"
93 110

  
94
	if use doc; then
95
		doman "docs/man/"*
96
		DOCS+=(NEWS.txt docs/refind docs/Styles)
97
	fi
111
	doman "docs/man/"*
112
	use doc && DOCS+=( docs/refind docs/Styles )
98 113
	einstalldocs
99 114

  
100 115
	insinto "/usr/$(get_libdir)/${PN}/refind"
......
123 138
	elog "rEFInd has been built and installed into ${EROOT}/usr/$(get_libdir)/${PN}"
124 139
	elog "You will need to use the command 'refind-install' to install"
125 140
	elog "the binaries into your EFI System Partition"
141

  
142
	optfeature_header "refind-install requires additional packages to be fully functional:"
143
	optfeature "binary signing for use with SecureBoot" app-crypt/sbsigntools
144
	optfeature "writing to NVRAM" sys-boot/efibootmgr
145
	optfeature "ESP management" sys-apps/gptfdisk
126 146
	elog ""
127
	elog "refind-install requires additional packages to be fully functional:"
128
	elog " app-crypt/sbsigntools for binary signing for use with SecureBoot"
129
	elog " sys-boot/efibootmgr for writing to NVRAM"
130
	elog " sys-apps/gptfdisk for ESP management"
131
	elog ""
132
	elog "refind-mkdefault requires >=dev-lang/python-3"
133
	elog ""
147

  
134 148
	if [[ -z "${REPLACING_VERSIONS}" ]]; then
135 149
		elog "A sample configuration can be found at"
136 150
		elog "${EROOT}/usr/$(get_libdir)/${PN}/refind/refind.conf-sample"
Thank you!