pkgsrc-WIP-changes archive

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

modular-xorg-server-dfbsd: Replace modular-xorg-server adding devd Free/DragonflyBSD



Module Name:	pkgsrc-wip
Committed By:	David Shao <davshao%gmail.com@localhost>
Pushed By:	dshao
Date:		Tue Jan 17 00:42:22 2017 -0800
Changeset:	d59d3f7cd6ec28ea3d43e811dd9cd7de768b377a

Modified Files:
	Makefile
Added Files:
	modular-xorg-server-dfbsd/DESCR
	modular-xorg-server-dfbsd/MESSAGE
	modular-xorg-server-dfbsd/Makefile
	modular-xorg-server-dfbsd/Makefile.common
	modular-xorg-server-dfbsd/PLIST
	modular-xorg-server-dfbsd/TODO
	modular-xorg-server-dfbsd/buildlink3.mk
	modular-xorg-server-dfbsd/distinfo
	modular-xorg-server-dfbsd/options.mk
	modular-xorg-server-dfbsd/patches/patch-config_config-backends.h
	modular-xorg-server-dfbsd/patches/patch-config_config.c
	modular-xorg-server-dfbsd/patches/patch-config_devd.c
	modular-xorg-server-dfbsd/patches/patch-configure
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Config.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Globals.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Xinput.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86pciBus.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86sbusBus.h
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_dri2_dri2.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_arm__video.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_i386__video.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bus_Sbus.c
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_xf86_OSproc.h
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os_support_bus_xf86Sbus.h
	modular-xorg-server-dfbsd/patches/patch-hw_xfree86_sdksyms.sh
	modular-xorg-server-dfbsd/patches/patch-os_xstrans.c

Log Message:
modular-xorg-server-dfbsd: Replace modular-xorg-server adding devd Free/DragonflyBSD

devd patches required on latest FreeBSD and DragonFly submitted in
pkg/50200 (x11/modular-xorg-server)
from FreeBSD ports / DragonFly dports.
Additional fixes for xorg server 1.19 fd poll API change.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=d59d3f7cd6ec28ea3d43e811dd9cd7de768b377a

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |   1 +
 modular-xorg-server-dfbsd/DESCR                    |   2 +
 modular-xorg-server-dfbsd/MESSAGE                  |  16 +
 modular-xorg-server-dfbsd/Makefile                 |  21 +
 modular-xorg-server-dfbsd/Makefile.common          | 186 +++++++
 modular-xorg-server-dfbsd/PLIST                    | 195 +++++++
 modular-xorg-server-dfbsd/TODO                     |   6 +
 modular-xorg-server-dfbsd/buildlink3.mk            |  50 ++
 modular-xorg-server-dfbsd/distinfo                 |  24 +
 modular-xorg-server-dfbsd/options.mk               |  89 ++++
 .../patches/patch-config_config-backends.h         |  15 +
 .../patches/patch-config_config.c                  |  25 +
 .../patches/patch-config_devd.c                    | 573 +++++++++++++++++++++
 modular-xorg-server-dfbsd/patches/patch-configure  |  16 +
 .../patches/patch-hw_xfree86_common_xf86Config.c   |  24 +
 .../patches/patch-hw_xfree86_common_xf86Globals.c  |  16 +
 .../patches/patch-hw_xfree86_common_xf86Xinput.c   |  14 +
 .../patches/patch-hw_xfree86_common_xf86pciBus.c   |  15 +
 .../patches/patch-hw_xfree86_common_xf86sbusBus.h  |  24 +
 .../patches/patch-hw_xfree86_dri2_dri2.c           |  40 ++
 .../patch-hw_xfree86_os-support_bsd_arm__video.c   |  24 +
 .../patch-hw_xfree86_os-support_bsd_bsd__VTsw.c    |  26 +
 .../patch-hw_xfree86_os-support_bsd_i386__video.c  |  14 +
 .../patches/patch-hw_xfree86_os-support_bus_Sbus.c | 172 +++++++
 .../patch-hw_xfree86_os-support_xf86_OSproc.h      |  15 +
 .../patch-hw_xfree86_os_support_bus_xf86Sbus.h     |  15 +
 .../patches/patch-hw_xfree86_sdksyms.sh            |  27 +
 .../patches/patch-os_xstrans.c                     |  21 +
 28 files changed, 1666 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 951a371..95c7a0d 100644
--- a/Makefile
+++ b/Makefile
@@ -1862,6 +1862,7 @@ SUBDIR+=	mmm-mode
 SUBDIR+=	mnogosearch
 SUBDIR+=	modglue
 SUBDIR+=	modplugplay
+SUBDIR+=	modular-xorg-server-dfbsd
 SUBDIR+=	moe
 SUBDIR+=	monajat
 SUBDIR+=	monkey-bubble
diff --git a/modular-xorg-server-dfbsd/DESCR b/modular-xorg-server-dfbsd/DESCR
new file mode 100644
index 0000000..232af80
--- /dev/null
+++ b/modular-xorg-server-dfbsd/DESCR
@@ -0,0 +1,2 @@
+The X.org X11 Server from the modularized source tree of
+X.org X11.
diff --git a/modular-xorg-server-dfbsd/MESSAGE b/modular-xorg-server-dfbsd/MESSAGE
new file mode 100644
index 0000000..095b3c6
--- /dev/null
+++ b/modular-xorg-server-dfbsd/MESSAGE
@@ -0,0 +1,16 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2014/12/29 07:55:23 dholland Exp $
+
+For the X server to run you need at least some fonts installed. The
+recommended approach is to install the entire modular-xorg-fonts
+meta-package, but failing that the minimum set required is:
+
+	fonts/font-alias
+	fonts/font-misc-misc
+	fonts/font-cursor-misc
+
+This package does *not* depend on these font packages directly as
+in some circumstances installing extra copies from pkgsrc would be
+redundant or possibly harmful.
+
+===========================================================================
diff --git a/modular-xorg-server-dfbsd/Makefile b/modular-xorg-server-dfbsd/Makefile
new file mode 100644
index 0000000..73a3f19
--- /dev/null
+++ b/modular-xorg-server-dfbsd/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.111 2016/11/16 10:14:36 wiz Exp $
+
+DISTNAME=	xorg-server-${XORG_VERSION}
+PKGNAME=	modular-${DISTNAME}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+COMMENT=	Modular X11 server from modular X.org
+
+SPECIAL_PERMS+=		bin/Xorg ${SETUID_ROOT_PERMS}
+
+NOT_FOR_PLATFORM=	Darwin-*-*
+
+.include "Makefile.common"
+
+CONFIGURE_ARGS+=	--enable-xorg
+CONFIGURE_ARGS+=	--disable-xephyr
+CONFIGURE_ARGS+=	--disable-kdrive
+
+.include "options.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/modular-xorg-server-dfbsd/Makefile.common b/modular-xorg-server-dfbsd/Makefile.common
new file mode 100644
index 0000000..85dda37
--- /dev/null
+++ b/modular-xorg-server-dfbsd/Makefile.common
@@ -0,0 +1,186 @@
+# $NetBSD: Makefile.common,v 1.14 2017/01/12 00:26:35 wiz Exp $
+# used by x11/modular-xorg-server/Makefile
+# used by x11/modular-xorg-xephyr/Makefile
+
+XORG_VERSION=	1.19.1
+CATEGORIES=	x11
+MASTER_SITES=	${MASTER_SITE_XORG:=xserver/}
+EXTRACT_SUFX=	.tar.bz2
+
+HOMEPAGE=	http://xorg.freedesktop.org/
+LICENSE=	mit AND modified-bsd AND x11 # with no-advertising clause
+
+GNU_CONFIGURE=	yes
+USE_LIBTOOL=	yes
+USE_TOOLS+=	gmake pkg-config
+USE_LANGUAGES+=	c99
+
+PKGCONFIG_OVERRIDE+=	xorg-server.pc.in
+SHLIBTOOL_OVERRIDE=	# empty
+
+BUILD_DEFS+=		VARBASE
+BUILD_DEFS_EFFECTS+=	XKB_OUTPUT_DIR
+
+OWN_DIRS+=		${VARBASE}/log
+OWN_DIRS+=		${XKB_OUTPUT_DIR}
+XKB_OUTPUT_DIR?=	${VARBASE}/db/xkb # XXX sync with xkeyboard-config
+
+CONFIGURE_ARGS+=	--localstatedir=${VARBASE:Q}
+CONFIGURE_ARGS+=	--with-xkb-output=${XKB_OUTPUT_DIR:Q}
+
+# .if !empty(USE_TOOLS:Mauto*)
+# TOOLS_DEPENDS+=	xorg-util-macros>=1.1.5:../../devel/xorg-util-macros
+# .endif
+
+DEPENDS+=	xkbcomp-[0-9]*:../../x11/xkbcomp
+DEPENDS+=	xkeyboard-config-[0-9]*:../../x11/xkeyboard-config
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "NetBSD"
+CPPFLAGS+=		-D_OPENBSD_SOURCE	# for reallocarray(3)
+CONFIGURE_ARGS+=	--with-builder-addr="tech-x11%NetBSD.org@localhost"
+CONFIGURE_ARGS+=	--with-os-vendor="The NetBSD Foundation"
+# TLS is not supported by NetBSD<6
+.  if !empty(OS_VERSION:M[0-5].*)
+CONFIGURE_ENV+=		ac_cv_tls=no
+CONFIGURE_ARGS+=	--disable-glx-tls
+.  endif
+.endif
+CONFIGURE_ARGS+=	--with-os-name=${MACHINE_PLATFORM:Q}
+
+CONFIGURE_ARGS+=	--with-fontrootdir=${PREFIX}/share/fonts/X11
+
+LEGACY_FONT_PATHS=
+DEFAULT_FONT_PATHS=
+.for f in misc TTF OTF Type1 100dpi 75dpi cyrillic
+DEFAULT_FONT_PATHS+=	${PREFIX}/share/fonts/X11/${f}
+LEGACY_FONT_PATHS+=	${PREFIX}/lib/X11/fonts/${f}
+.endfor
+FONT_PATHS=		${DEFAULT_FONT_PATHS} ${LEGACY_FONT_PATHS}
+
+CONFIGURE_ARGS+=	--with-default-font-path=${FONT_PATHS:ts,:Q}
+
+CONFIGURE_ARGS+=	--disable-config-hal
+CONFIGURE_ARGS+=	--disable-dmx
+CONFIGURE_ARGS+=	--disable-xwin
+CONFIGURE_ARGS+=	--disable-xephyr
+CONFIGURE_ARGS+=	--disable-kdrive
+#CONFIGURE_ARGS+=	--disable-kdrive-vesa
+CONFIGURE_ARGS+=	--disable-xfake
+CONFIGURE_ARGS+=	--disable-xfbdev
+CONFIGURE_ARGS+=	--enable-xtrans-send-fds
+
+CONFIGURE_ARGS+=	--with-int10=x86emu
+
+CONFIGURE_ENV+=		APP_MAN_SUFFIX=1 FILE_MAN_SUFFIX=5
+CONFIGURE_ENV+=		DRIVER_MAN_SUFFIX=4
+
+PLIST_VARS+=		sunos
+PLIST_SUBST+=		SUNOS_ARCH=${SUNOS_ARCH}
+
+.if ${OPSYS} == "SunOS"
+PLIST.sunos=		yes
+.  if ${MACHINE_ARCH} == "i386"
+SUNOS_ARCH=		ia32
+.  elif ${MACHINE_ARCH} == "x86_64"
+SUNOS_ARCH=		amd64
+.  elif ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64"
+SUNOS_ARCH=		sparcv8plus
+.  endif
+.endif
+
+PLIST_VARS+=		sparc
+.if !empty(MACHINE_ARCH:Msparc*)
+PLIST.sparc=		yes
+.endif
+
+# Workaround for PR#41556.
+# Avoid to use bsd_kqueue_apm, force to use bsd_apm instead.
+CONFIGURE_ENV.NetBSD+=	ac_cv_header_sys_event_h=no
+
+INSTALLATION_DIRS+=	lib/xorg/modules/drivers lib/xorg/modules/input
+
+BUILDLINK_API_DEPENDS.MesaLib+=		MesaLib>=7.8.0
+BUILDLINK_API_DEPENDS.compositeproto+=	compositeproto>=0.4
+BUILDLINK_API_DEPENDS.fixesproto+=	fixesproto>=5.0
+BUILDLINK_API_DEPENDS.damageproto+=	damageproto>=1.1
+BUILDLINK_API_DEPENDS.xcmiscproto+=	xcmiscproto>=1.2.0
+BUILDLINK_API_DEPENDS.xtrans+=		xtrans>=1.2.2
+BUILDLINK_API_DEPENDS.bigreqsproto+=	bigreqsproto>=1.1.0
+BUILDLINK_API_DEPENDS.xproto+=		xproto>=7.0.31
+BUILDLINK_API_DEPENDS.xextproto+=	xextproto>=7.1.99
+BUILDLINK_API_DEPENDS.recordproto+=	recordproto>=1.13.99.1
+BUILDLINK_API_DEPENDS.scrnsaverproto+=	scrnsaverproto>=1.1
+BUILDLINK_API_DEPENDS.resourceproto+=	resourceproto>=1.2.0
+BUILDLINK_API_DEPENDS.dri+=		dri>=7.8
+BUILDLINK_API_DEPENDS.xfont+=		xfont>=1.4.2
+BUILDLINK_API_DEPENDS.glproto+=		glproto>=1.4.16
+BUILDLINK_API_DEPENDS.inputproto+=	inputproto>=2.1.99.6
+BUILDLINK_API_DEPENDS.kbproto+=		kbproto>=1.0.3
+BUILDLINK_API_DEPENDS.pixman+=		pixman>=0.21.8
+BUILDLINK_API_DEPENDS.randrproto+=	randrproto>=1.5.0
+BUILDLINK_API_DEPENDS.renderproto+=	renderproto>=0.11
+BUILDLINK_API_DEPENDS.xf86dgaproto+=	xf86dgaproto>=2.0.3
+BUILDLINK_API_DEPENDS.xf86driproto+=	xf86driproto>=2.1.0
+
+BUILD_DEPENDS+=		tradcpp-[0-9]*:../../devel/tradcpp
+CONFIGURE_ENV+=		ac_cv_path_RAWCPP="${PREFIX}/bin/tradcpp -Uunix"
+
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD" || ${OPSYS} == "Bitrig" || ${OPSYS} == "MirBSD"
+CONFIGURE_ARGS+=	--with-sha1=libc
+.else
+.include "../../security/nettle/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-sha1=libnettle
+.endif
+
+.include "../../devel/xorg-util-macros/buildlink3.mk"
+
+.include "../../devel/ncurses/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../fonts/libfontenc/buildlink3.mk"
+BUILDLINK_API_DEPENDS.libpciaccess+=	libpciaccess>=0.11.0
+BUILDLINK_DEPMETHOD.libpciaccess=	full
+.include "../../sysutils/libpciaccess/buildlink3.mk"
+.include "../../x11/bigreqsproto/buildlink3.mk"
+.include "../../x11/compositeproto/buildlink3.mk"
+.include "../../x11/damageproto/buildlink3.mk"
+.include "../../x11/evieext/buildlink3.mk"
+.include "../../x11/fixesproto/buildlink3.mk"
+.include "../../x11/fontsproto/buildlink3.mk"
+.include "../../x11/inputproto/buildlink3.mk"
+.include "../../x11/libX11/buildlink3.mk"
+.include "../../x11/libXau/buildlink3.mk"
+.include "../../x11/libXaw/buildlink3.mk"
+.include "../../x11/libXdmcp/buildlink3.mk"
+BUILDLINK_API_DEPENDS.libXext+=	libXext>=1.1.1
+.include "../../x11/libXext/buildlink3.mk"
+.include "../../x11/libXfixes/buildlink3.mk"
+.include "../../x11/libXfont2/buildlink3.mk"
+.include "../../x11/libXmu/buildlink3.mk"
+.include "../../x11/libXpm/buildlink3.mk"
+.include "../../x11/libXt/buildlink3.mk"
+.include "../../x11/libXxf86misc/buildlink3.mk"
+.include "../../x11/libXxf86vm/buildlink3.mk"
+.include "../../x11/libXinerama/buildlink3.mk"
+.include "../../x11/libxkbfile/buildlink3.mk"
+.include "../../x11/libxkbui/buildlink3.mk"
+.include "../../x11/pixman/buildlink3.mk"
+.include "../../x11/randrproto/buildlink3.mk"
+.include "../../x11/recordproto/buildlink3.mk"
+.include "../../x11/renderproto/buildlink3.mk"
+.include "../../x11/resourceproto/buildlink3.mk"
+.include "../../x11/scrnsaverproto/buildlink3.mk"
+.include "../../x11/trapproto/buildlink3.mk"
+.include "../../x11/videoproto/buildlink3.mk"
+.include "../../x11/xcmiscproto/buildlink3.mk"
+.include "../../x11/xextproto/buildlink3.mk"
+.include "../../x11/kbproto/buildlink3.mk"
+.include "../../x11/xcb-util-keysyms/buildlink3.mk"
+.include "../../x11/xf86bigfontproto/buildlink3.mk"
+.include "../../x11/xf86dgaproto/buildlink3.mk"
+.include "../../x11/xf86miscproto/buildlink3.mk"
+.include "../../x11/xf86vidmodeproto/buildlink3.mk"
+.include "../../x11/xineramaproto/buildlink3.mk"
+.include "../../x11/xproto/buildlink3.mk"
+.include "../../x11/xtrans/buildlink3.mk"
diff --git a/modular-xorg-server-dfbsd/PLIST b/modular-xorg-server-dfbsd/PLIST
new file mode 100644
index 0000000..2d1a237
--- /dev/null
+++ b/modular-xorg-server-dfbsd/PLIST
@@ -0,0 +1,195 @@
+@comment $NetBSD: PLIST,v 1.27 2016/11/16 10:14:36 wiz Exp $
+bin/X
+bin/Xnest
+bin/Xorg
+bin/Xvfb
+bin/cvt
+bin/gtf
+include/xorg/BT.h
+include/xorg/IBM.h
+include/xorg/TI.h
+include/xorg/XIstubs.h
+include/xorg/Xprintf.h
+include/xorg/callback.h
+include/xorg/client.h
+include/xorg/closestr.h
+include/xorg/closure.h
+include/xorg/colormap.h
+include/xorg/colormapst.h
+include/xorg/compiler.h
+include/xorg/compositeext.h
+include/xorg/cursor.h
+include/xorg/cursorstr.h
+include/xorg/damage.h
+include/xorg/damagestr.h
+include/xorg/dbestruct.h
+include/xorg/dgaproc.h
+include/xorg/displaymode.h
+include/xorg/dix.h
+include/xorg/dixaccess.h
+include/xorg/dixevents.h
+include/xorg/dixfont.h
+include/xorg/dixfontstr.h
+include/xorg/dixgrabs.h
+include/xorg/dixstruct.h
+${PLIST.dri}include/xorg/dri.h
+${PLIST.dri}include/xorg/dri2.h
+${PLIST.dri}include/xorg/dri3.h
+${PLIST.dri}include/xorg/dristruct.h
+include/xorg/edid.h
+include/xorg/events.h
+include/xorg/exa.h
+include/xorg/exevents.h
+include/xorg/extension.h
+include/xorg/extinit.h
+include/xorg/extnsionst.h
+include/xorg/fb.h
+include/xorg/fbdevhw.h
+include/xorg/fboverlay.h
+include/xorg/fbpict.h
+include/xorg/fbrop.h
+include/xorg/fourcc.h
+include/xorg/gc.h
+include/xorg/gcstruct.h
+include/xorg/geext.h
+include/xorg/geint.h
+${PLIST.dri}include/xorg/glamor.h
+include/xorg/globals.h
+include/xorg/glx_extinit.h
+include/xorg/glyphstr.h
+include/xorg/hotplug.h
+include/xorg/i2c_def.h
+include/xorg/input.h
+include/xorg/inputstr.h
+include/xorg/list.h
+include/xorg/mi.h
+include/xorg/micmap.h
+include/xorg/micoord.h
+include/xorg/migc.h
+include/xorg/miline.h
+include/xorg/mioverlay.h
+include/xorg/mipict.h
+include/xorg/mipointer.h
+include/xorg/mipointrst.h
+include/xorg/misc.h
+include/xorg/miscstruct.h
+include/xorg/mistruct.h
+include/xorg/misync.h
+include/xorg/misyncfd.h
+include/xorg/misyncshm.h
+include/xorg/misyncstr.h
+include/xorg/mizerarc.h
+include/xorg/nonsdk_extinit.h
+include/xorg/opaque.h
+include/xorg/optionstr.h
+include/xorg/os.h
+include/xorg/panoramiX.h
+include/xorg/panoramiXsrv.h
+include/xorg/picture.h
+include/xorg/picturestr.h
+include/xorg/pixmap.h
+include/xorg/pixmapstr.h
+${PLIST.dri}include/xorg/present.h
+${PLIST.dri}include/xorg/presentext.h
+include/xorg/privates.h
+include/xorg/property.h
+include/xorg/propertyst.h
+include/xorg/ptrveloc.h
+include/xorg/randrstr.h
+include/xorg/region.h
+include/xorg/regionstr.h
+include/xorg/registry.h
+include/xorg/resource.h
+include/xorg/rgb.h
+include/xorg/rrtransform.h
+${PLIST.dri}include/xorg/sarea.h
+include/xorg/screenint.h
+include/xorg/scrnintstr.h
+include/xorg/selection.h
+include/xorg/servermd.h
+include/xorg/shadow.h
+include/xorg/shadowfb.h
+include/xorg/shmint.h
+include/xorg/site.h
+${PLIST.sunos}include/xorg/solaris-${SUNOS_ARCH}.il
+include/xorg/syncsdk.h
+include/xorg/validate.h
+include/xorg/vbe.h
+include/xorg/vbeModes.h
+include/xorg/vgaHW.h
+include/xorg/wfbrename.h
+include/xorg/window.h
+include/xorg/windowstr.h
+include/xorg/xaarop.h
+include/xorg/xace.h
+include/xorg/xacestr.h
+include/xorg/xf86.h
+include/xorg/xf86Crtc.h
+include/xorg/xf86Cursor.h
+include/xorg/xf86DDC.h
+include/xorg/xf86Modes.h
+include/xorg/xf86Module.h
+include/xorg/xf86Opt.h
+include/xorg/xf86Optionstr.h
+include/xorg/xf86Optrec.h
+include/xorg/xf86Parser.h
+include/xorg/xf86Pci.h
+include/xorg/xf86PciInfo.h
+include/xorg/xf86Priv.h
+include/xorg/xf86Privstr.h
+include/xorg/xf86RamDac.h
+include/xorg/xf86RandR12.h
+${PLIST.sparc}include/xorg/xf86Sbus.h
+include/xorg/xf86VGAarbiter.h
+include/xorg/xf86Xinput.h
+include/xorg/xf86_OSlib.h
+include/xorg/xf86_OSproc.h
+include/xorg/xf86cmap.h
+include/xorg/xf86fbman.h
+include/xorg/xf86i2c.h
+include/xorg/xf86int10.h
+include/xorg/xf86platformBus.h
+include/xorg/xf86sbusBus.h
+include/xorg/xf86str.h
+include/xorg/xf86xv.h
+include/xorg/xf86xvmc.h
+include/xorg/xf86xvpriv.h
+include/xorg/xisb.h
+include/xorg/xkbfile.h
+include/xorg/xkbrules.h
+include/xorg/xkbsrv.h
+include/xorg/xkbstr.h
+include/xorg/xorg-server.h
+include/xorg/xorgVersion.h
+include/xorg/xserver-properties.h
+include/xorg/xserver_poll.h
+include/xorg/xvdix.h
+include/xorg/xvmcext.h
+lib/pkgconfig/xorg-server.pc
+${PLIST.dri}lib/xorg/modules/drivers/modesetting_drv.la
+${PLIST.dri}lib/xorg/modules/extensions/libglx.la
+lib/xorg/modules/libexa.la
+lib/xorg/modules/libfb.la
+lib/xorg/modules/libfbdevhw.la
+${PLIST.dri}lib/xorg/modules/libglamoregl.la
+lib/xorg/modules/libint10.la
+lib/xorg/modules/libshadow.la
+lib/xorg/modules/libshadowfb.la
+lib/xorg/modules/libvbe.la
+lib/xorg/modules/libvgahw.la
+lib/xorg/modules/libwfb.la
+lib/xorg/protocol.txt
+man/man1/Xnest.1
+man/man1/Xorg.1
+man/man1/Xserver.1
+man/man1/Xvfb.1
+man/man1/cvt.1
+man/man1/gtf.1
+man/man4/exa.4
+man/man4/fbdevhw.4
+${PLIST.dri}man/man4/modesetting.4
+man/man5/xorg.conf.5
+man/man5/xorg.conf.d.5
+share/aclocal/xorg-server.m4
+${PLIST.dtrace}share/doc/xorg-server/Xserver-DTrace.xml
+@pkgdir lib/xorg/modules/input
diff --git a/modular-xorg-server-dfbsd/TODO b/modular-xorg-server-dfbsd/TODO
new file mode 100644
index 0000000..9efedeb
--- /dev/null
+++ b/modular-xorg-server-dfbsd/TODO
@@ -0,0 +1,6 @@
+Copy port to x11/modular-xorg-server, do not install from wip.
+
+Waiting for devd patches required on latest FreeBSD and DragonFly
+submitted in
+pkg/50200 (x11/modular-xorg-server)
+to be accepted.
diff --git a/modular-xorg-server-dfbsd/buildlink3.mk b/modular-xorg-server-dfbsd/buildlink3.mk
new file mode 100644
index 0000000..417e7a1
--- /dev/null
+++ b/modular-xorg-server-dfbsd/buildlink3.mk
@@ -0,0 +1,50 @@
+# $NetBSD: buildlink3.mk,v 1.20 2017/01/07 22:34:56 maya Exp $
+
+BUILDLINK_TREE+=	modular-xorg-server
+
+.if !defined(MODULAR_XORG_SERVER_BUILDLINK3_MK)
+MODULAR_XORG_SERVER_BUILDLINK3_MK:=
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+USE_OLD_MODULAR_XORG_SERVER?=	no
+
+.if !empty(USE_OLD_MODULAR_XORG_SERVER:M[yY][eE][sS])
+BUILDLINK_API_DEPENDS.modular-xorg-server+=	modular-xorg-server>=1.12.4nb12<1.17
+BUILDLINK_PKGSRCDIR.modular-xorg-server?=	../../x11/modular-xorg-server112
+.else
+BUILDLINK_API_DEPENDS.modular-xorg-server+=	modular-xorg-server>=1.18
+BUILDLINK_PKGSRCDIR.modular-xorg-server?=	../../x11/modular-xorg-server
+.endif
+
+BUILDLINK_DEPMETHOD.libpciaccess=	full
+.include "../../sysutils/libpciaccess/buildlink3.mk"
+.include "../../x11/pixman/buildlink3.mk"
+
+.include "../../x11/compositeproto/buildlink3.mk"
+.include "../../x11/dri2proto/buildlink3.mk"
+.include "../../x11/dri3proto/buildlink3.mk"
+.include "../../x11/fontsproto/buildlink3.mk"
+.if !empty(USE_OLD_MODULAR_XORG_SERVER:M[yY][eE][sS])
+.include "../../graphics/MesaLib7/buildlink3.mk" # XXX should not be needed for non-dri build
+.include "../../x11/libXfont/buildlink3.mk"
+.else
+.include "../../x11/libXfont2/buildlink3.mk"
+.include "../../graphics/MesaLib/buildlink3.mk" # XXX should not be needed for non-dri build
+.include "../../x11/resourceproto/buildlink3.mk"
+.include "../../x11/scrnsaverproto/buildlink3.mk"
+.include "../../x11/presentproto/buildlink3.mk"
+.endif
+.include "../../x11/inputproto/buildlink3.mk"
+BUILDLINK_API_DEPENDS.randrproto+=	randrproto>=1.5.0
+.include "../../x11/randrproto/buildlink3.mk"
+.include "../../x11/renderproto/buildlink3.mk"
+.include "../../x11/videoproto/buildlink3.mk"
+.include "../../x11/xextproto/buildlink3.mk"
+.include "../../x11/xf86driproto/buildlink3.mk"
+BUILDLINK_API_DEPENDS.xproto+=		xproto>=7.0.31
+.include "../../x11/xproto/buildlink3.mk"
+.include "../../x11/xineramaproto/buildlink3.mk"
+.endif # MODULAR_XORG_SERVER_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-modular-xorg-server
diff --git a/modular-xorg-server-dfbsd/distinfo b/modular-xorg-server-dfbsd/distinfo
new file mode 100644
index 0000000..818dba3
--- /dev/null
+++ b/modular-xorg-server-dfbsd/distinfo
@@ -0,0 +1,24 @@
+$NetBSD: distinfo,v 1.80 2017/01/12 00:26:35 wiz Exp $
+
+SHA1 (xorg-server-1.19.1.tar.bz2) = 13c81e0ebb6ac1359a611d0503805c6dc0315477
+RMD160 (xorg-server-1.19.1.tar.bz2) = 6434b1b6946a84ba5a829556ea8cfdf60a510863
+SHA512 (xorg-server-1.19.1.tar.bz2) = 37d413fdd96ce6b15ae20ca5028331498586044cfc7a6ab0acb99201b04063c69bcd06867f2dc33237b244ce2870a1c5a4be3cbe4560f2461894f46f8d5dbdd7
+Size (xorg-server-1.19.1.tar.bz2) = 6041792 bytes
+SHA1 (patch-config_config-backends.h) = f44868caa51e972a76949f73ac6083640af2c351
+SHA1 (patch-config_config.c) = 5a3fe4cb6c2170335ab547f438386cff77a9c152
+SHA1 (patch-config_devd.c) = 99b7e1885b5a87b81bbb5f4ef822188aa0710bd1
+SHA1 (patch-configure) = b3c5ae8cd7aca96dbb5a237dda061e8c2569b2f2
+SHA1 (patch-hw_xfree86_common_xf86Config.c) = 7964ac8d32d4fcea113c8950661ab921c63ad9d0
+SHA1 (patch-hw_xfree86_common_xf86Globals.c) = 870100ea740b2c0bc1261355d3fcdf17ec50f64f
+SHA1 (patch-hw_xfree86_common_xf86Xinput.c) = d3cfebf67740c03883b0e65b0adb307f5e9c0fe1
+SHA1 (patch-hw_xfree86_common_xf86pciBus.c) = 896825ba12646431cba603938d118acbdde305dd
+SHA1 (patch-hw_xfree86_common_xf86sbusBus.h) = f56f87336b2f669413ebb1005a2b64568a111f92
+SHA1 (patch-hw_xfree86_dri2_dri2.c) = 0bf58305059321e10f6f58186301dbb7cb858c2a
+SHA1 (patch-hw_xfree86_os-support_bsd_arm__video.c) = 9c03b24f44eafc5fabe27e9d6cc6c54b607e47c3
+SHA1 (patch-hw_xfree86_os-support_bsd_bsd__VTsw.c) = 90343f694c27a6fdd5070e1167687943bd056a99
+SHA1 (patch-hw_xfree86_os-support_bsd_i386__video.c) = f2c72562a40c0e3109991453aff9c2c082526b1b
+SHA1 (patch-hw_xfree86_os-support_bus_Sbus.c) = 0035b970bdae1bab51b8ca6bfeed060ec4df3a60
+SHA1 (patch-hw_xfree86_os-support_xf86_OSproc.h) = e1c049857893d2f050d5fb297a3e8ef86f0b1d7e
+SHA1 (patch-hw_xfree86_os_support_bus_xf86Sbus.h) = 0e0a243b737f8f762c9f8f24a2265d1b6aefb544
+SHA1 (patch-hw_xfree86_sdksyms.sh) = c403149ad35ffb70ee44f70de94b4497b751c118
+SHA1 (patch-os_xstrans.c) = 489a4f4b226ecd361b922895204fb9041b065d4e
diff --git a/modular-xorg-server-dfbsd/options.mk b/modular-xorg-server-dfbsd/options.mk
new file mode 100644
index 0000000..7f6f517
--- /dev/null
+++ b/modular-xorg-server-dfbsd/options.mk
@@ -0,0 +1,89 @@
+# $NetBSD: options.mk,v 1.16 2016/11/22 16:02:54 wiz Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.modular-xorg-server
+PKG_SUPPORTED_OPTIONS=	inet6 debug dtrace
+PKG_SUPPORTED_OPTIONS+=	devd
+PKG_SUGGESTED_OPTIONS=	inet6
+.if ${X11_TYPE} == "modular"
+PKG_SUPPORTED_OPTIONS+=	dri
+PKG_SUGGESTED_OPTIONS+=	dri
+.endif
+
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+= devd
+.endif
+
+# Enabled in FreeBSD ports / DragonFly dports
+CONFIGURE_ARGS+=	--enable-record=yes
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+=		dri dtrace
+
+.if !empty(PKG_OPTIONS:Mdri)
+.include "../../graphics/libepoxy/buildlink3.mk"
+BUILDLINK_API_DEPENDS.MesaLib+=	MesaLib>=11
+.include "../../graphics/MesaLib/buildlink3.mk"
+.include "../../x11/glproto/buildlink3.mk"
+.include "../../x11/dri2proto/buildlink3.mk"
+.include "../../x11/dri3proto/buildlink3.mk"
+.include "../../x11/libdrm/buildlink3.mk"
+.include "../../x11/libxshmfence/buildlink3.mk"
+.include "../../x11/presentproto/buildlink3.mk"
+.include "../../x11/xf86driproto/buildlink3.mk"
+PLIST.dri=		yes
+CONFIGURE_ARGS+=	--enable-dri
+CONFIGURE_ARGS+=	--enable-dri2
+CONFIGURE_ARGS+=	--enable-dri3
+CONFIGURE_ARGS+=	--enable-glx
+CONFIGURE_ARGS+=	--enable-glamor
+CONFIGURE_ARGS+=	--enable-present
+.else
+###
+### XXX Perhaps we should allow for a built-in glx without dri enabled?
+###
+CONFIGURE_ARGS+=	--disable-dri
+CONFIGURE_ARGS+=	--disable-dri2
+CONFIGURE_ARGS+=	--disable-dri3
+CONFIGURE_ARGS+=	--disable-glx
+CONFIGURE_ARGS+=	--disable-present
+pre-build: disable-modesetting
+.PHONY: disable-modesetting
+disable-modesetting:
+	(${ECHO} "all:"; ${ECHO} "install:") > ${WRKSRC}/hw/xfree86/drivers/modesetting/Makefile
+.endif
+
+.if !empty(PKG_OPTIONS:Minet6)
+CONFIGURE_ARGS+=	--enable-ipv6
+.else
+CONFIGURE_ARGS+=	--disable-ipv6
+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CONFIGURE_ARGS+=	--enable-debug
+# Debug flags -O0 -g3 recommended by: 
+# https://www.x.org/wiki/Development/Documentation/ServerDebugging/
+# CFLAGS+=		-ggdb
+CFLAGS+=		-O0 -g3
+.endif
+
+.if !empty(PKG_OPTIONS:Mdtrace)
+PLIST.dtrace=		yes
+CONFIGURE_ARGS+=	--with-dtrace
+.else
+CONFIGURE_ARGS+=	--without-dtrace
+.endif
+
+.if !empty(PKG_OPTIONS:Mdevd)
+SUBST_CLASSES+=			devd_config
+SUBST_STAGE.devd_config=	pre-build
+SUBST_MESSAGE.devd_config=	Patching config/Makefile for devd
+SUBST_FILES.devd_config+=	config/Makefile
+SUBST_SED.devd_config+=		-e 's|config\.c|config.c devd.c|g'
+SUBST_SED.devd_config+=		-e 's|config\.lo|config.lo devd.lo|g'
+SUBST_CLASSES+=			devd_dix
+SUBST_STAGE.devd_dix=		post-configure
+SUBST_MESSAGE.devd_dix=		Patching include/dix-config.h for devd 
+SUBST_FILES.devd_dix+=		include/dix-config.h	
+SUBST_SED.devd_dix+=		-e 's|/\* \#undef CONFIG_UDEV \*/|\#define CONFIG_DEVD 1 |'
+.endif
diff --git a/modular-xorg-server-dfbsd/patches/patch-config_config-backends.h b/modular-xorg-server-dfbsd/patches/patch-config_config-backends.h
new file mode 100644
index 0000000..e92f688
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-config_config-backends.h
@@ -0,0 +1,15 @@
+$NetBSD$
+
+devd support to detect devices from FreeBSD ports / DragonFly dports
+
+--- config/config-backends.h.orig	2015-05-21 14:23:54.000000000 +0000
++++ config/config-backends.h
+@@ -44,3 +44,8 @@ void config_hal_fini(void);
+ int config_wscons_init(void);
+ void config_wscons_fini(void);
+ #endif
++
++#ifdef CONFIG_DEVD
++int config_devd_init(void);
++void config_devd_fini(void);
++#endif
diff --git a/modular-xorg-server-dfbsd/patches/patch-config_config.c b/modular-xorg-server-dfbsd/patches/patch-config_config.c
new file mode 100644
index 0000000..1990a50
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-config_config.c
@@ -0,0 +1,25 @@
+$NetBSD$
+
+devd support to detect devices from FreeBSD ports / DragonFly dports
+
+--- config/config.c.orig	2015-07-18 23:39:56.348775000 +0000
++++ config/config.c
+@@ -55,6 +55,9 @@ config_init(void)
+ #elif defined(CONFIG_WSCONS)
+     if (!config_wscons_init())
+         ErrorF("[config] failed to initialise wscons\n");
++#elif defined(CONFIG_DEVD)
++    if (!config_devd_init())
++        ErrorF("[config] failed to initialise devd\n");
+ #endif
+ }
+ 
+@@ -67,6 +70,8 @@ config_fini(void)
+     config_hal_fini();
+ #elif defined(CONFIG_WSCONS)
+     config_wscons_fini();
++#elif defined(CONFIG_DEVD)
++    config_devd_fini();
+ #endif
+ }
+ 
diff --git a/modular-xorg-server-dfbsd/patches/patch-config_devd.c b/modular-xorg-server-dfbsd/patches/patch-config_devd.c
new file mode 100644
index 0000000..1553ac1
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-config_devd.c
@@ -0,0 +1,573 @@
+$NetBSD$
+
+devd support to detect devices from FreeBSD ports / DragonFly dports
+
+Further fix to use SetNotifyFd / RemoveNotifyFd
+
+--- config/devd.c.orig	2016-11-19 17:36:01.195812000 +0000
++++ config/devd.c
+@@ -0,0 +1,564 @@
++/*
++ * Copyright (c) 2012 Baptiste Daroussin
++ * Copyright (c) 2013, 2014 Alex Kozlov
++ * Copyright (c) 2014 Robert Millan
++ * Copyright (c) 2014 Jean-Sebastien Pedron
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the next
++ * paragraph) shall be included in all copies or substantial portions of the
++ * Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Author: Baptiste Daroussin <bapt%FreeBSD.org@localhost>
++ */
++
++#ifdef HAVE_DIX_CONFIG_H
++#include <dix-config.h>
++#endif
++
++#ifdef CONFIG_DEVD
++
++#include <sys/types.h>
++#include <sys/kbio.h>
++#include <sys/socket.h>
++#include <sys/stat.h>
++#include <sys/sysctl.h>
++#include <sys/un.h>
++
++#include <ctype.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <stdbool.h>
++#include <unistd.h>
++
++#include "input.h"
++#include "inputstr.h"
++#include "hotplug.h"
++#include "config-backends.h"
++#include "os.h"
++
++#define DEVD_SOCK_PATH "/var/run/devd.pipe"
++
++#define DEVD_EVENT_ADD		'+'
++#define DEVD_EVENT_REMOVE	'-'
++
++#define RECONNECT_DELAY		5 * 1000
++
++static int sock_devd;
++static bool is_console_kbd = false;
++static bool is_kbdmux = false;
++OsTimerPtr rtimer;
++
++struct hw_type {
++	const char *driver;
++	int flag;
++	const char *xdriver;
++};
++
++static struct hw_type hw_types[] = {
++	{ "ukbd", ATTR_KEYBOARD, "kbd" },
++	{ "atkbd", ATTR_KEYBOARD, "kbd" },
++	{ "kbdmux", ATTR_KEYBOARD, "kbd" },
++	{ "sysmouse", ATTR_POINTER, "mouse" },
++	{ "ums", ATTR_POINTER, "mouse" },
++	{ "psm", ATTR_POINTER, "mouse" },
++	{ "vboxguest", ATTR_POINTER, "vboxmouse" },
++	{ "joy", ATTR_JOYSTICK, NULL },
++	{ "atp", ATTR_TOUCHPAD, NULL },
++	{ "uep", ATTR_TOUCHSCREEN, NULL },
++	{ NULL, -1, NULL },
++};
++
++static bool
++sysctl_exists(const struct hw_type *device, int unit,
++	char *devname, size_t devname_len)
++{
++	char sysctlname[PATH_MAX];
++	size_t len;
++	int ret;
++
++	if (device == NULL || device->driver == NULL)
++		return false;
++
++	/* Check if a sysctl exists. */
++	snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc",
++	    device->driver, unit);
++	ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0);
++
++	if (ret == 0 && len > 0) {
++		snprintf(devname, devname_len, "%s%i", device->driver, unit);
++		return true;
++	}
++
++	return false;
++}
++
++static bool
++devpath_exists(const struct hw_type *device,
++	char *devname, size_t devname_len)
++{
++	char *devpath;
++	struct stat st;
++	int ret;
++
++	if (device == NULL || device->driver == NULL)
++		return false;
++
++	/* Check if /dev/$driver exists. */
++	asprintf(&devpath, "/dev/%s", device->driver);
++	if (devpath == NULL)
++		return false;
++
++	ret = stat(devpath, &st);
++	free(devpath);
++
++	if (ret == 0) {
++		strncpy(devname, device->driver, devname_len);
++		return true;
++	}
++
++	return false;
++}
++
++static char *
++sysctl_get_str(const char *sysctlname)
++{
++	char *dest = NULL;
++	size_t len;
++
++	if (sysctlname == NULL)
++		return NULL;
++
++	if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) {
++		dest = malloc(len + 1);
++		if (dest) {
++			if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0)
++				dest[len] = '\0';
++			else {
++				free(dest);
++				dest = NULL;
++			}
++		}
++	}
++
++	return dest;
++}
++
++static void
++device_added(const char *devname)
++{
++	char path[PATH_MAX];
++	char sysctlname[PATH_MAX];
++	char *vendor;
++	char *product = NULL;
++	char *config_info = NULL;
++	char *walk;
++	InputOption *options = NULL;
++	InputAttributes attrs = { };
++	DeviceIntPtr dev = NULL;
++	int i;
++	int fd;
++
++	for (i = 0; hw_types[i].driver != NULL; i++) {
++		size_t len;
++
++		len = strlen(hw_types[i].driver);
++		if (strcmp(devname, hw_types[i].driver) == 0 ||
++			(strncmp(devname, hw_types[i].driver, len) == 0 &&
++				isnumber(*(devname + len)))) {
++			attrs.flags |= hw_types[i].flag;
++			break;
++		}
++	}
++
++	if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) {
++		LogMessage(X_INFO, "config/devd: ignoring device %s\n",
++				devname);
++		return;
++	}
++
++	/* Skip keyboard devices if kbdmux is enabled */
++	if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) {
++		LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n",
++				devname);
++		return;
++	}
++
++	snprintf(path, sizeof(path), "/dev/%s", devname);
++
++	options = input_option_new(NULL, "_source", "server/devd");
++	if (!options)
++		return;
++
++	snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc",
++	    hw_types[i].driver, devname + strlen(hw_types[i].driver));
++	vendor = sysctl_get_str(sysctlname);
++	if (vendor == NULL) {
++		options = input_option_new(options, "name", devname);
++	}
++	else {
++		if ((walk = strchr(vendor, ' ')) != NULL) {
++			walk[0] = '\0';
++			walk++;
++			product = walk;
++			if ((walk = strchr(product, ',')) != NULL)
++				walk[0] = '\0';
++		}
++
++		attrs.vendor = strdup(vendor);
++		if (product) {
++			attrs.product = strdup(product);
++			options = input_option_new(options, "name", product);
++		}
++		else
++			options = input_option_new(options, "name", "(unnamed)");
++
++		free(vendor);
++	}
++
++	/* XXX implement usb_id */
++	attrs.usb_id = NULL;
++	attrs.device = strdup(path);
++	options = input_option_new(options, "driver", hw_types[i].xdriver);
++
++	fd = open(path, O_RDONLY);
++	if (fd > 0) {
++		close(fd);
++		options = input_option_new(options, "device", path);
++	}
++	else {
++		if (attrs.flags & ~ATTR_KEYBOARD) {
++			LogMessage(X_INFO, "config/devd: device %s already opened\n",
++					 path);
++
++			/*
++			 * Fail if cannot open device, it breaks AllowMouseOpenFail,
++			 * but it should not matter when config/devd enabled
++			 */
++			goto unwind;
++		}
++
++		if (is_console_kbd) {
++			/*
++			 * There can be only one keyboard attached to console and
++			 * it is already added.
++			 */
++			LogMessage(X_WARNING, "config/devd: console keyboard is "
++					"already added, ignoring %s (%s)\n",
++					attrs.product, path);
++			goto unwind;
++		}
++		else
++			/*
++			 * Don't pass "device" option if the keyboard is already
++			 * attached to the console (ie. open() fails).
++			 * This would activate a special logic in xf86-input-keyboard.
++			 * Prevent any other attached to console keyboards being
++			 * processed. There can be only one such device.
++			 */
++			is_console_kbd = true;
++	}
++
++	if (asprintf(&config_info, "devd:%s", devname) == -1) {
++		config_info = NULL;
++		goto unwind;
++	}
++
++	if (device_is_duplicate(config_info)) {
++		LogMessage(X_WARNING, "config/devd: device %s (%s) already added. "
++				"ignoring\n", attrs.product, path);
++		goto unwind;
++	}
++
++	options = input_option_new(options, "config_info", config_info);
++	LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n",
++			attrs.product, path);
++
++	NewInputDeviceRequest(options, &attrs, &dev);
++
++unwind:
++	free(config_info);
++	input_option_free_list(&options);
++	free(attrs.usb_id);
++	free(attrs.product);
++	free(attrs.device);
++	free(attrs.vendor);
++}
++
++static void
++device_removed(char *devname)
++{
++	char *config_info;
++
++	if (asprintf(&config_info, "devd:%s", devname) == -1)
++		return;
++
++	remove_devices("devd", config_info);
++
++	free(config_info);
++}
++
++static bool is_kbdmux_enabled(void)
++{
++	/* Xorg uses /dev/ttyv0 as a console device */
++	/* const char device[]="/dev/console"; */
++	const char device[]="/dev/ttyv0";
++	keyboard_info_t info;
++	int fd;
++
++	fd = open(device, O_RDONLY);
++
++	if (fd < 0)
++		return false;
++
++	if (ioctl(fd, KDGKBINFO, &info) == -1) {
++		close(fd);
++		return false;
++	}
++
++	close(fd);
++
++	if (!strncmp(info.kb_name, "kbdmux", 6))
++		return true;
++
++	return false;
++}
++
++static void
++disconnect_devd(int sock)
++{
++	if (sock >= 0) {
++		RemoveNotifyFd(sock);
++		close(sock);
++	}
++}
++
++static void
++devdInputHandlerNotify(int sock, int read, void *data);
++
++static int
++connect_devd(void)
++{
++	struct sockaddr_un devd;
++	int sock;
++
++	sock = socket(AF_UNIX, SOCK_STREAM, 0);
++	if (sock < 0) {
++		LogMessage(X_ERROR, "config/devd: fail opening stream socket\n");
++		return -1;
++	}
++
++	devd.sun_family = AF_UNIX;
++	strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path));
++
++	if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) {
++		close(sock);
++		LogMessage(X_ERROR, "config/devd: fail to connect to devd\n");
++		return -1;
++	}
++
++	SetNotifyFd(sock, devdInputHandlerNotify, X_NOTIFY_READ, NULL);
++
++	return	sock;
++}
++
++static CARD32
++reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg)
++{
++	int newsock;
++
++	if ((newsock = connect_devd()) > 0) {
++		sock_devd = newsock;
++		TimerFree(rtimer);
++		rtimer = NULL;
++		LogMessage(X_INFO, "config/devd: reopening devd socket\n");
++		return 0;
++	}
++
++	/* Try again after RECONNECT_DELAY */
++	return RECONNECT_DELAY;
++}
++
++static ssize_t
++socket_getline(int fd, char **out)
++{
++	char *buf, *newbuf;
++	ssize_t ret, cap, sz = 0;
++	char c;
++
++	cap = 1024;
++	buf = malloc(cap * sizeof(char));
++	if (!buf)
++		return -1;
++
++	for (;;) {
++		ret = read(sock_devd, &c, 1);
++		if (ret < 0) {
++			if (errno == EINTR)
++				continue;
++			free(buf);
++			return -1;
++		/* EOF - devd socket is lost */
++		} else if (ret == 0) {
++			disconnect_devd(sock_devd);
++			rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL);
++			LogMessage(X_WARNING, "config/devd: devd socket is lost\n");
++			return -1;
++		}
++		if (c == '\n')
++			break;
++
++		if (sz + 1 >= cap) {
++			cap *= 2;
++			newbuf = realloc(buf, cap * sizeof(char));
++			if (!newbuf) {
++				free(buf);
++				return -1;
++			}
++			buf = newbuf;
++		}
++		buf[sz] = c;
++		sz++;
++	}
++
++	buf[sz] = '\0';
++	if (sz >= 0)
++		*out = buf;
++	else
++		free(buf);
++
++	/* Number of bytes in the line, not counting the line break */
++	return sz;
++}
++
++static void
++wakeup_handler(void *data, int err)
++{
++/*
++	char *line = NULL;
++	char *walk;
++
++	if (err < 0)
++		return;
++
++		if (socket_getline(sock_devd, &line) < 0)
++			return;
++
++		walk = strchr(line + 1, ' ');
++		if (walk != NULL)
++			walk[0] = '\0';
++
++		switch (*line) {
++		case DEVD_EVENT_ADD:
++			device_added(line + 1);
++			break;
++		case DEVD_EVENT_REMOVE:
++			device_removed(line + 1);
++			break;
++		default:
++			break;
++		}
++		free(line);
++*/
++}
++
++static void
++devdInputHandlerNotify(int sock, int read, void *data)
++{
++	char *line = NULL;
++	char *walk;
++
++	if (socket_getline(sock, &line) < 0)
++		return;
++
++	walk = strchr(line + 1, ' ');
++	if (walk != NULL)
++		walk[0] = '\0';
++
++	switch (*line) {
++	case DEVD_EVENT_ADD:
++		device_added(line + 1);
++		break;
++	case DEVD_EVENT_REMOVE:
++		device_removed(line + 1);
++		break;
++		default:
++		break;
++	}
++	free(line);
++}
++
++static void
++block_handler(void *data, struct timeval **tv)
++{
++}
++
++int
++config_devd_init(void)
++{
++	char devicename[1024];
++	int i, j;
++
++	LogMessage(X_INFO, "config/devd: probing input devices...\n");
++
++	/*
++	 * Add fake keyboard and give up on keyboards management
++	 * if kbdmux is enabled
++	 */
++	if ((is_kbdmux = is_kbdmux_enabled()) == true)
++		device_added("kbdmux");
++
++	for (i = 0; hw_types[i].driver != NULL; i++) {
++		/* First scan the sysctl to determine the hardware */
++		for (j = 0; j < 16; j++) {
++			if (sysctl_exists(&hw_types[i], j,
++					devicename, sizeof(devicename)) != 0)
++				device_added(devicename);
++		}
++
++		if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0)
++			device_added(devicename);
++	}
++
++	if ((sock_devd = connect_devd()) < 0)
++		return 0;
++
++	RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
++
++	return 1;
++}
++
++void
++config_devd_fini(void)
++{
++	LogMessage(X_INFO, "config/devd: terminating backend...\n");
++
++	if (rtimer) {
++		TimerFree(rtimer);
++		rtimer = NULL;
++	}
++
++	disconnect_devd(sock_devd);
++
++	RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
++
++	is_console_kbd = false;
++}
++
++#endif /* CONFIG_DEVD */
diff --git a/modular-xorg-server-dfbsd/patches/patch-configure b/modular-xorg-server-dfbsd/patches/patch-configure
new file mode 100644
index 0000000..2704aea
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-configure
@@ -0,0 +1,16 @@
+$NetBSD: patch-configure,v 1.3 2015/06/29 11:12:45 wiz Exp $
+
+Use USE_AMD64_IOPL (actually x86_64_iopl) on NetBSD/amd64.
+(c.f. patch-hw_xfree86_os-support_bsd_i386.c)
+
+--- configure.orig	2015-02-10 22:49:52.000000000 +0000
++++ configure
+@@ -22680,7 +22680,7 @@ $as_echo "#define USE_DEV_IO 1" >>confde
+ $as_echo "#define USE_DEV_IO 1" >>confdefs.h
+  ;;
+ 		*netbsd*)
+-$as_echo "#define USE_I386_IOPL 1" >>confdefs.h
++$as_echo "#define USE_AMD64_IOPL 1" >>confdefs.h
+ 
+ 				SYS_LIBS=-lx86_64
+ 				;;
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Config.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Config.c
new file mode 100644
index 0000000..1b65bc9
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Config.c
@@ -0,0 +1,24 @@
+$NetBSD$
+
+devd support to detect devices from FreeBSD ports / DragonFly dports
+
+--- hw/xfree86/common/xf86Config.c.orig	2017-01-05 21:19:31.000000000 +0000
++++ hw/xfree86/common/xf86Config.c
+@@ -1375,13 +1375,16 @@ checkCoreInputDevices(serverLayoutPtr se
+     }
+ 
+     if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
+-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
++#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
++		defined(CONFIG_DEVD)
+         const char *config_backend;
+ 
+ #if defined(CONFIG_HAL)
+         config_backend = "HAL";
+ #elif defined(CONFIG_UDEV)
+         config_backend = "udev";
++#elif defined(CONFIG_DEVD)
++	config_backend = "devd";
+ #else
+         config_backend = "wscons";
+ #endif
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Globals.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Globals.c
new file mode 100644
index 0000000..2245c8c
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Globals.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+devd support to detect devices from FreeBSD ports / DragonFly dports
+
+--- hw/xfree86/common/xf86Globals.c.orig	2015-07-18 23:25:51.820719000 +0000
++++ hw/xfree86/common/xf86Globals.c
+@@ -122,7 +122,8 @@ xf86InfoRec xf86Info = {
+     .pmFlag = TRUE,
+     .disableRandR = FALSE,
+     .randRFrom = X_DEFAULT,
+-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
++#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
++	defined(CONFIG_DEVD)
+     .forceInputDevices = FALSE,
+     .autoAddDevices = TRUE,
+     .autoEnableDevices = TRUE,
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Xinput.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Xinput.c
new file mode 100644
index 0000000..1932b5c
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86Xinput.c
@@ -0,0 +1,14 @@
+$NetBSD$
+
+devd support to detect devices from FreeBSD ports / DragonFly dports
+
+--- hw/xfree86/common/xf86Xinput.c.orig	2017-01-04 21:32:10.000000000 +0000
++++ hw/xfree86/common/xf86Xinput.c
+@@ -1034,6 +1034,7 @@ NewInputDeviceRequest(InputOption *optio
+         if (strcmp(key, "_source") == 0 &&
+             (strcmp(value, "server/hal") == 0 ||
+              strcmp(value, "server/udev") == 0 ||
++             strcmp(value, "server/devd") == 0 ||
+              strcmp(value, "server/wscons") == 0)) {
+             is_auto = 1;
+             if (!xf86Info.autoAddDevices) {
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86pciBus.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86pciBus.c
new file mode 100644
index 0000000..4ec8433
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86pciBus.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-hw_xfree86_common_xf86pciBus.c,v 1.1 2016/11/04 01:12:51 maya Exp $
+
+NetBSD also has nouveau, try to autoload it
+
+--- hw/xfree86/common/xf86pciBus.c.orig	2016-07-15 16:18:11.000000000 +0000
++++ hw/xfree86/common/xf86pciBus.c
+@@ -1189,7 +1189,7 @@ xf86VideoPtrToDriverList(struct pci_devi
+     {
+         int idx = 0;
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+         driverList[idx++] = "nouveau";
+ #endif
+         driverList[idx++] = "nv";
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86sbusBus.h b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86sbusBus.h
new file mode 100644
index 0000000..1dd7b76
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_common_xf86sbusBus.h
@@ -0,0 +1,24 @@
+$NetBSD: patch-hw_xfree86_common_xf86sbusBus.h,v 1.1 2015/04/25 11:47:03 tnn Exp $
+
+NetBSD/sparc64 support partially from xsrc.
+
+--- hw/xfree86/common/xf86sbusBus.h.orig	2014-02-05 03:08:57.000000000 +0000
++++ hw/xfree86/common/xf86sbusBus.h
+@@ -39,6 +39,8 @@
+ #define SBUS_DEVICE_FFB		0x000b
+ #define SBUS_DEVICE_GT		0x000c
+ #define SBUS_DEVICE_MGX		0x000d
++#define SBUS_DEVICE_P9100	0x000e
++#define SBUS_DEVICE_AG10E	0x000f
+ 
+ typedef struct sbus_prom_node {
+     int node;
+@@ -50,7 +52,7 @@ typedef struct sbus_device {
+     int devId;
+     int fbNum;
+     int fd;
+-    int width, height;
++  int width, height, size;
+     sbusPromNode node;
+     const char *descr;
+     const char *device;
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_dri2_dri2.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_dri2_dri2.c
new file mode 100644
index 0000000..81f4312
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_dri2_dri2.c
@@ -0,0 +1,40 @@
+$NetBSD: patch-hw_xfree86_dri2_dri2.c,v 1.2 2015/04/25 11:47:03 tnn Exp $
+
+Fix uninitialized variables warning from clang (X crashes without this)
+
+dri2.c:242:27: note: initialize the variable 'ref' to silence this warning
+    DRI2DrawableRefPtr ref;
+dri2.c:320:27: note: initialize the variable 'ref' to silence this warning
+    DRI2DrawableRefPtr ref, next;
+dri2.c:601:27: note: initialize the variable 'ref' to silence this warning
+    DRI2DrawableRefPtr ref;
+
+--- hw/xfree86/dri2/dri2.c.orig	2015-01-26 18:42:23.000000000 +0000
++++ hw/xfree86/dri2/dri2.c
+@@ -279,7 +279,7 @@ typedef struct DRI2DrawableRefRec {
+ static DRI2DrawableRefPtr
+ DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id)
+ {
+-    DRI2DrawableRefPtr ref;
++    DRI2DrawableRefPtr ref = NULL;
+ 
+     xorg_list_for_each_entry(ref, &pPriv->reference_list, link) {
+         if (ref->id == id)
+@@ -359,7 +359,7 @@ static int
+ DRI2DrawableGone(void *p, XID id)
+ {
+     DRI2DrawablePtr pPriv = p;
+-    DRI2DrawableRefPtr ref, next;
++    DRI2DrawableRefPtr ref = NULL, next;
+     WindowPtr pWin;
+     PixmapPtr pPixmap;
+     DrawablePtr pDraw;
+@@ -676,7 +676,7 @@ static void
+ DRI2InvalidateDrawable(DrawablePtr pDraw)
+ {
+     DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
+-    DRI2DrawableRefPtr ref;
++    DRI2DrawableRefPtr ref = NULL;
+ 
+     if (!pPriv || !pPriv->needInvalidate)
+         return;
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_arm__video.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_arm__video.c
new file mode 100644
index 0000000..26cb33d
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_arm__video.c
@@ -0,0 +1,24 @@
+$NetBSD: patch-hw_xfree86_os-support_bsd_arm__video.c,v 1.1 2016/02/23 22:32:45 tnn Exp $
+
+XXX stubs for now, sufficient for wsfb. Need to sync this file with xsrc.
+
+--- hw/xfree86/os-support/bsd/arm_video.c.orig	2016-01-06 17:23:08.000000000 +0000
++++ hw/xfree86/os-support/bsd/arm_video.c
+@@ -66,6 +66,12 @@
+ #include "xf86_OSlib.h"
+ #include "xf86OSpriv.h"
+ 
++#if defined(__NetBSD__)
++Bool xf86EnableIO(void) { return TRUE; }
++void xf86DisableIO(void) { return; }
++void xf86OSInitVidMem(VidMemInfoPtr pVidMem) { pVidMem->initialised = TRUE; }
++#else /* DISABLED */
++
+ #if defined(__NetBSD__) && !defined(MAP_FILE)
+ #define MAP_FLAGS MAP_SHARED
+ #else
+@@ -203,3 +209,4 @@ xf86DisableIO()
+ }
+ 
+ #endif                          /* USE_ARC_MMAP */
++#endif /* DISABLED */
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c
new file mode 100644
index 0000000..b2053be
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_bsd__VTsw.c
@@ -0,0 +1,26 @@
+$NetBSD: patch-hw_xfree86_os-support_bsd_bsd__VTsw.c,v 1.1 2015/10/11 18:28:53 tnn Exp $
+
+VT switching support. From xsrc.
+
+--- hw/xfree86/os-support/bsd/bsd_VTsw.c.orig	2015-05-21 14:21:39.000000000 +0000
++++ hw/xfree86/os-support/bsd/bsd_VTsw.c
+@@ -68,6 +68,9 @@ xf86VTSwitchAway()
+ {
+ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+     if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
++#ifdef WSCONS_SUPPORT
++	ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
++#endif
+         xf86Info.vtRequestsPending = FALSE;
+         if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
+             return FALSE;
+@@ -83,6 +86,9 @@ xf86VTSwitchTo()
+ {
+ #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+     if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
++#ifdef WSCONS_SUPPORT
++	ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS);
++#endif
+         xf86Info.vtRequestsPending = FALSE;
+         if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
+             return FALSE;
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_i386__video.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_i386__video.c
new file mode 100644
index 0000000..3427d35
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bsd_i386__video.c
@@ -0,0 +1,14 @@
+$NetBSD: patch-hw_xfree86_os-support_bsd_i386__video.c,v 1.1 2015/04/25 11:47:03 tnn Exp $
+
+--- hw/xfree86/os-support/bsd/i386_video.c.orig	2015-01-17 23:42:52.000000000 +0000
++++ hw/xfree86/os-support/bsd/i386_video.c
+@@ -42,6 +42,9 @@
+ #else
+ #define MAP_FLAGS (MAP_FILE | MAP_SHARED)
+ #endif
++#if defined(__NetBSD__) && defined(USE_AMD64_IOPL)
++#define amd64_iopl x86_64_iopl
++#endif
+ 
+ #ifdef __OpenBSD__
+ #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bus_Sbus.c b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bus_Sbus.c
new file mode 100644
index 0000000..311ceb7
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_bus_Sbus.c
@@ -0,0 +1,172 @@
+$NetBSD: patch-hw_xfree86_os-support_bus_Sbus.c,v 1.3 2016/11/16 10:14:37 wiz Exp $
+
+Merge most of netbsdSbus.c from xsrc.
+
+--- hw/xfree86/os-support/bus/Sbus.c.orig	2016-08-11 19:08:48.000000000 +0000
++++ hw/xfree86/os-support/bus/Sbus.c
+@@ -34,6 +34,9 @@
+ #ifdef __sun
+ #include <sys/utsname.h>
+ #endif
++#if defined(__NetBSD__) && defined(__sparc__)
++#include <dev/ofw/openfirmio.h>
++#endif
+ #include "xf86.h"
+ #include "xf86Priv.h"
+ #include "xf86_OSlib.h"
+@@ -50,7 +53,6 @@ static int promP1275 = -1;
+ 
+ #define MAX_PROP	128
+ #define MAX_VAL		(4096-128-4)
+-static struct openpromio *promOpio;
+ 
+ sbusDevicePtr *xf86SbusInfo = NULL;
+ 
+@@ -68,68 +70,75 @@ struct sbus_devtable sbusDeviceTable[] =
+     {SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", NULL, "Sun Graphics Tower"},
+     {SBUS_DEVICE_MGX, -1, "mgx", NULL, "Quantum 3D MGXplus"},
+     {SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "sunleo", "Sun ZX or Turbo ZX"},
+-    {SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "suntcx", "Sun TCX"},
++    {SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "suntcx", "Sun TCX or S24"},
+     {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "sunffb", "Sun FFB"},
+     {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "sunffb", "Sun Elite3D"},
++    {SBUS_DEVICE_P9100, FBTYPE_P9100, "pnozz", "pnozz", "Weitek P9100"},
++    {SBUS_DEVICE_AG10E, FBTYPE_AG10E, "ag10e", "ag10e", "Fujitsu AG-10e"},
+     {0, 0, NULL}
+ };
+ 
++static struct ofiocdesc ofio;
++static char of_buf[256];
++
+ int
+ promGetSibling(int node)
+ {
+-    promOpio->oprom_size = sizeof(int);
+ 
+     if (node == -1)
+         return 0;
+-    *(int *) promOpio->oprom_array = node;
+-    if (ioctl(promFd, OPROMNEXT, promOpio) < 0)
++    if (ioctl(promFd, OFIOCGETNEXT, &node) < 0)
+         return 0;
+-    promCurrentNode = *(int *) promOpio->oprom_array;
+-    return *(int *) promOpio->oprom_array;
++    promCurrentNode = node;
++    return node;
+ }
+ 
+ int
+ promGetChild(int node)
+ {
+-    promOpio->oprom_size = sizeof(int);
+ 
+     if (!node || node == -1)
+         return 0;
+-    *(int *) promOpio->oprom_array = node;
+-    if (ioctl(promFd, OPROMCHILD, promOpio) < 0)
++    if (ioctl(promFd, OFIOCGETCHILD, &node) < 0)
+         return 0;
+-    promCurrentNode = *(int *) promOpio->oprom_array;
+-    return *(int *) promOpio->oprom_array;
++    promCurrentNode = node;
++    return node;
+ }
+ 
+ char *
+ promGetProperty(const char *prop, int *lenp)
+ {
+-    promOpio->oprom_size = MAX_VAL;
+ 
+-    strcpy(promOpio->oprom_array, prop);
+-    if (ioctl(promFd, OPROMGETPROP, promOpio) < 0)
++    ofio.of_nodeid = promCurrentNode;
++    ofio.of_name = (char *)prop;
++    ofio.of_namelen = strlen(prop);
++    ofio.of_buf = of_buf;
++    ofio.of_buflen = sizeof(of_buf);
++
++    if (ioctl(promFd, OFIOCGET, &ofio) < 0)
+         return 0;
++
++    of_buf[ofio.of_buflen] = '\0';
++
+     if (lenp)
+-        *lenp = promOpio->oprom_size;
+-    return promOpio->oprom_array;
++        *lenp = ofio.of_buflen;
++    return of_buf;
+ }
+ 
+ int
+ promGetBool(const char *prop)
+ {
+-    promOpio->oprom_size = 0;
++    ofio.of_nodeid = promCurrentNode;
++    ofio.of_name = (char *)prop;
++    ofio.of_namelen = strlen(prop);
++    ofio.of_buf = of_buf;
++    ofio.of_buflen = sizeof(of_buf);
+ 
+-    *(int *) promOpio->oprom_array = 0;
+-    for (;;) {
+-        promOpio->oprom_size = MAX_PROP;
+-        if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0)
+-            return 0;
+-        if (!promOpio->oprom_size)
+-            return 0;
+-        if (!strcmp(promOpio->oprom_array, prop))
+-            return 1;
+-    }
++    if (ioctl(promFd, OFIOCGET, &ofio) < 0)
++        return 0;
++    if (ofio.of_buflen < 0)
++        return 0;
++    return 1;
+ }
+ 
+ #define PROM_NODE_SIBLING 0x01
+@@ -180,8 +189,8 @@ promIsP1275(void)
+         promP1275 = TRUE;
+     else
+         promP1275 = FALSE;
+-#elif defined(__FreeBSD__)
+-    promP1275 = TRUE;
++#elif defined(__FreeBSD__) || defined(__NetBSD__)
++     promP1275 = TRUE;
+ #else
+ #error Missing promIsP1275() function for this OS
+ #endif
+@@ -198,8 +207,6 @@ sparcPromClose(void)
+         close(promFd);
+         promFd = -1;
+     }
+-    free(promOpio);
+-    promOpio = NULL;
+     promOpenCount = 0;
+ }
+ 
+@@ -213,11 +220,6 @@ sparcPromInit(void)
+     promFd = open("/dev/openprom", O_RDONLY, 0);
+     if (promFd == -1)
+         return -1;
+-    promOpio = (struct openpromio *) malloc(4096);
+-    if (!promOpio) {
+-        sparcPromClose();
+-        return -1;
+-    }
+     promRootNode = promGetSibling(0);
+     if (!promRootNode) {
+         sparcPromClose();
+@@ -399,9 +401,9 @@ sparcPromAssignNodes(void)
+          * were the types of the cards missed. */
+         char buffer[64];
+         int fbNum, devId;
+-        static struct {
+-            int devId;
+-            char *prefix;
++        static const struct {
++            const int devId;
++            const char *prefix;
+         } procFbPrefixes[] = {
+             {SBUS_DEVICE_BW2, "BWtwo"},
+             {SBUS_DEVICE_CG14, "CGfourteen"},
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_xf86_OSproc.h b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_xf86_OSproc.h
new file mode 100644
index 0000000..c781830
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os-support_xf86_OSproc.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-hw_xfree86_os-support_xf86_OSproc.h,v 1.1 2016/02/23 22:32:45 tnn Exp $
+
+These are in i386_video.c only. XXX what are they used for?
+
+--- hw/xfree86/os-support/xf86_OSproc.h.orig	2016-01-06 17:23:08.000000000 +0000
++++ hw/xfree86/os-support/xf86_OSproc.h
+@@ -115,7 +115,7 @@ _XFUNCPROTOBEGIN
+ extern _X_EXPORT Bool xf86EnableIO(void);
+ extern _X_EXPORT void xf86DisableIO(void);
+ 
+-#ifdef __NetBSD__
++#if defined(__NetBSD__) && (defined(__i386__) || defined(__x86_64__))
+ extern _X_EXPORT void xf86SetTVOut(int);
+ extern _X_EXPORT void xf86SetRGBOut(void);
+ #endif
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os_support_bus_xf86Sbus.h b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os_support_bus_xf86Sbus.h
new file mode 100644
index 0000000..816cbbd
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_os_support_bus_xf86Sbus.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-hw_xfree86_os_support_bus_xf86Sbus.h,v 1.1 2015/04/25 11:47:03 tnn Exp $
+
+NetBSD/sparc64 support.
+
+--- hw/xfree86/os-support/bus/xf86Sbus.h.orig	2014-02-05 03:08:57.000000000 +0000
++++ hw/xfree86/os-support/bus/xf86Sbus.h
+@@ -36,6 +36,8 @@
+ #elif defined(SVR4)
+ #include <sys/fbio.h>
+ #include <sys/openpromio.h>
++#elif defined(__NetBSD__) && defined(__sparc64__)
++#include <dev/sun/fbio.h>
+ #elif defined(__OpenBSD__) && defined(__sparc64__)
+ /* XXX */
+ #elif defined(CSRG_BASED)
diff --git a/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_sdksyms.sh b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_sdksyms.sh
new file mode 100644
index 0000000..9f452d4
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-hw_xfree86_sdksyms.sh
@@ -0,0 +1,27 @@
+$NetBSD: patch-hw_xfree86_sdksyms.sh,v 1.1 2016/04/10 07:35:20 tnn Exp $
+
+Kludge sdksyms.c generator to not fail on GetClientPid.
+It returns pid_t which on NetBSD is #define pid_t __pid_t
+This slightly alters the GCC preprocessor output which this fragile
+code could not deal with when using GCC 5+
+
+--- hw/xfree86/sdksyms.sh.orig	2016-03-08 20:22:17.000000000 +0000
++++ hw/xfree86/sdksyms.sh
+@@ -357,6 +357,17 @@ BEGIN {
+                n = 1;
+             }
+         }
++	# hack: pid_t becomes __pid_t on NetBSD.
++	# GCC 5 inserts additional lines around this.
++        if ($1 == "__pid_t" && NF == 1) {
++            getline;
++            n++;
++            # skip line numbers GCC 5 adds (after typedef return type?)
++            while ($n == "" || $0 ~ /^# [0-9]+ "/) {
++               getline;
++               n = 1;
++            }
++	}
+ 
+ 	# type specifier may not be set, as in
+ 	#   extern _X_EXPORT unsigned name(...)
diff --git a/modular-xorg-server-dfbsd/patches/patch-os_xstrans.c b/modular-xorg-server-dfbsd/patches/patch-os_xstrans.c
new file mode 100644
index 0000000..439158f
--- /dev/null
+++ b/modular-xorg-server-dfbsd/patches/patch-os_xstrans.c
@@ -0,0 +1,21 @@
+$NetBSD: patch-os_xstrans.c,v 1.1 2015/09/26 18:35:41 tnn Exp $
+
+CMSG_SPACE must evaluate to a constant, but doesn't on netbsd-5.
+See sys/socket.h r1.104.
+
+--- os/xstrans.c.orig	2015-05-21 14:23:54.000000000 +0000
++++ os/xstrans.c
+@@ -14,4 +14,13 @@ _X_ATTRIBUTE_PRINTF(1, 2);
+ #define TRANS_REOPEN
+ #define TRANS_SERVER
+ #define XSERV_t
++#if defined(__NetBSD__)
++#include <sys/param.h>
++#if (__NetBSD_Version__ < 600000000)
++#include <sys/socket.h>
++#define __MY_CMSG_ALIGN(n) (((n) + 7) & ~7)
++#undef  CMSG_SPACE
++#define CMSG_SPACE(l) (__MY_CMSG_ALIGN(sizeof(struct msghdr)) + __MY_CMSG_ALIGN(l))
++#endif
++#endif
+ #include <X11/Xtrans/transport.c>


Home | Main Index | Thread Index | Old Index