From 9f234ff8d73cff4614a51288852e15dba97d318d Mon Sep 17 00:00:00 2001 From: Martin Schlemmer Date: Sun, 22 Feb 2004 21:48:55 +0000 Subject: Update version. Fix compiles on 2.6 kernels. Add simple sysfs support for udev enabled systems. --- media-libs/svgalib/files/digest-svgalib-1.9.18 | 1 + .../svgalib/files/svgalib-1.9.18-gcc33.patch | 13 + .../svgalib/files/svgalib-1.9.18-gentoo.patch | 99 +++++ .../svgalib/files/svgalib-1.9.18-linux2.6.patch | 475 +++++++++++++++++++++ 4 files changed, 588 insertions(+) create mode 100644 media-libs/svgalib/files/digest-svgalib-1.9.18 create mode 100644 media-libs/svgalib/files/svgalib-1.9.18-gcc33.patch create mode 100644 media-libs/svgalib/files/svgalib-1.9.18-gentoo.patch create mode 100644 media-libs/svgalib/files/svgalib-1.9.18-linux2.6.patch (limited to 'media-libs/svgalib/files') diff --git a/media-libs/svgalib/files/digest-svgalib-1.9.18 b/media-libs/svgalib/files/digest-svgalib-1.9.18 new file mode 100644 index 000000000000..0c2fdc8d9e53 --- /dev/null +++ b/media-libs/svgalib/files/digest-svgalib-1.9.18 @@ -0,0 +1 @@ +MD5 5a1dc3dbf3182fb560959678dfba6181 svgalib-1.9.18.tar.gz 933786 diff --git a/media-libs/svgalib/files/svgalib-1.9.18-gcc33.patch b/media-libs/svgalib/files/svgalib-1.9.18-gcc33.patch new file mode 100644 index 000000000000..e6c450b8d158 --- /dev/null +++ b/media-libs/svgalib/files/svgalib-1.9.18-gcc33.patch @@ -0,0 +1,13 @@ +--- svgalib-1.9.18/demos/lineart.c.orig 2004-02-22 23:34:04.093602664 +0200 ++++ svgalib-1.9.18/demos/lineart.c 2004-02-22 23:32:00.317419504 +0200 +@@ -19,8 +19,8 @@ + + if(mode == 0) + { +- printf("Usage:linp [mode mode ...]\n +- where mode is an integer.\n"); ++ printf("Usage:linp [mode mode ...]\n"\ ++ "where mode is an integer.\n"); + return; + } + if(! vga_hasmode(mode)) { diff --git a/media-libs/svgalib/files/svgalib-1.9.18-gentoo.patch b/media-libs/svgalib/files/svgalib-1.9.18-gentoo.patch new file mode 100644 index 000000000000..859144307d24 --- /dev/null +++ b/media-libs/svgalib/files/svgalib-1.9.18-gentoo.patch @@ -0,0 +1,99 @@ +--- svgalib-1.9.18/Makefile 2004-02-22 20:16:50.506825616 +0200 ++++ svgalib-1.9.18/Makefile 2004-02-22 20:18:55.028895384 +0200 +@@ -78,10 +78,6 @@ + + installheaders: + @echo Installing header files in $(includedir). +- @if [ -f /usr/include/vga.h ]; then \ +- rm -f /usr/include/vga.h /usr/include/vgagl.h; \ +- echo Old header files in /usr/include removed.; \ +- fi + @mkdir -p $(includedir) + @cp $(srcdir)/src/vga.h $(includedir)/vga.h + @chmod a+r $(includedir)/vga.h +@@ -95,16 +91,6 @@ + @chmod a+r $(includedir)/vgakeyboard.h + + installsharedlib: $(SHAREDLIBS) $(SVGALIBSHAREDSTUBS) +- @if [ -f /usr/lib/libvga.sa ]; then \ +- rm -f /usr/lib/libvga.sa /usr/lib/libvgagl.sa; \ +- echo Old stubs in /usr/lib removed.; \ +- fi +-ifndef KEEPSHAREDLIBS +- @echo "Removing shared library images (old & current)..." +- @for i in $(OBSOLETELDIRS); do \ +- rm -f `echo $(OBSOLETESHAREDIMAGES) | sed s?/lib/?$$i?g`; \ +- done +-endif + @echo Installing shared library image as \ + $(addprefix $(sharedlibdir)/,$(notdir $(SHAREDLIBS))). + @for foo in $(notdir $(SHAREDLIBS)); do \ +@@ -118,10 +104,8 @@ + installstaticlib: static + @echo Installing static libraries in $(libdir). + @mkdir -p $(libdir) +- @rm -f /usr/lib/libvga.a + @$(INSTALL_DATA) staticlib/libvga.a $(libdir)/libvga.a + @chmod a+r $(libdir)/libvga.a +- @rm -f /usr/lib/libvgagl.a + @$(INSTALL_DATA) staticlib/libvgagl.a $(libdir)/libvgagl.a + @chmod a+r $(libdir)/libvgagl.a + +@@ -130,14 +114,6 @@ + echo No $(bindir) directory, creating it.; \ + mkdir -p $(bindir); \ + fi +- @if [ -f /usr/bin/restorefont ]; then \ +- echo Removing old utilities in /usr/bin.; \ +- for x in $(UTILS); do rm -f /usr/bin/$$x; done; \ +- fi +- @if [ -f /usr/bin/convfont ]; then \ +- echo Removing inappropriate utilities in /usr/bin.; \ +- rm -f /usr/bin/convfont /usr/bin/setmclk; \ +- fi + @echo Installing textmode utilities in $(bindir): + @echo "restorefont: Save/restore textmode font." + @cp utils/restorefont $(bindir) +@@ -210,7 +186,7 @@ + lib3dkit-install: + (cd threeDKit/; $(MAKE) install) + +-install: uninstall installheaders $(INSTALLSHAREDLIB) installconfig \ ++install: installheaders $(INSTALLSHAREDLIB) installconfig \ + $(INSTALLSTATICLIB) $(INSTALLUTILS) $(INSTALLMAN) installmodule $(INSTALLDEV) \ + lib3dkit-install + @echo +--- svgalib-1.9.18/kernel/svgalib_helper/Makefile 2004-02-22 20:24:57.921727288 +0200 ++++ svgalib-1.9.18/kernel/svgalib_helper/Makefile 2004-02-22 20:23:34.654385848 +0200 +@@ -45,8 +45,8 @@ + svgalib_helper.o: $(svgalib_helper-objs) + $(LD) -r -o $@ $(svgalib_helper-objs) + +-install: device modules_install ++install: modules_install + + modules_install: $(TARGET).o +- mkdir -p /lib/modules/$(VER)/kernel/misc +- install -m 0644 -c $(TARGET).o /lib/modules/$(VER)/kernel/misc ++ mkdir -p $(TOPDIR)/lib/modules/$(VER)/kernel/misc ++ install -m 0644 -c $(TARGET).o $(TOPDIR)/lib/modules/$(VER)/kernel/misc +--- svgalib-1.9.18/Makefile.cfg 2004-02-22 20:38:09.813341464 +0200 ++++ svgalib-1.9.18/Makefile.cfg 2004-02-22 20:41:45.480555064 +0200 +@@ -44,7 +44,7 @@ + # Common prefix for installation directories. + # NOTE: This directory must exist when you start the install. + TOPDIR= +-prefix = $(TOPDIR)/usr/local ++prefix = $(TOPDIR)/usr + exec_prefix = $(prefix) + + # Directory where the shared stubs and static library will be installed. +@@ -126,7 +126,7 @@ + # MAKEWHATIS = makewhatis # Beware, this will really need a few minutes! + + # Comment this out if you use devfs only and don't want to make svga nodes +-INSTALLDEV = installdev ++#INSTALLDEV = installdev + + # + # Comment out any driver that you don't want included in the library. diff --git a/media-libs/svgalib/files/svgalib-1.9.18-linux2.6.patch b/media-libs/svgalib/files/svgalib-1.9.18-linux2.6.patch new file mode 100644 index 000000000000..4bde429b23fe --- /dev/null +++ b/media-libs/svgalib/files/svgalib-1.9.18-linux2.6.patch @@ -0,0 +1,475 @@ +diff -urpN svgalib-1.9.18/kernel/svgalib_helper/Makefile svgalib-1.9.18/kernel/svgalib_helper/Makefile +--- svgalib-1.9.18/kernel/svgalib_helper/Makefile 2004-02-22 20:52:42.000000000 +0200 ++++ svgalib-1.9.18/kernel/svgalib_helper/Makefile 2004-02-22 23:19:39.617023080 +0200 +@@ -13,15 +13,32 @@ EXTRA_CFLAGS := -DSVGALIB_HELPER_MAJOR=$ + + ifeq ($(PATCHLEVEL),4) + include $(TOPDIR)/Rules.make ++ OBJEXT := o ++else ++ OBJEXT := ko + endif + + else + +-VER = $(shell uname -r) ++# Extract version number from headers. ++VER = $(shell awk -F\" '/REL/ {print $$2}' $(INCLUDEDIR)/linux/version.h 2>/dev/null) ++ ++# Use version of current running kernel ++ifeq ($(VER),) ++ VER = $(shell uname -r) ++endif ++ ++PATCHLEVEL := $(shell echo $(VER) | cut -d. -f2) + KDIR := /lib/modules/$(VER)/build + PWD := $(shell pwd) + TARGET := svgalib_helper + ++ifeq ($(PATCHLEVEL),4) ++ OBJEXT := o ++else ++ OBJEXT := ko ++endif ++ + default: + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules + +@@ -41,4 +58,4 @@ install: modules_install + + modules_install: $(TARGET).o + mkdir -p $(TOPDIR)/lib/modules/$(VER)/kernel/misc +- install -m 0644 -c $(TARGET).o $(TOPDIR)/lib/modules/$(VER)/kernel/misc ++ install -m 0644 -c $(TARGET).$(OBJEXT) $(TOPDIR)/lib/modules/$(VER)/kernel/misc +diff -urpN svgalib-1.9.18/kernel/svgalib_helper/kernel26compat.h svgalib-1.9.18/kernel/svgalib_helper/kernel26compat.h +--- svgalib-1.9.18/kernel/svgalib_helper/kernel26compat.h 2004-02-22 20:52:42.000000000 +0200 ++++ svgalib-1.9.18/kernel/svgalib_helper/kernel26compat.h 2004-02-22 22:55:13.813859032 +0200 +@@ -43,11 +43,41 @@ static inline int devfs_unregister_chrde + } + #endif + ++#if defined(KERNEL_2_6) && !defined(CONFIG_DEVFS_FS) ++# define SLH_SYSFS_REGISTER \ ++ svgalib_helper_class = class_simple_create(THIS_MODULE, "svgalib_helper"); ++ ++# define SLH_SYSFS_ADD_CONTROL \ ++ class_simple_device_add(svgalib_helper_class, \ ++ MKDEV(SVGALIB_HELPER_MAJOR, 0), \ ++ NULL, "svga"); ++ ++# define SLH_SYSFS_ADD_DEVICE(_name, _minor) \ ++ class_simple_device_add(svgalib_helper_class, \ ++ MKDEV(SVGALIB_HELPER_MAJOR, _minor), \ ++ &sh_pci_devs[_minor]->dev->dev, _name); ++ ++# define SLH_SYSFS_REMOVE_DEVICE(i) \ ++ class_simple_device_remove(MKDEV(SVGALIB_HELPER_MAJOR, i)); ++ ++# define SLH_SYSFS_UNREGISTER \ ++ class_simple_destroy(svgalib_helper_class); ++#else ++# define SLH_SYSFS_REGISTER ++# define SLH_SYSFS_ADD_CONTROL ++# define SLH_SYSFS_ADD_DEVICE(_name, _minor) ++# define SLH_SYSFS_REMOVE_DEVICE(i) ++# define SLH_SYSFS_UNREGISTER ++#endif ++ + + /* Our main.c really do not like MINOR from 2.6 kernels ... */ + #if (defined MINOR) && (!defined KERNEL_2_6) + # define my_minor(x) MINOR(x) + #else ++# ifndef minor ++# define minor(x) MINOR(x) ++# endif + # define my_minor(x) minor(x) + #endif + +diff -urpN svgalib-1.9.18/kernel/svgalib_helper/main.c svgalib-1.9.18/kernel/svgalib_helper/main.c +--- svgalib-1.9.18/kernel/svgalib_helper/main.c 2004-02-22 23:01:50.113612312 +0200 ++++ svgalib-1.9.18/kernel/svgalib_helper/main.c 2004-02-22 22:59:25.451604280 +0200 +@@ -53,15 +53,19 @@ static int irqs[MAX_NR_DEVICES]; + static devfs_handle_t devfs_handle; + #endif + ++#if defined(KERNEL_2_6) && !defined(CONFIG_DEVFS_FS) ++struct class_simple *svgalib_helper_class; ++#endif ++ + static int check_io_range(int port, int device) { + return 1; + } + +-static struct pci_dev *get_pci_dev(int pcipos, int minor) { ++static struct pci_dev *get_pci_dev(int pcipos, int _minor) { + +- if(minor>=num_devices) return NULL; +- if(minor>0) { +- return sh_pci_devs[minor]->dev; ++ if(_minor>=num_devices) return NULL; ++ if(_minor>0) { ++ return sh_pci_devs[_minor]->dev; + } else { + if(pcipos>0 && pciposdev; +@@ -70,11 +74,11 @@ static struct pci_dev *get_pci_dev(int p + + } + +-static int get_dev(int pcipos, int minor) { ++static int get_dev(int pcipos, int _minor) { + +- if(minor>=num_devices) return 0; +- if(minor>0) { +- return minor; ++ if(_minor>=num_devices) return 0; ++ if(_minor>0) { ++ return _minor; + } else { + if(pcipos>=num_devices || pcipos<1) return 0; + return pcipos; +@@ -111,7 +115,7 @@ static int svgalib_helper_ioctl( struct + + io_t iov; + pcic_t pciv; +- int minor = my_minor(inode->i_rdev); ++ int _minor = my_minor(inode->i_rdev); + struct pci_dev *pdev; + io_string_t iostr; + int i=0, ret; +@@ -134,7 +138,7 @@ static int svgalib_helper_ioctl( struct + if (iostr.length>4096) return -EINVAL; + if ( (outb_str = kmalloc(iostr.length, GFP_KERNEL )) == NULL ) return -ENOMEM; + copy_from_user(outb_str,iostr.string,iostr.length); +- if(check_io_range(iostr.port,minor)) { ++ if(check_io_range(iostr.port,_minor)) { + for(i=0; i5)) return -EINVAL; + pciv.val=sh_pci_devs[i]->len[pciv.address]; + copy_to_user((char *)arg,&pciv,sizeof(pciv)); +@@ -255,7 +259,7 @@ static int svgalib_helper_ioctl( struct + + case _IOC_NR(SVGAHELPER_PCIOUTB): + copy_from_user(&pciv,(char *)arg,sizeof(pciv)); +- pdev = get_pci_dev(pciv.pcipos, minor); ++ pdev = get_pci_dev(pciv.pcipos, _minor); + if(!pdev) return -EINVAL; + pb=pciv.val; + pci_write_config_byte(pdev, pciv.address, pb); +@@ -263,7 +267,7 @@ static int svgalib_helper_ioctl( struct + + case _IOC_NR(SVGAHELPER_PCIOUTW): + copy_from_user(&pciv,(char *)arg,sizeof(pciv)); +- pdev = get_pci_dev(pciv.pcipos, minor); ++ pdev = get_pci_dev(pciv.pcipos, _minor); + if(!pdev) return -EINVAL; + pw=pciv.val; + pci_write_config_word(pdev, pciv.address, pw); +@@ -271,7 +275,7 @@ static int svgalib_helper_ioctl( struct + + case _IOC_NR(SVGAHELPER_PCIOUTL): + copy_from_user(&pciv,(char *)arg,sizeof(pciv)); +- pdev = get_pci_dev(pciv.pcipos, minor); ++ pdev = get_pci_dev(pciv.pcipos, _minor); + if(!pdev) return -EINVAL; + pl=pciv.val; + pci_write_config_dword(pdev, pciv.address, pl); +@@ -292,17 +296,17 @@ static int svgalib_helper_ioctl( struct + case _IOC_NR(SVGAHELPER_WAITRETRACE): + + /* Workaround for nvidia cards, which are not vga compatible */ +-// if(!minor && num_devices==2) minor=1; ++// if(!_minor && num_devices==2) _minor=1; + +- if(minor) { +- i=sh_pci_devs[minor]->dev->irq; +- dev_id = sh_pci_devs[minor]; ++ if(_minor) { ++ i=sh_pci_devs[_minor]->dev->irq; ++ dev_id = sh_pci_devs[_minor]; + if(i==0 || i==-1 || i==255) return -EINVAL; + } else dev_id = sdev_id; + + vsync=1; + +- if(minor) { ++ if(_minor) { + request_irq(i, vsync_interrupt, SA_SHIRQ, "svgalib_helper", dev_id); + } else { + i=0; +@@ -310,16 +314,16 @@ static int svgalib_helper_ioctl( struct + request_irq(irqs[i++], vsync_interrupt, SA_SHIRQ, "svgalib_helper", dev_id); + } + +- if(minor) { +- sh_pci_devs[minor]->enable_vsync(sh_pci_devs[minor]); ++ if(_minor) { ++ sh_pci_devs[_minor]->enable_vsync(sh_pci_devs[_minor]); + } else { +- vga_enable_vsync(sh_pci_devs[minor]); ++ vga_enable_vsync(sh_pci_devs[_minor]); + } + + interruptible_sleep_on(&vsync_wait); + +- if(minor) { +- if(vsync) sh_pci_devs[minor]->ack_vsync(dev_id); ++ if(_minor) { ++ if(vsync) sh_pci_devs[_minor]->ack_vsync(dev_id); + free_irq(i, dev_id); + } else { + i=0; +@@ -354,9 +358,9 @@ static int svgalib_helper_ioctl( struct + + static int svgalib_helper_open( struct inode *inode, struct file * filp) { + +- int minor = my_minor(inode->i_rdev); ++ int _minor = my_minor(inode->i_rdev); + +- if(minor>=num_devices) return -ENODEV; ++ if(_minor>=num_devices) return -ENODEV; + + #ifndef KERNEL_2_6 + MOD_INC_USE_COUNT; +@@ -470,14 +474,14 @@ int check_mem(int card, unsigned long st + 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; +- unsigned long minor = my_minor(filp->f_dentry->d_inode->i_rdev); ++ unsigned long _minor = my_minor(filp->f_dentry->d_inode->i_rdev); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) + unsigned long ofs=vma->vm_pgoff*PAGE_SIZE; + #else + unsigned long ofs=vma->vm_offset; + #endif + +- if(check_mem(minor, ofs, end-start)) return -EPERM; ++ if(check_mem(_minor, ofs, end-start)) return -EPERM; + if(remap_cache(vma, ofs)) return -EAGAIN; + return 0; + } +@@ -502,6 +506,7 @@ int init_module(void) + { + int result, i, j; + struct pci_dev *dev=NULL; ++ char name[255]; + #ifdef CONFIG_DEVFS_FS + # ifndef KERNEL_2_6 + devfs_handle_t slave_handle; +@@ -513,9 +518,9 @@ int init_module(void) + + printk(KERN_INFO "svgalib_helper: Initializing, version %s\n", versionstr); + +- result = devfs_register_chrdev(SVGALIB_HELPER_MAJOR, "svgalib_helper", &svgalib_helper_fops); ++ result = devfs_register_chrdev(SVGALIB_HELPER_MAJOR, "svgalib_helper", &svgalib_helper_fops); + +- if (result < 0) { ++ if (result < 0) { + printk(KERN_WARNING "svgalib_helper: can't get major %d\n",SVGALIB_HELPER_MAJOR); + return result; + } +@@ -523,7 +528,7 @@ int init_module(void) + if((sh_pci_devs[0]=kmalloc(sizeof(struct sh_pci_device),GFP_KERNEL))==NULL) { + goto nomem_error; + } +- ++ + memset(sh_pci_devs[0],0,sizeof(struct sh_pci_device)); + num_devices=1; + for(i=1;i