- Fix build with recent kernels by migrating from SUBDIRS to M.
- Bump to EAPI 7.
- Disable package-side man page compression.
- Fix buffer overflow in wrapdemo.c.
- Clean up ebuild and fix spec QA issues.
- Rebase patches with fuzz.
Package-Manager: Portage-2.3.82, Repoman-2.3.20
Signed-off-by: Andrew Savchenko <bircoph@gentoo.org>
+++ svgalib/kernel/svgalib_helper/Makefile.alt
@@ -37,7 +37,7 @@
CFLAGS += -DSVGALIB_HELPER_MAJOR=$(SVGALIB_HELPER_MAJOR)
-
+
ifeq (1,$(findstring 1,$(MODVER)))
- CFLAGS += -DMODVERSIONS -include $(INCLUDEDIR)/linux/modversions.h
+ CFLAGS += -DMODVERSIONS -DCONFIG_MODVERSIONS=1
-diff -Naur svgalib-1.9.25/kernel/svgalib_helper/main.c svgalib-1.9.25_new/kernel/svgalib_helper/main.c\r
---- svgalib-1.9.25/kernel/svgalib_helper/main.c 2006-01-12 18:17:53.000000000 +0000\r
-+++ svgalib-1.9.25_new/kernel/svgalib_helper/main.c 2012-06-25 15:02:11.000000000 +0100\r
-@@ -33,7 +33,9 @@\r
- \r
- #include <asm/processor.h>\r
- #include <asm/uaccess.h>\r
--#include <asm/system.h> /* cli(), *_flags */\r
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)\r
-+ #include <asm/system.h> /* cli(), *_flags */\r
-+#endif\r
- #include <asm/segment.h> /* memcpy and such */\r
- #include <asm/io.h>\r
- #include <asm/pgtable.h>\r
-diff -Naur svgalib-1.9.25/kernel/svgalib_helper/Makefile svgalib-1.9.25_new/kernel/svgalib_helper/Makefile\r
---- svgalib-1.9.25/kernel/svgalib_helper/Makefile 2006-05-20 13:31:04.000000000 +0100\r
-+++ svgalib-1.9.25_new/kernel/svgalib_helper/Makefile 2012-06-25 13:39:38.000000000 +0100\r
-@@ -11,9 +11,11 @@\r
- PWD := $(shell pwd)\r
- TARGET := svgalib_helper\r
- \r
-+ ifneq ($(TOPDIR),)\r
- ifeq ($(PATCHLEVEL),4)\r
- include $(TOPDIR)/Rules.make\r
- endif\r
-+ endif \r
- \r
- else\r
-
\ No newline at end of file
+diff '--color=auto' -Naurd svgalib-1.9.25.prev/kernel/svgalib_helper/Makefile svgalib-1.9.25/kernel/svgalib_helper/Makefile
+--- svgalib-1.9.25.prev/kernel/svgalib_helper/Makefile 2020-05-02 09:49:05.072052128 +0300
++++ svgalib-1.9.25/kernel/svgalib_helper/Makefile 2020-05-02 09:50:14.748043187 +0300
+@@ -11,9 +11,11 @@
+ PWD := $(shell pwd)
+ TARGET := svgalib_helper
+
++ ifneq ($(TOPDIR),)
+ ifeq ($(PATCHLEVEL),4)
+ include $(TOPDIR)/Rules.make
+ endif
++ endif
+
+ else
+
+diff '--color=auto' -Naurd svgalib-1.9.25.prev/kernel/svgalib_helper/main.c svgalib-1.9.25/kernel/svgalib_helper/main.c
+--- svgalib-1.9.25.prev/kernel/svgalib_helper/main.c 2020-05-02 09:49:05.075052085 +0300
++++ svgalib-1.9.25/kernel/svgalib_helper/main.c 2020-05-02 09:50:14.751043144 +0300
+@@ -38,7 +38,9 @@
+
+ #include <asm/processor.h>
+ #include <asm/uaccess.h>
+-#include <asm/system.h> /* cli(), *_flags */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
++ #include <asm/system.h> /* cli(), *_flags */
++#endif
+ #include <asm/segment.h> /* memcpy and such */
+ #include <asm/io.h>
+ #include <asm/pgtable.h>
---- svgalib-1.9.25/kernel/svgalib_helper/main.c.orig 2016-02-22 11:10:25.000000000 +0300
-+++ svgalib-1.9.25/kernel/svgalib_helper/main.c 2016-02-22 11:17:16.223529679 +0300
-@@ -170,8 +170,12 @@
+diff '--color=auto' -Naurd svgalib-1.9.25.prev/kernel/svgalib_helper/main.c svgalib-1.9.25/kernel/svgalib_helper/main.c
+--- svgalib-1.9.25.prev/kernel/svgalib_helper/main.c 2020-05-02 09:50:14.751043144 +0300
++++ svgalib-1.9.25/kernel/svgalib_helper/main.c 2020-05-02 09:51:44.564742599 +0300
+@@ -171,8 +171,12 @@
#else
- static int svgalib_helper_ioctl(struct file *filp,
+ static long svgalib_helper_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
+ struct inode *inode=file_inode(filp);
io_t iov, *user_iov=(io_t *)arg;
pcic_t pciv, *user_pciv=(pcic_t *)arg;
-@@ -586,7 +590,11 @@
+@@ -587,7 +591,11 @@
static int svgalib_helper_mmap(struct file *filp, struct vm_area_struct *vma) {
unsigned long start=vma->vm_start;
unsigned long end=vma->vm_end;
--- /dev/null
+--- svgalib-1.9.25/doc/Makefile.orig 2005-07-02 20:21:57.000000000 +0400
++++ svgalib-1.9.25/doc/Makefile 2020-05-02 00:15:00.104324667 +0300
+@@ -26,7 +26,7 @@
+ SVGALIB=$(subst man,$(srcdir)/doc/man,$(SVGALIB1))
+ VGAGL=$(subst man,$(srcdir)/doc/man,$(VGAGL1))
+ THREED=$(subst man,$(srcdir)/doc/man,$(THREED1))
+-COMPMANPAGES=$(shell cd $(srcdir)/doc; find man? -name "*.gz" -type f -print)
++COMPMANPAGES=$(shell cd $(srcdir)/doc; find man? -type f -print)
+
+ .PHONY: clean ascii dvi ps install gunzip gzip
+
+@@ -63,13 +63,12 @@
+ cat $(VGAGL) | grep -v '^\.so ' | troff -man -T$@ > vgagl.$@
+ cat $(THREED) | grep -v '^\.so ' | troff -man -T$@ > 3d.$@
+
+-install: gzip
++install:
+ mkdir -p $(mandir)/man1 $(mandir)/man3 $(mandir)/man5 \
+ $(mandir)/man6 $(mandir)/man7 $(mandir)/man8
+ for i in $(COMPMANPAGES); do\
+ $(INSTALL_DATA) $(srcdir)/doc/$$i $(mandir)/$$i; \
+ done
+- make gunzip
+ ifdef MAKEWHATIS
+ @echo "Rebuilding the whatis database (this is slow!)"
+ @echo "You can comment this out in Makefile.cfg!"
--- /dev/null
+Fix buffer overflow in palette when writing last non-used element:
+
+wrapdemo.c:256:29: warning: iteration 63 invokes undefined behavior [-Waggressive-loop-optimizations]
+--- svgalib-1.9.25/threeDKit/wrapdemo.c.orig 2020-05-01 23:41:32.000000000 +0300
++++ svgalib-1.9.25/threeDKit/wrapdemo.c 2020-05-01 23:41:55.911933032 +0300
+@@ -230,7 +230,7 @@
+ can be 0, 64, 128, OR 192 */
+
+ int i;
+- unsigned char palette[768];
++ unsigned char palette[769];
+
+ for (i = 0; i < 64; i++) {
+ palette[i * 3] = i;
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic linux-mod toolchain-funcs
+
+DESCRIPTION="A library for running svga graphics on the console"
+HOMEPAGE="http://www.svgalib.org/"
+SRC_URI="http://www.arava.co.il/matan/${PN}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="-* ~x86"
+IUSE="build +kernel-helper"
+
+MODULE_NAMES="svgalib_helper(misc:${S}/kernel/svgalib_helper)"
+BUILD_TARGETS="default"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.9.25-linux_2.6.patch
+ "${FILESDIR}"/${PN}-1.9.19-pic.patch
+ "${FILESDIR}"/${PN}-1.9.25-build.patch
+ "${FILESDIR}"/${PN}-1.9.25-linux_2.6.28.patch
+ "${FILESDIR}"/${PN}-1.9.25-glibc210.patch
+ "${FILESDIR}"/${PN}-1.9.25-linux_2.6.36-r1.patch
+ "${FILESDIR}"/${PN}-1.9.25-fix_buffer.patch
+ "${FILESDIR}"/${PN}-1.9.25-vga_reset.patch
+ "${FILESDIR}"/${PN}-1.9.25-missing_include.patch
+ "${FILESDIR}"/${PN}-1.9.25-linux_3.4.patch
+ "${FILESDIR}"/${PN}-1.9.25-linux_3.9.patch
+ "${FILESDIR}"/${PN}-1.9.25-no-man-compression.patch
+ "${FILESDIR}"/${PN}-1.9.25-wrapdemo-buf-overflow.patch
+)
+
+pkg_setup() {
+ linux-mod_pkg_setup
+ BUILD_PARAMS="KDIR=${KV_OUT_DIR}"
+}
+
+src_prepare() {
+ default
+ sed -i -e '/linux\/smp_lock.h/d' kernel/svgalib_helper/main.c || die
+ convert_to_m kernel/svgalib_helper/Makefile
+}
+
+src_compile() {
+ use kernel-helper || export NO_HELPER=y
+
+ export CC=$(tc-getCC)
+ # C89 extern inlines are needed, see #576260
+ append-cflags -fgnu89-inline
+
+ # First build static
+ emake OPTIMIZE="${CFLAGS}" static
+ # Then build shared ...
+ emake OPTIMIZE="${CFLAGS}" shared
+ emake OPTIMIZE="${CFLAGS}" LDFLAGS+=" -L../sharedlib" \
+ textutils lrmi utils
+ # Build threeDKit ...
+ emake OPTIMIZE="${CFLAGS}" LDFLAGS+=" -L../sharedlib" \
+ -C threeDKit lib3dkit.a
+ # Build demo's ...
+ emake OPTIMIZE="${CFLAGS} -I../gl" LDFLAGS+=" -L../sharedlib" \
+ demoprogs
+
+ ! use build && use kernel-helper && linux-mod_src_compile
+}
+
+src_install() {
+ local x
+
+ dodir /etc/svgalib /usr/{include,lib,bin,share/man}
+
+ emake \
+ TOPDIR="${D}" OPTIMIZE="${CFLAGS}" INSTALLMODULE="" \
+ install
+ ! use build && use kernel-helper && linux-mod_src_install
+
+ insinto /usr/include
+ doins gl/vgagl.h
+ dolib.a staticlib/libvga.a
+ dolib.a staticlib/libvgagl.a
+ dolib.a threeDKit/lib3dkit.a
+
+ insinto /usr/include
+ doins src/vga.h gl/vgagl.h src/mouse/vgamouse.h src/joystick/vgajoystick.h
+ doins src/keyboard/vgakeyboard.h kernel/svgalib_helper/svgalib_helper.h
+
+ insinto /lib/udev/rules.d
+ newins "${FILESDIR}"/svgalib.udev.rules.d.2 30-svgalib.rules
+
+ exeinto /usr/lib/svgalib/demos
+ for x in "${S}"/demos/* ; do
+ [[ -x ${x} ]] && doexe ${x}
+ done
+
+ cd "${S}"/threeDKit || die
+ exeinto /usr/lib/svgalib/threeDKit
+ local THREED_PROGS="plane wrapdemo"
+ doexe ${THREED_PROGS}
+
+ cd "${ED}/usr/$(get_libdir)" || die
+ ln -s libvga.so.${PV} libvga.so.1 || die
+ ln -s libvgagl.so.${PV} libvgagl.so.1 || die
+ ln -s lib3dkit.so.${PV} lib3dkit.so.1 || die
+ ln -sf libvga.so.1 libvga.so || die
+ ln -sf libvgagl.so.1 libvgagl.so || die
+ ln -sf lib3dkit.so.1 lib3dkit.so || die
+
+ cd "${S}" || die
+ dodoc 0-README
+ cd "${S}"/doc || die
+ dodoc CHANGES DESIGN TODO
+ docinto txt
+ dodoc Driver-programming-HOWTO add_driver svgalib.lsm \
+ README.{joystick,keymap,multi-monitor,patching,vesa}
+ # avoid installation of a broken symlink
+ newdoc ../lrmi-0.6m/README README.lrmi
+}
+
+pkg_postinst() {
+ ! use build && use kernel-helper && linux-mod_pkg_postinst
+}