Remove myself from maintainers
[gentoo.git] / sys-apps / memtest86+ / memtest86+-5.01-r4.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit mount-boot eutils toolchain-funcs
7
8 DESCRIPTION="Memory tester based on memtest86"
9 HOMEPAGE="http://www.memtest.org/"
10 SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="-* amd64 x86"
15 IUSE="+boot floppy iso serial"
16
17 BOOTDIR="/boot/memtest86plus"
18 QA_PRESTRIPPED="${BOOTDIR}/memtest /usr/share/${PN}/memtest"
19 QA_FLAGS_IGNORED="${BOOTDIR}/memtest /usr/share/${PN}/memtest"
20
21 RDEPEND="floppy? ( sys-fs/mtools )"
22 DEPEND="iso? ( app-cdr/cdrtools )"
23
24 pkg_pretend() {
25         use boot && mount-boot_pkg_pretend
26 }
27
28 src_prepare() {
29         sed -i -e 's,0x10000,0x100000,' memtest.lds || die
30         epatch "${FILESDIR}/${P}-gcc-473.patch" \
31                    "${FILESDIR}/${P}-hardcoded_cc.patch"
32         epatch "${FILESDIR}"/${P}-no-scp.patch
33         epatch "${FILESDIR}"/${P}-io-extern-inline.patch #548312
34         epatch "${FILESDIR}"/${P}-reboot-def.patch #548312
35         epatch "${FILESDIR}"/${P}-no-clean.patch #557890
36         epatch "${FILESDIR}"/${P}-no-C-headers.patch #592638
37         epatch "${FILESDIR}"/${P}-test-random-cflags.patch #590974
38
39         sed -i 's:genisoimage:mkisofs:' makeiso.sh || die
40         if use serial ; then
41                 sed -i \
42                         -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
43                         config.h \
44                         || die "sed failed"
45         fi
46         default
47 }
48
49 src_configure() {
50         tc-ld-disable-gold #580212
51         tc-export AS CC LD
52 }
53
54 src_compile() {
55         emake
56         if use iso ; then
57                 ./makeiso.sh || die
58         fi
59 }
60
61 src_test() { :; }
62
63 src_install() {
64         if use boot; then
65                 insinto "${BOOTDIR}"
66                 doins memtest memtest.bin
67         fi
68
69         insinto /usr/share/${PN}
70         use iso && newins mt*.iso memtest.iso
71         doins memtest memtest.bin
72
73         exeinto /etc/grub.d
74         newexe "${FILESDIR}"/39_${PN}-r1 39_${PN}
75
76         dodoc README README.build-process FAQ changelog
77
78         if use floppy ; then
79                 dobin "${FILESDIR}"/make-memtest86+-boot-floppy
80                 doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
81         fi
82 }
83
84 pkg_preinst() {
85         use boot && mount-boot_pkg_preinst
86 }
87
88 pkg_postinst() {
89         if use boot; then
90                 mount-boot_pkg_postinst
91
92                 elog "memtest86+ has been installed in ${BOOTDIR}/"
93                 elog "You may wish to update your bootloader configs by adding these lines:"
94                 elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
95                 elog "   as /etc/grub.d/39_${PN}"
96                 elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
97                 elog "    > title=${PN}"
98                 elog "    > root (hd?,?)"
99                 elog "    > kernel ${BOOTDIR}/memtest.bin"
100                 elog " - For lilo:"
101                 elog "    > image  = ${BOOTDIR}/memtest.bin"
102                 elog "    > label  = ${PN}"
103                 elog ""
104                 elog "Note: For older configs, you might have to change from 'memtest' to 'memtest.bin'."
105         fi
106 }
107
108 pkg_prerm() {
109         use boot && mount-boot_pkg_prerm
110 }
111
112 pkg_postrm() {
113         use boot && mount-boot_pkg_postrm
114 }