diff options
author | tnn <tnn@pkgsrc.org> | 2015-09-09 23:01:35 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2015-09-09 23:01:35 +0000 |
commit | 4eeb5115faf0ad03eb0cfe9baf5a677dca35a576 (patch) | |
tree | 8113f562b1f173e8af956af669c75e0822628fcf /devel/libdevq | |
parent | a640d92215b3d67039e54a27ccd1f353e4dac88f (diff) | |
download | pkgsrc-4eeb5115faf0ad03eb0cfe9baf5a677dca35a576.tar.gz |
Import libdevq-0.0.2 as devel/libdevq.
libdevq on FreeBSD and DragonFly partially substitutes for Linux's udev
enough to build features such as libgbm and drm egl on MesaLib.
Diffstat (limited to 'devel/libdevq')
-rw-r--r-- | devel/libdevq/DESCR | 2 | ||||
-rw-r--r-- | devel/libdevq/Makefile | 41 | ||||
-rw-r--r-- | devel/libdevq/PLIST | 6 | ||||
-rw-r--r-- | devel/libdevq/buildlink3.mk | 12 | ||||
-rw-r--r-- | devel/libdevq/distinfo | 7 | ||||
-rw-r--r-- | devel/libdevq/patches/patch-configure | 19 | ||||
-rw-r--r-- | devel/libdevq/patches/patch-src_device.c | 122 |
7 files changed, 209 insertions, 0 deletions
diff --git a/devel/libdevq/DESCR b/devel/libdevq/DESCR new file mode 100644 index 00000000000..58c589358ed --- /dev/null +++ b/devel/libdevq/DESCR @@ -0,0 +1,2 @@ +libdevq on FreeBSD and DragonFly partially substitutes for Linux's udev +enough to build features such as libgbm and drm egl on MesaLib. diff --git a/devel/libdevq/Makefile b/devel/libdevq/Makefile new file mode 100644 index 00000000000..d43c2582bd4 --- /dev/null +++ b/devel/libdevq/Makefile @@ -0,0 +1,41 @@ +# $NetBSD: Makefile,v 1.1 2015/09/09 23:01:35 tnn Exp $ + +# Original port from FreeBSD ports and DragonFly dports +# Created by: Koop Mast <kwm@FreeBSD.org> + +DISTNAME= libdevq-0.0.2 +CATEGORIES= devel + +MASTER_SITES= ${MASTER_SITE_FREEBSD} +MASTER_SITES+= http://rainbow-runner.nl/freebsd/ +EXTRACT_SUFX= .tar.xz + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://github.com/freebsd/libdevq +# See also: https://wiki.freebsd.org/Graphics +COMMENT= Generic Device Query and Monitor interface +LICENSE= 2-clause-bsd + +ONLY_FOR_PLATFORM= DragonFly-*-* FreeBSD-*-* + +USE_LIBTOOL= yes +GNU_CONFIGURE= yes + +PKGCONFIG_OVERRIDE+= src/libdevq-1.0.pc.in + +.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" diff --git a/devel/libdevq/PLIST b/devel/libdevq/PLIST new file mode 100644 index 00000000000..571ff90f74f --- /dev/null +++ b/devel/libdevq/PLIST @@ -0,0 +1,6 @@ +@comment $NetBSD: PLIST,v 1.1 2015/09/09 23:01:35 tnn Exp $ +${PLIST.diagnostic-bin}bin/devq-evwatch +${PLIST.diagnostic-bin}bin/devq-lsdri +include/libdevq.h +lib/libdevq.la +lib/pkgconfig/libdevq-1.0.pc diff --git a/devel/libdevq/buildlink3.mk b/devel/libdevq/buildlink3.mk new file mode 100644 index 00000000000..9bd0ded4011 --- /dev/null +++ b/devel/libdevq/buildlink3.mk @@ -0,0 +1,12 @@ +# $NetBSD: buildlink3.mk,v 1.1 2015/09/09 23:01:35 tnn Exp $ + +BUILDLINK_TREE+= libdevq + +.if !defined(LIBDEVQ_BUILDLINK3_MK) +LIBDEVQ_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.libdevq+= libdevq>=0.0.2 +BUILDLINK_PKGSRCDIR.libdevq?= ../../devel/libdevq +.endif # LIBDEVQ_BUILDLINK3_MK + +BUILDLINK_TREE+= -libdevq diff --git a/devel/libdevq/distinfo b/devel/libdevq/distinfo new file mode 100644 index 00000000000..cce99b8732b --- /dev/null +++ b/devel/libdevq/distinfo @@ -0,0 +1,7 @@ +$NetBSD: distinfo,v 1.1 2015/09/09 23:01:35 tnn Exp $ + +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 diff --git a/devel/libdevq/patches/patch-configure b/devel/libdevq/patches/patch-configure new file mode 100644 index 00000000000..88052af331c --- /dev/null +++ b/devel/libdevq/patches/patch-configure @@ -0,0 +1,19 @@ +$NetBSD: patch-configure,v 1.1 2015/09/09 23:01:35 tnn Exp $ + +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 + diff --git a/devel/libdevq/patches/patch-src_device.c b/devel/libdevq/patches/patch-src_device.c new file mode 100644 index 00000000000..fd3fbe2542c --- /dev/null +++ b/devel/libdevq/patches/patch-src_device.c @@ -0,0 +1,122 @@ +$NetBSD: patch-src_device.c,v 1.1 2015/09/09 23:01:35 tnn Exp $ + +From 7b48b8726b85eac66c1b164fab87d154be5aa068 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org> +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) { |