pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/50202 (graphics/MesaLib can be upgraded to 10.6.5 and use libdevq on FreeBSD / DragonFly)



The following reply was made to PR pkg/50202; it has been noted by GNATS.

From: David Shao <davshao%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/50202 (graphics/MesaLib can be upgraded to 10.6.5 and use
 libdevq on FreeBSD / DragonFly)
Date: Wed, 9 Sep 2015 12:52:03 -0700

 I updated the devel/libdevq port and committed it to pkgsrc-wip.  I
 have eliminated the change to the name of the pkg-config configuration
 file libdevq-1.0.pc.
 
 Makefile:
 
 # $NetBSD$
 
 # Original port from FreeBSD ports and DragonFly dports
 # Created by: Koop Mast <kwm%FreeBSD.org@localhost>
 
 DISTNAME=    libdevq-0.0.2
 CATEGORIES=    devel
 MASTER_SITES=    http://rainbow-runner.nl/freebsd/
 EXTRACT_SUFX=    .tar.xz
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=    https://github.com/freebsd/libdevq
 COMMENT=    Generic Device Query and Monitor interface
 LICENSE=    2-clause-bsd
 
 ONLY_FOR_PLATFORM=    DragonFly-*-* FreeBSD-*-*
 
 USE_LIBTOOL=    yes
 PKGCONFIG_OVERRIDE+=    src/libdevq-1.0.pc.in
 GNU_CONFIGURE=    yes
 
 .include "../../mk/bsd.prefs.mk"
 
 PKG_OPTIONS_VAR=    PKG_OPTIONS.libdevq
 PKG_SUPPORTED_OPTIONS=    diagnostic-bin
 # diagnostic-bin: Build diagnostic programs
 
 .include "../../mk/bsd.options.mk"
 
 PLIST_VARS+=    diagnostic-bin
 
 .if !empty(PKG_OPTIONS:Mdiagnostic-bin)
 CONFIGURE_ARGS+=    --enable-programs
 PLIST.diagnostic-bin=        yes
 .endif
 
 .include "../../mk/bsd.pkg.mk"
 
 DESCR:
 
 Generic Device Query and Monitor interface
 
 WWW: https://github.com/freebsd/libdevq
 
 libdevq on FreeBSD and DragonFly partially substitutes for udev
 enough to build features such as libgbm and drm egl on MesaLib.
 
 https://wiki.freebsd.org/Graphics
 
 PLIST:
 
 @comment $NetBSD$
 ${PLIST.diagnostic-bin}bin/devq-evwatch
 ${PLIST.diagnostic-bin}bin/devq-lsdri
 include/libdevq.h
 lib/libdevq.la
 lib/pkgconfig/libdevq-1.0.pc
 
 TODO:
 
 libdevq port is done so far as implementing almost exactly
 the existing port to FreeBSD ports and DragonFly dports.
 
 buildlink3.mk:
 
 # $NetBSD: buildlink3.mk$
 
 BUILDLINK_TREE+=    libdevq
 
 .if !defined(LIBDEVQ_BUILDLINK3_MK)
 LIBDEVQ_BUILDLINK3_MK:=
 
 BUILDLINK_API_DEPENDS.libdevq+=    libdevq>=0.0.2
 BUILDLINK_PKGSRCDIR.libdevq?=    ../../devel/libdevq
 .include "../../mk/dlopen.buildlink3.mk"
 .endif # LIBDEVQ_BUILDLINK3_MK
 
 BUILDLINK_TREE+=    -libdevq
 
 distinfo:
 
 $NetBSD$
 
 SHA1 (libdevq-0.0.2.tar.xz) = a7a06d4cc3e8de2e8015fb3f78cd596ede6e87ca
 RMD160 (libdevq-0.0.2.tar.xz) = df81ed6172c2f55035ff6804b67d9fea4ba5d5ee
 Size (libdevq-0.0.2.tar.xz) = 210960 bytes
 SHA1 (patch-configure) = 3a53138ebbd6aa02492ab910051bc060932b51b9
 SHA1 (patch-src_device.c) = 965f681e107c504dba49928950edefc71fbfc6a5
 
 patches/patch-configure:
 
 $NetBSD$
 
 Without this patch, building on DragonFly 4.3 DEVELOPMENT fails with:
 
 bmake: don't know how to make src/event_monitor_dragonfly.c. Stop
 
 dports seems able to make this substitution automatically.
 
 --- configure.orig    2015-09-05 00:19:11.267232000 +0000
 +++ configure
 @@ -11725,7 +11725,7 @@ esac
 
 
  case $target_os in
 -freebsd*) opsys=freebsd ;;
 +dragonfly* | freebsd*) opsys=freebsd ;;
  *) opsys=$target_os ;;
  esac
 
 patches/patch-src_device.c:
 
 $NetBSD$
 
 From 7b48b8726b85eac66c1b164fab87d154be5aa068 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell%FreeBSD.org@localhost>
 Date: Fri, 13 Feb 2015 19:46:37 +0100
 Subject: [PATCH] Support dev.$driver.$n.%location from FreeBSD 11.x
 
 The format changed from:
     slot=1 function=0
 to:
     pci0:2:0:0 handle=\_SB_.PCI0.PEG3.MXM3
 
 Now devq_device_get_pciid_from_fd() supports both formats.
 
 --- src/device.c.orig    2014-05-08 14:38:51.000000000 +0000
 +++ src/device.c
 @@ -187,6 +187,58 @@ out:
  #endif /* defined(HAVE_LIBPROCSTAT_H) */
  }
 
 +static int
 +devq_compare_vgapci_busaddr(int i, int *domain, int *bus, int *slot,
 +    int *function)
 +{
 +    int ret;
 +    char sysctl_name[32], sysctl_value[128];
 +    size_t sysctl_value_len;
 +
 +    sprintf(sysctl_name, "dev.vgapci.%d.%%location", i);
 +
 +    sysctl_value_len = sizeof(sysctl_value);
 +    memset(sysctl_value, 0, sysctl_value_len);
 +    ret = sysctlbyname(sysctl_name, sysctl_value,
 +        &sysctl_value_len, NULL, 0);
 +    if (ret != 0)
 +        return (-1);
 +
 +    /*
 +     * dev.vgapci.$m.%location can have two formats:
 +     *     o  "pci0:2:0:0 handle=\_SB_.PCI0.PEG3.MXM3" (FreeBSD 11+)
 +     *     o  "slot=1 function=0" (up-to FreeBSD 10)
 +     */
 +
 +    ret = sscanf(sysctl_value, "pci%d:%d:%d:%d %*s",
 +        domain, bus, slot, function);
 +    if (ret == 4)
 +        return (0);
 +
 +    ret = sscanf(sysctl_value, "slot=%d function=%d %*s",
 +        slot, function);
 +    if (ret != 2)
 +        return (-1);
 +
 +    sprintf(sysctl_name, "dev.vgapci.%d.%%parent", i);
 +
 +    sysctl_value_len = sizeof(sysctl_value);
 +    memset(sysctl_value, 0, sysctl_value_len);
 +    ret = sysctlbyname(sysctl_name, sysctl_value,
 +        &sysctl_value_len, NULL, 0);
 +    if (ret != 0)
 +        return (-1);
 +
 +    ret = sscanf(sysctl_value, "pci%d", bus);
 +    if (ret != 1)
 +        return (-1);
 +
 +    /* FIXME: What domain to assume? */
 +    *domain = 0;
 +
 +    return (0);
 +}
 +
  int
  devq_device_get_pciid_from_fd(int fd,
      int *vendor_id, int *device_id)
 @@ -252,38 +304,17 @@ devq_device_get_pciid_from_fd(int fd,
       *     o  dev.vgapci.$m.%parent
       */
      for (i = 0; i < DEVQ_MAX_DEVS; ++i) {
 -        sprintf(sysctl_name, "dev.vgapci.%d.%%location", i);
 -
 -        sysctl_value_len = sizeof(sysctl_value);
 -        memset(sysctl_value, 0, sysctl_value_len);
 -        ret = sysctlbyname(sysctl_name, sysctl_value,
 -            &sysctl_value_len, NULL, 0);
 -        if (ret != 0)
 -            continue;
 +        int tmp_domain, tmp_bus, tmp_slot, tmp_function;
 
 -        int tmp_slot, tmp_function;
 -        ret = sscanf(sysctl_value, "slot=%d function=%d %*s",
 +        ret = devq_compare_vgapci_busaddr(i, &tmp_domain, &tmp_bus,
              &tmp_slot, &tmp_function);
 -        if (ret != 2 ||
 -            tmp_slot != slot || tmp_function != function)
 -            continue;
 -
 -        sprintf(sysctl_name, "dev.vgapci.%d.%%parent", i);
 -
 -        sysctl_value_len = sizeof(sysctl_value);
 -        memset(sysctl_value, 0, sysctl_value_len);
 -        ret = sysctlbyname(sysctl_name, sysctl_value,
 -            &sysctl_value_len, NULL, 0);
 -        if (ret != 0)
 -            continue;
 -
 -        int tmp_bus;
 -        ret = sscanf(sysctl_value, "pci%d",
 -            &tmp_bus);
 -        if (ret != 1 || tmp_bus != bus)
 -            continue;
 
 -        break;
 +        if (ret == 0 &&
 +            tmp_domain == domain &&
 +            tmp_bus == bus &&
 +            tmp_slot == slot &&
 +            tmp_function == function)
 +            break;
      }
 
      if (i == DEVQ_MAX_DEVS) {
 


Home | Main Index | Thread Index | Old Index