Gentoo Archives: gentoo-commits

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/svgalib/files/, media-libs/svgalib/
Date: Sat, 02 May 2020 09:20:46
Message-Id: 1588411228.89c4396610b1a9b0652bed90102d4014b0e5b4f0.bircoph@gentoo
1 commit: 89c4396610b1a9b0652bed90102d4014b0e5b4f0
2 Author: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 2 09:14:45 2020 +0000
4 Commit: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
5 CommitDate: Sat May 2 09:20:28 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89c43966
7
8 media-libs/svgalib: fix build with recent kernels and more
9
10 - Fix build with recent kernels by migrating from SUBDIRS to M.
11 - Bump to EAPI 7.
12 - Disable package-side man page compression.
13 - Fix buffer overflow in wrapdemo.c.
14 - Clean up ebuild and fix spec QA issues.
15 - Rebase patches with fuzz.
16
17 Package-Manager: Portage-2.3.82, Repoman-2.3.20
18 Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>
19
20 .../svgalib/files/svgalib-1.9.25-linux_2.6.patch | 2 +-
21 .../svgalib/files/svgalib-1.9.25-linux_3.4.patch | 58 +++++-----
22 .../svgalib/files/svgalib-1.9.25-linux_3.9.patch | 11 +-
23 .../files/svgalib-1.9.25-no-man-compression.patch | 26 +++++
24 .../svgalib-1.9.25-wrapdemo-buf-overflow.patch | 14 +++
25 media-libs/svgalib/svgalib-1.9.25-r6.ebuild | 124 +++++++++++++++++++++
26 6 files changed, 200 insertions(+), 35 deletions(-)
27
28 diff --git a/media-libs/svgalib/files/svgalib-1.9.25-linux_2.6.patch b/media-libs/svgalib/files/svgalib-1.9.25-linux_2.6.patch
29 index 20ab1fe1ed1..113a2391cdf 100644
30 --- a/media-libs/svgalib/files/svgalib-1.9.25-linux_2.6.patch
31 +++ b/media-libs/svgalib/files/svgalib-1.9.25-linux_2.6.patch
32 @@ -22,7 +22,7 @@
33 +++ svgalib/kernel/svgalib_helper/Makefile.alt
34 @@ -37,7 +37,7 @@
35 CFLAGS += -DSVGALIB_HELPER_MAJOR=$(SVGALIB_HELPER_MAJOR)
36 -
37 +
38 ifeq (1,$(findstring 1,$(MODVER)))
39 - CFLAGS += -DMODVERSIONS -include $(INCLUDEDIR)/linux/modversions.h
40 + CFLAGS += -DMODVERSIONS -DCONFIG_MODVERSIONS=1
41
42 diff --git a/media-libs/svgalib/files/svgalib-1.9.25-linux_3.4.patch b/media-libs/svgalib/files/svgalib-1.9.25-linux_3.4.patch
43 index 5e2d1e527cb..ce9c74ccd20 100644
44 --- a/media-libs/svgalib/files/svgalib-1.9.25-linux_3.4.patch
45 +++ b/media-libs/svgalib/files/svgalib-1.9.25-linux_3.4.patch
46 @@ -1,29 +1,29 @@
47 -diff -Naur svgalib-1.9.25/kernel/svgalib_helper/main.c svgalib-1.9.25_new/kernel/svgalib_helper/main.c
48 ---- svgalib-1.9.25/kernel/svgalib_helper/main.c 2006-01-12 18:17:53.000000000 +0000
49 -+++ svgalib-1.9.25_new/kernel/svgalib_helper/main.c 2012-06-25 15:02:11.000000000 +0100
50 -@@ -33,7 +33,9 @@
51 -
52 - #include <asm/processor.h>
53 - #include <asm/uaccess.h>
54 --#include <asm/system.h> /* cli(), *_flags */
55 -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
56 -+ #include <asm/system.h> /* cli(), *_flags */
57 -+#endif
58 - #include <asm/segment.h> /* memcpy and such */
59 - #include <asm/io.h>
60 - #include <asm/pgtable.h>
61 -diff -Naur svgalib-1.9.25/kernel/svgalib_helper/Makefile svgalib-1.9.25_new/kernel/svgalib_helper/Makefile
62 ---- svgalib-1.9.25/kernel/svgalib_helper/Makefile 2006-05-20 13:31:04.000000000 +0100
63 -+++ svgalib-1.9.25_new/kernel/svgalib_helper/Makefile 2012-06-25 13:39:38.000000000 +0100
64 -@@ -11,9 +11,11 @@
65 - PWD := $(shell pwd)
66 - TARGET := svgalib_helper
67 -
68 -+ ifneq ($(TOPDIR),)
69 - ifeq ($(PATCHLEVEL),4)
70 - include $(TOPDIR)/Rules.make
71 - endif
72 -+ endif
73 -
74 - else
75 -
76 \ No newline at end of file
77 +diff '--color=auto' -Naurd svgalib-1.9.25.prev/kernel/svgalib_helper/Makefile svgalib-1.9.25/kernel/svgalib_helper/Makefile
78 +--- svgalib-1.9.25.prev/kernel/svgalib_helper/Makefile 2020-05-02 09:49:05.072052128 +0300
79 ++++ svgalib-1.9.25/kernel/svgalib_helper/Makefile 2020-05-02 09:50:14.748043187 +0300
80 +@@ -11,9 +11,11 @@
81 + PWD := $(shell pwd)
82 + TARGET := svgalib_helper
83 +
84 ++ ifneq ($(TOPDIR),)
85 + ifeq ($(PATCHLEVEL),4)
86 + include $(TOPDIR)/Rules.make
87 + endif
88 ++ endif
89 +
90 + else
91 +
92 +diff '--color=auto' -Naurd svgalib-1.9.25.prev/kernel/svgalib_helper/main.c svgalib-1.9.25/kernel/svgalib_helper/main.c
93 +--- svgalib-1.9.25.prev/kernel/svgalib_helper/main.c 2020-05-02 09:49:05.075052085 +0300
94 ++++ svgalib-1.9.25/kernel/svgalib_helper/main.c 2020-05-02 09:50:14.751043144 +0300
95 +@@ -38,7 +38,9 @@
96 +
97 + #include <asm/processor.h>
98 + #include <asm/uaccess.h>
99 +-#include <asm/system.h> /* cli(), *_flags */
100 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
101 ++ #include <asm/system.h> /* cli(), *_flags */
102 ++#endif
103 + #include <asm/segment.h> /* memcpy and such */
104 + #include <asm/io.h>
105 + #include <asm/pgtable.h>
106
107 diff --git a/media-libs/svgalib/files/svgalib-1.9.25-linux_3.9.patch b/media-libs/svgalib/files/svgalib-1.9.25-linux_3.9.patch
108 index be10e394707..2e1f87d7c6f 100644
109 --- a/media-libs/svgalib/files/svgalib-1.9.25-linux_3.9.patch
110 +++ b/media-libs/svgalib/files/svgalib-1.9.25-linux_3.9.patch
111 @@ -1,8 +1,9 @@
112 ---- svgalib-1.9.25/kernel/svgalib_helper/main.c.orig 2016-02-22 11:10:25.000000000 +0300
113 -+++ svgalib-1.9.25/kernel/svgalib_helper/main.c 2016-02-22 11:17:16.223529679 +0300
114 -@@ -170,8 +170,12 @@
115 +diff '--color=auto' -Naurd svgalib-1.9.25.prev/kernel/svgalib_helper/main.c svgalib-1.9.25/kernel/svgalib_helper/main.c
116 +--- svgalib-1.9.25.prev/kernel/svgalib_helper/main.c 2020-05-02 09:50:14.751043144 +0300
117 ++++ svgalib-1.9.25/kernel/svgalib_helper/main.c 2020-05-02 09:51:44.564742599 +0300
118 +@@ -171,8 +171,12 @@
119 #else
120 - static int svgalib_helper_ioctl(struct file *filp,
121 + static long svgalib_helper_ioctl(struct file *filp,
122 unsigned int cmd, unsigned long arg) {
123 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
124 + struct inode *inode=file_inode(filp);
125 @@ -13,7 +14,7 @@
126
127 io_t iov, *user_iov=(io_t *)arg;
128 pcic_t pciv, *user_pciv=(pcic_t *)arg;
129 -@@ -586,7 +590,11 @@
130 +@@ -587,7 +591,11 @@
131 static int svgalib_helper_mmap(struct file *filp, struct vm_area_struct *vma) {
132 unsigned long start=vma->vm_start;
133 unsigned long end=vma->vm_end;
134
135 diff --git a/media-libs/svgalib/files/svgalib-1.9.25-no-man-compression.patch b/media-libs/svgalib/files/svgalib-1.9.25-no-man-compression.patch
136 new file mode 100644
137 index 00000000000..e88647412f0
138 --- /dev/null
139 +++ b/media-libs/svgalib/files/svgalib-1.9.25-no-man-compression.patch
140 @@ -0,0 +1,26 @@
141 +--- svgalib-1.9.25/doc/Makefile.orig 2005-07-02 20:21:57.000000000 +0400
142 ++++ svgalib-1.9.25/doc/Makefile 2020-05-02 00:15:00.104324667 +0300
143 +@@ -26,7 +26,7 @@
144 + SVGALIB=$(subst man,$(srcdir)/doc/man,$(SVGALIB1))
145 + VGAGL=$(subst man,$(srcdir)/doc/man,$(VGAGL1))
146 + THREED=$(subst man,$(srcdir)/doc/man,$(THREED1))
147 +-COMPMANPAGES=$(shell cd $(srcdir)/doc; find man? -name "*.gz" -type f -print)
148 ++COMPMANPAGES=$(shell cd $(srcdir)/doc; find man? -type f -print)
149 +
150 + .PHONY: clean ascii dvi ps install gunzip gzip
151 +
152 +@@ -63,13 +63,12 @@
153 + cat $(VGAGL) | grep -v '^\.so ' | troff -man -T$@ > vgagl.$@
154 + cat $(THREED) | grep -v '^\.so ' | troff -man -T$@ > 3d.$@
155 +
156 +-install: gzip
157 ++install:
158 + mkdir -p $(mandir)/man1 $(mandir)/man3 $(mandir)/man5 \
159 + $(mandir)/man6 $(mandir)/man7 $(mandir)/man8
160 + for i in $(COMPMANPAGES); do\
161 + $(INSTALL_DATA) $(srcdir)/doc/$$i $(mandir)/$$i; \
162 + done
163 +- make gunzip
164 + ifdef MAKEWHATIS
165 + @echo "Rebuilding the whatis database (this is slow!)"
166 + @echo "You can comment this out in Makefile.cfg!"
167
168 diff --git a/media-libs/svgalib/files/svgalib-1.9.25-wrapdemo-buf-overflow.patch b/media-libs/svgalib/files/svgalib-1.9.25-wrapdemo-buf-overflow.patch
169 new file mode 100644
170 index 00000000000..1ea9f6a5e1e
171 --- /dev/null
172 +++ b/media-libs/svgalib/files/svgalib-1.9.25-wrapdemo-buf-overflow.patch
173 @@ -0,0 +1,14 @@
174 +Fix buffer overflow in palette when writing last non-used element:
175 +
176 +wrapdemo.c:256:29: warning: iteration 63 invokes undefined behavior [-Waggressive-loop-optimizations]
177 +--- svgalib-1.9.25/threeDKit/wrapdemo.c.orig 2020-05-01 23:41:32.000000000 +0300
178 ++++ svgalib-1.9.25/threeDKit/wrapdemo.c 2020-05-01 23:41:55.911933032 +0300
179 +@@ -230,7 +230,7 @@
180 + can be 0, 64, 128, OR 192 */
181 +
182 + int i;
183 +- unsigned char palette[768];
184 ++ unsigned char palette[769];
185 +
186 + for (i = 0; i < 64; i++) {
187 + palette[i * 3] = i;
188
189 diff --git a/media-libs/svgalib/svgalib-1.9.25-r6.ebuild b/media-libs/svgalib/svgalib-1.9.25-r6.ebuild
190 new file mode 100644
191 index 00000000000..55f0bb10dda
192 --- /dev/null
193 +++ b/media-libs/svgalib/svgalib-1.9.25-r6.ebuild
194 @@ -0,0 +1,124 @@
195 +# Copyright 1999-2020 Gentoo Authors
196 +# Distributed under the terms of the GNU General Public License v2
197 +
198 +EAPI=7
199 +
200 +inherit flag-o-matic linux-mod toolchain-funcs
201 +
202 +DESCRIPTION="A library for running svga graphics on the console"
203 +HOMEPAGE="http://www.svgalib.org/"
204 +SRC_URI="http://www.arava.co.il/matan/${PN}/${P}.tar.gz"
205 +
206 +LICENSE="BSD"
207 +SLOT="0"
208 +KEYWORDS="-* ~x86"
209 +IUSE="build +kernel-helper"
210 +
211 +MODULE_NAMES="svgalib_helper(misc:${S}/kernel/svgalib_helper)"
212 +BUILD_TARGETS="default"
213 +
214 +PATCHES=(
215 + "${FILESDIR}"/${PN}-1.9.25-linux_2.6.patch
216 + "${FILESDIR}"/${PN}-1.9.19-pic.patch
217 + "${FILESDIR}"/${PN}-1.9.25-build.patch
218 + "${FILESDIR}"/${PN}-1.9.25-linux_2.6.28.patch
219 + "${FILESDIR}"/${PN}-1.9.25-glibc210.patch
220 + "${FILESDIR}"/${PN}-1.9.25-linux_2.6.36-r1.patch
221 + "${FILESDIR}"/${PN}-1.9.25-fix_buffer.patch
222 + "${FILESDIR}"/${PN}-1.9.25-vga_reset.patch
223 + "${FILESDIR}"/${PN}-1.9.25-missing_include.patch
224 + "${FILESDIR}"/${PN}-1.9.25-linux_3.4.patch
225 + "${FILESDIR}"/${PN}-1.9.25-linux_3.9.patch
226 + "${FILESDIR}"/${PN}-1.9.25-no-man-compression.patch
227 + "${FILESDIR}"/${PN}-1.9.25-wrapdemo-buf-overflow.patch
228 +)
229 +
230 +pkg_setup() {
231 + linux-mod_pkg_setup
232 + BUILD_PARAMS="KDIR=${KV_OUT_DIR}"
233 +}
234 +
235 +src_prepare() {
236 + default
237 + sed -i -e '/linux\/smp_lock.h/d' kernel/svgalib_helper/main.c || die
238 + convert_to_m kernel/svgalib_helper/Makefile
239 +}
240 +
241 +src_compile() {
242 + use kernel-helper || export NO_HELPER=y
243 +
244 + export CC=$(tc-getCC)
245 + # C89 extern inlines are needed, see #576260
246 + append-cflags -fgnu89-inline
247 +
248 + # First build static
249 + emake OPTIMIZE="${CFLAGS}" static
250 + # Then build shared ...
251 + emake OPTIMIZE="${CFLAGS}" shared
252 + emake OPTIMIZE="${CFLAGS}" LDFLAGS+=" -L../sharedlib" \
253 + textutils lrmi utils
254 + # Build threeDKit ...
255 + emake OPTIMIZE="${CFLAGS}" LDFLAGS+=" -L../sharedlib" \
256 + -C threeDKit lib3dkit.a
257 + # Build demo's ...
258 + emake OPTIMIZE="${CFLAGS} -I../gl" LDFLAGS+=" -L../sharedlib" \
259 + demoprogs
260 +
261 + ! use build && use kernel-helper && linux-mod_src_compile
262 +}
263 +
264 +src_install() {
265 + local x
266 +
267 + dodir /etc/svgalib /usr/{include,lib,bin,share/man}
268 +
269 + emake \
270 + TOPDIR="${D}" OPTIMIZE="${CFLAGS}" INSTALLMODULE="" \
271 + install
272 + ! use build && use kernel-helper && linux-mod_src_install
273 +
274 + insinto /usr/include
275 + doins gl/vgagl.h
276 + dolib.a staticlib/libvga.a
277 + dolib.a staticlib/libvgagl.a
278 + dolib.a threeDKit/lib3dkit.a
279 +
280 + insinto /usr/include
281 + doins src/vga.h gl/vgagl.h src/mouse/vgamouse.h src/joystick/vgajoystick.h
282 + doins src/keyboard/vgakeyboard.h kernel/svgalib_helper/svgalib_helper.h
283 +
284 + insinto /lib/udev/rules.d
285 + newins "${FILESDIR}"/svgalib.udev.rules.d.2 30-svgalib.rules
286 +
287 + exeinto /usr/lib/svgalib/demos
288 + for x in "${S}"/demos/* ; do
289 + [[ -x ${x} ]] && doexe ${x}
290 + done
291 +
292 + cd "${S}"/threeDKit || die
293 + exeinto /usr/lib/svgalib/threeDKit
294 + local THREED_PROGS="plane wrapdemo"
295 + doexe ${THREED_PROGS}
296 +
297 + cd "${ED}/usr/$(get_libdir)" || die
298 + ln -s libvga.so.${PV} libvga.so.1 || die
299 + ln -s libvgagl.so.${PV} libvgagl.so.1 || die
300 + ln -s lib3dkit.so.${PV} lib3dkit.so.1 || die
301 + ln -sf libvga.so.1 libvga.so || die
302 + ln -sf libvgagl.so.1 libvgagl.so || die
303 + ln -sf lib3dkit.so.1 lib3dkit.so || die
304 +
305 + cd "${S}" || die
306 + dodoc 0-README
307 + cd "${S}"/doc || die
308 + dodoc CHANGES DESIGN TODO
309 + docinto txt
310 + dodoc Driver-programming-HOWTO add_driver svgalib.lsm \
311 + README.{joystick,keymap,multi-monitor,patching,vesa}
312 + # avoid installation of a broken symlink
313 + newdoc ../lrmi-0.6m/README README.lrmi
314 +}
315 +
316 +pkg_postinst() {
317 + ! use build && use kernel-helper && linux-mod_pkg_postinst
318 +}