Gentoo Archives: gentoo-commits

From: Ben Kohler <bkohler@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/memtest86+/, sys-apps/memtest86+/files/
Date: Thu, 16 Sep 2021 14:56:22
Message-Id: 1631804168.40197d77e025829d1bbfc3bb97cc3a327b81e7f3.bkohler@gentoo
1 commit: 40197d77e025829d1bbfc3bb97cc3a327b81e7f3
2 Author: Ben Kohler <bkohler <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 16 14:33:55 2021 +0000
4 Commit: Ben Kohler <bkohler <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 16 14:56:08 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40197d77
7
8 sys-apps/memtest86+: runtime fix for >=gcc-8
9
10 Bug: https://bugs.gentoo.org/675270
11
12 Package-Manager: Portage-3.0.23, Repoman-3.0.3
13 Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>
14
15 .../memtest86+-5.31b-fix-gcc8-freeze-crash.patch | 12 +++
16 sys-apps/memtest86+/memtest86+-5.31b-r1.ebuild | 114 +++++++++++++++++++++
17 2 files changed, 126 insertions(+)
18
19 diff --git a/sys-apps/memtest86+/files/memtest86+-5.31b-fix-gcc8-freeze-crash.patch b/sys-apps/memtest86+/files/memtest86+-5.31b-fix-gcc8-freeze-crash.patch
20 new file mode 100644
21 index 00000000000..44d11b76b34
22 --- /dev/null
23 +++ b/sys-apps/memtest86+/files/memtest86+-5.31b-fix-gcc8-freeze-crash.patch
24 @@ -0,0 +1,12 @@
25 +diff -ur memtest86+-5.31b/Makefile memtest86+-5.31b.new/Makefile
26 +--- memtest86+-5.31b/Makefile 2021-09-16 09:27:24.401570971 -0500
27 ++++ memtest86+-5.31b.new/Makefile 2021-09-16 09:30:24.332704245 -0500
28 +@@ -64,6 +64,9 @@
29 + memsize.o: memsize.c
30 + $(CC) -Wall -Werror -march=i486 -m32 -O0 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector -c -o memsize.o memsize.c
31 +
32 ++test.o: test.c
33 ++test.o: CFLAGS += -fno-strict-overflow
34 ++
35 + random.o: random.c
36 + random.o: CFLAGS += -O3 -fno-PIC
37 \ No newline at end of file
38
39 diff --git a/sys-apps/memtest86+/memtest86+-5.31b-r1.ebuild b/sys-apps/memtest86+/memtest86+-5.31b-r1.ebuild
40 new file mode 100644
41 index 00000000000..b56de8634e5
42 --- /dev/null
43 +++ b/sys-apps/memtest86+/memtest86+-5.31b-r1.ebuild
44 @@ -0,0 +1,114 @@
45 +# Copyright 1999-2021 Gentoo Authors
46 +# Distributed under the terms of the GNU General Public License v2
47 +
48 +EAPI=7
49 +
50 +inherit mount-boot toolchain-funcs
51 +
52 +DESCRIPTION="Memory tester based on memtest86"
53 +HOMEPAGE="http://www.memtest.org/"
54 +SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
55 +
56 +LICENSE="GPL-2"
57 +SLOT="0"
58 +KEYWORDS="-* ~amd64 ~x86"
59 +IUSE="+boot floppy iso serial"
60 +
61 +BOOTDIR="/boot/memtest86plus"
62 +QA_PRESTRIPPED="${BOOTDIR#/}/memtest usr/share/${PN}/memtest"
63 +QA_FLAGS_IGNORED="${BOOTDIR#/}/memtest usr/share/${PN}/memtest"
64 +
65 +RDEPEND="floppy? ( sys-fs/mtools )"
66 +DEPEND="${RDEPEND}"
67 +BDEPEND="iso? ( app-cdr/cdrtools )"
68 +
69 +PATCHES=(
70 + "${FILESDIR}/${P}-gcc-473.patch"
71 + "${FILESDIR}/${P}-hardcoded_cc.patch"
72 + "${FILESDIR}/${P}-no-clean.patch" #557890
73 + "${FILESDIR}/${P}-objcopy.patch"
74 + "${FILESDIR}/${P}-test-random-cflags.patch" #590974
75 + "${FILESDIR}/${P}-fix-gcc8-freeze-crash.patch"
76 +)
77 +
78 +pkg_pretend() {
79 + use boot && mount-boot_pkg_pretend
80 +}
81 +
82 +src_prepare() {
83 + sed -i -e 's,0x10000,0x100000,' memtest.lds || die
84 + sed -i 's:genisoimage:mkisofs:' makeiso.sh || die
85 +
86 + if use serial ; then
87 + sed -i -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
88 + config.h || die "sed failed"
89 + fi
90 + default
91 +}
92 +
93 +src_configure() {
94 + tc-ld-disable-gold #580212
95 + tc-export AS CC LD
96 +}
97 +
98 +src_compile() {
99 + emake OBJCOPY="$(tc-getOBJCOPY)"
100 + if use iso ; then
101 + ./makeiso.sh || die
102 + fi
103 +}
104 +
105 +src_test() { :; }
106 +
107 +src_install() {
108 + if use boot ; then
109 + insinto "${BOOTDIR}"
110 + doins memtest memtest.bin
111 + fi
112 +
113 + insinto /usr/share/${PN}
114 + use iso && newins mt*.iso memtest.iso
115 + doins memtest memtest.bin
116 +
117 + exeinto /etc/grub.d
118 + newexe "${FILESDIR}"/39_${PN}-r1 39_${PN}
119 +
120 + dodoc README README.build-process FAQ changelog
121 +
122 + if use floppy ; then
123 + dobin "${FILESDIR}"/make-memtest86+-boot-floppy
124 + doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
125 + fi
126 +}
127 +
128 +pkg_preinst() {
129 + use boot && mount-boot_pkg_preinst
130 +}
131 +
132 +pkg_postinst() {
133 + if use boot; then
134 + mount-boot_pkg_postinst
135 +
136 + elog "memtest86+ has been installed in ${BOOTDIR}/"
137 + elog "You may wish to update your bootloader configs by adding these lines:"
138 + elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
139 + elog " as /etc/grub.d/39_${PN}"
140 + elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
141 + elog " > title=${PN}"
142 + elog " > root (hd?,?)"
143 + elog " > kernel ${BOOTDIR}/memtest.bin"
144 + elog " - For lilo:"
145 + elog " > image = ${BOOTDIR}/memtest.bin"
146 + elog " > label = ${PN}"
147 + elog ""
148 + elog "Note: For older configs, you might have to change from 'memtest' to 'memtest.bin'."
149 + fi
150 +}
151 +
152 +pkg_prerm() {
153 + use boot && mount-boot_pkg_prerm
154 +}
155 +
156 +pkg_postrm() {
157 + use boot && mount-boot_pkg_postrm
158 +}