dbus-dfbsd: Replace dbus adding FreeBSD DragonFly fixes
authorDavid Shao <davshao@gmail.com>
Tue, 17 Jan 2017 08:01:42 +0000 (00:01 -0800)
committerDavid Shao <davshao@gmail.com>
Tue, 17 Jan 2017 08:01:42 +0000 (00:01 -0800)
FreeBSD and DragonFly changes discussed in pkg/50075
(Making dbus actually work on FreeBSD, DragonFly, and probably more)

Generated dbus script can be copied to /etc/rc.d/ and started with
dbus_enable=YES
in /etc/rc.conf

User can specify owner, group, and pidfile name in etc/mk.conf

20 files changed:
Makefile
dbus-dfbsd/DESCR [new file with mode: 0644]
dbus-dfbsd/INSTALL [new file with mode: 0644]
dbus-dfbsd/MESSAGE [new file with mode: 0644]
dbus-dfbsd/MESSAGE.launchd [new file with mode: 0644]
dbus-dfbsd/Makefile [new file with mode: 0644]
dbus-dfbsd/PLIST [new file with mode: 0644]
dbus-dfbsd/TODO [new file with mode: 0644]
dbus-dfbsd/buildlink3.mk [new file with mode: 0644]
dbus-dfbsd/distinfo [new file with mode: 0644]
dbus-dfbsd/files/dbus.sh [new file with mode: 0644]
dbus-dfbsd/files/smf/dbus.sh [new file with mode: 0755]
dbus-dfbsd/files/smf/manifest.xml [new file with mode: 0644]
dbus-dfbsd/hacks.mk [new file with mode: 0644]
dbus-dfbsd/options.mk [new file with mode: 0644]
dbus-dfbsd/patches/patch-ak [new file with mode: 0644]
dbus-dfbsd/patches/patch-al [new file with mode: 0644]
dbus-dfbsd/patches/patch-am [new file with mode: 0644]
dbus-dfbsd/patches/patch-dbus_dbus-sysdeps-util-unix.c [new file with mode: 0644]
dbus-dfbsd/patches/patch-tools_dbus-print-message.c [new file with mode: 0644]

index a3a29d065efdd6b62f78b8f4b61114fd3a236c3e..77cba0403d7f3a7eb8392ecc1718a509346bf806 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -463,6 +463,7 @@ SUBDIR+=    dates
 SUBDIR+=       davical-git
 SUBDIR+=       db1
 SUBDIR+=       dbf
+SUBDIR+=       dbus-dfbsd
 SUBDIR+=       dbus-explorer
 SUBDIR+=       ddate
 SUBDIR+=       deadbeef
diff --git a/dbus-dfbsd/DESCR b/dbus-dfbsd/DESCR
new file mode 100644 (file)
index 0000000..2a2988e
--- /dev/null
@@ -0,0 +1,12 @@
+D-BUS is a message bus, used for sending messages between applications.
+Conceptually, it fits somewhere in between raw sockets and CORBA in terms
+of complexity.
+
+D-BUS supports broadcast messages, asynchronous messages (thus decreasing
+latency), authentication, and more.  It is designed to be low-overhead;
+messages are sent using a binary protocol, not using XML.  D-BUS also
+supports a method call mapping for its messages, but it is not required;
+this makes using the system quite simple.
+
+This package provides the D-BUS core library and daemon, as well as
+some utilities that complement it.
diff --git a/dbus-dfbsd/INSTALL b/dbus-dfbsd/INSTALL
new file mode 100644 (file)
index 0000000..a4c44cd
--- /dev/null
@@ -0,0 +1,9 @@
+# $NetBSD: INSTALL,v 1.1 2008/09/24 11:37:31 taca Exp $
+
+DBUS_UUIDGEN="@PREFIX@/bin/dbus-uuidgen"
+
+case ${STAGE} in
+POST-INSTALL)
+       ${DBUS_UUIDGEN} --ensure
+       ;;
+esac
diff --git a/dbus-dfbsd/MESSAGE b/dbus-dfbsd/MESSAGE
new file mode 100644 (file)
index 0000000..ca65271
--- /dev/null
@@ -0,0 +1,17 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.2 2014/12/02 05:20:24 snj Exp $
+
+You should enable the dbus system-wide daemon for correct operation.  You
+can do this by using one of the three start-up scripts installed by the
+package.  Use:
+
+* ${PREFIX}/share/examples/rc.d/dbus:
+  if you are using NetBSD's and pkgsrc's rc.subr start-up framework.
+
+* ${PREFIX}/share/examples/rc.d/messagebus.redhat:
+  if you are using a Red-Hat based system (such as Fedora).
+
+* ${PREFIX}/share/examples/rc.d/rc.messagebus.slackware:
+  if you are using a Slackware-like system.
+
+===========================================================================
diff --git a/dbus-dfbsd/MESSAGE.launchd b/dbus-dfbsd/MESSAGE.launchd
new file mode 100644 (file)
index 0000000..12285e3
--- /dev/null
@@ -0,0 +1,20 @@
+===========================================================================
+$NetBSD: MESSAGE.launchd,v 1.1 2015/01/21 05:38:59 pho Exp $
+
+A launchd agent configuration file has been installed at:
+  ${PREFIX}/Library/LaunchAgents/org.freedesktop.dbus-session.plist
+
+You need to manually load it to auto-start a session bus. Without
+loading it, no applications can start a bus nor find an existing one:
+  % sudo launchctl load \
+      ${PREFIX}/Library/LaunchAgents/org.freedesktop.dbus-session.plist
+
+Or alternatively, you can copy it under the system default path to
+automatically load it on system boot:
+  % sudo cp \
+      ${PREFIX}/Library/LaunchAgents/org.freedesktop.dbus-session.plist \
+      /Library/LaunchAgents/
+  % sudo launchctl load \
+      /Library/LaunchAgents/org.freedesktop.dbus-session.plist
+
+===========================================================================
diff --git a/dbus-dfbsd/Makefile b/dbus-dfbsd/Makefile
new file mode 100644 (file)
index 0000000..609eaa7
--- /dev/null
@@ -0,0 +1,112 @@
+# $NetBSD: Makefile,v 1.104 2016/12/12 13:57:44 wiz Exp $
+
+DISTNAME=      dbus-1.10.14
+CATEGORIES=    sysutils
+MASTER_SITES=  http://dbus.freedesktop.org/releases/dbus/
+
+MAINTAINER=    pkgsrc-users@NetBSD.org
+HOMEPAGE=      http://www.freedesktop.org/Software/dbus
+COMMENT=       Message bus system
+LICENSE=       gnu-gpl-v2
+
+CONFLICTS+=    dbus-glib<0.71
+CONFLICTS+=    py27-dbus<0.71
+
+BUILD_DEPENDS+=        xmlto-[0-9]*:../../textproc/xmlto
+
+GNU_CONFIGURE=         YES
+USE_TOOLS+=            gmake msgfmt pkg-config
+USE_LIBTOOL=           YES
+
+PKGCONFIG_OVERRIDE=    dbus-1.pc.in
+
+BUILD_DEFS+=           VARBASE PKG SYSCONFBASE DBUS_USER DBUS_GROUP DBUS_SYSTEM_PID_FILE
+
+OWN_DIRS_PERMS+=       ${VARBASE}/db/dbus ${DBUS_USER} ${DBUS_GROUP} 0755
+SPECIAL_PERMS+=                libexec/dbus-daemon-launch-helper ${REAL_ROOT_USER} ${DBUS_GROUP} 4511
+
+SMF_METHODS=   dbus
+SMF_NAME=      dbus
+
+MESSAGE_SRC+=  MESSAGE
+
+.include "../../mk/bsd.prefs.mk"
+
+CONFIGURE_ARGS+=       --localstatedir=${VARBASE:Q}
+
+# Prevent the configure script from picking up a per-user tmp
+# directory. See the commit message on revision 1.35
+CONFIGURE_ARGS+=       --with-session-socket-dir=/tmp
+
+CONFIGURE_ARGS+=       --without-init-scripts
+CONFIGURE_ARGS+=       --disable-ansi
+CONFIGURE_ARGS+=       --disable-console-owner-file
+CONFIGURE_ARGS+=       --disable-doxygen-docs
+CONFIGURE_ARGS+=       --enable-checks
+CONFIGURE_ARGS+=       --enable-static
+
+###
+### XXX the spawn test hangs, and some of these tests may be bogus
+###
+#.if !empty(PKGSRC_RUN_TEST:M[Yy][Ee][Ss])
+#PKG_OPTIONS.dbus+=            debug
+#TEST_TARGET=                  check
+#.endif
+
+CONFIGURE_ARGS+=       --with-dbus-user=${DBUS_USER}
+CONFIGURE_ARGS+=       --with-test-socket-dir=${WRKDIR:Q}
+CONFIGURE_ARGS+=       --with-system-pid-file=${VARBASE}/run/dbus/${DBUS_SYSTEM_PID_FILE}
+
+PTHREAD_AUTO_VARS=     yes
+
+.if ${OPSYS} == "Linux"
+PLIST.linux=           yes
+.else
+CONFIGURE_ARGS+=       --disable-abstract-sockets
+CONFIGURE_ARGS+=       --disable-selinux
+.endif
+
+PLIST_VARS+=           linux launchd
+
+DBUS_CONF_DIR=         ${PKG_SYSCONFBASE}/dbus-1
+OWN_DIRS+=             ${DBUS_CONF_DIR}/services
+OWN_DIRS+=             ${DBUS_CONF_DIR}/system-services
+OWN_DIRS+=             ${DBUS_CONF_DIR}/session.d
+OWN_DIRS+=             ${DBUS_CONF_DIR}/system.d
+
+RCD_SCRIPTS=           dbus
+
+PKG_GROUPS_VARS+=      DBUS_GROUP
+PKG_USERS_VARS+=       DBUS_USER
+
+PKG_GROUPS=            ${DBUS_GROUP}
+PKG_USERS=             ${DBUS_USER}:${DBUS_GROUP}
+PKG_GECOS.${DBUS_USER}=        System message bus
+# Modern dbus does not need a home directory for its user
+# Or should this be moved to being an option?
+# PKG_HOME.${DBUS_USER}=       ${VARBASE}/run/dbus
+
+FILES_SUBST+=          DBUS_USER_SH=${DBUS_USER}
+FILES_SUBST+=          DBUS_GROUP_SH=${DBUS_GROUP}
+FILES_SUBST+=          DBUS_SYSTEM_PID_FILE_SH=${DBUS_SYSTEM_PID_FILE}
+
+BUILDLINK_TRANSFORM+=  rm:-Wl,--gc-sections
+# Package tries to use these if gcc accepts them, but that doesn't
+# mean that we universally can *run* the executables
+BUILDLINK_TRANSFORM+=  rm:-fPIE
+BUILDLINK_TRANSFORM+=  rm:-pie
+
+BUILDLINK_TRANSFORM.OpenBSD+=  rm:-lrt
+
+.include "options.mk"
+
+post-install:
+       ${INSTALL_DATA} ${WRKSRC}/doc/introspect.* \
+               ${DESTDIR}${PREFIX}/share/doc/dbus/
+       ${RM} -f ${DESTDIR}${PREFIX}/etc/dbus-1/s*.conf
+       ${RMDIR} ${DESTDIR}${PREFIX}/etc/dbus-1 || ${TRUE}
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../devel/gettext-lib/buildlink3.mk"
+.include "../../textproc/expat/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/dbus-dfbsd/PLIST b/dbus-dfbsd/PLIST
new file mode 100644 (file)
index 0000000..9f2d075
--- /dev/null
@@ -0,0 +1,64 @@
+@comment $NetBSD: PLIST,v 1.20 2015/08/30 15:08:00 wiz Exp $
+${PLIST.launchd}Library/LaunchAgents/org.freedesktop.dbus-session.plist
+bin/dbus-cleanup-sockets
+bin/dbus-daemon
+bin/dbus-launch
+bin/dbus-monitor
+bin/dbus-run-session
+bin/dbus-send
+bin/dbus-test-tool
+bin/dbus-update-activation-environment
+bin/dbus-uuidgen
+include/dbus-1.0/dbus/dbus-address.h
+include/dbus-1.0/dbus/dbus-bus.h
+include/dbus-1.0/dbus/dbus-connection.h
+include/dbus-1.0/dbus/dbus-errors.h
+include/dbus-1.0/dbus/dbus-macros.h
+include/dbus-1.0/dbus/dbus-memory.h
+include/dbus-1.0/dbus/dbus-message.h
+include/dbus-1.0/dbus/dbus-misc.h
+include/dbus-1.0/dbus/dbus-pending-call.h
+include/dbus-1.0/dbus/dbus-protocol.h
+include/dbus-1.0/dbus/dbus-server.h
+include/dbus-1.0/dbus/dbus-shared.h
+include/dbus-1.0/dbus/dbus-signature.h
+include/dbus-1.0/dbus/dbus-syntax.h
+include/dbus-1.0/dbus/dbus-threads.h
+include/dbus-1.0/dbus/dbus-types.h
+include/dbus-1.0/dbus/dbus.h
+lib/dbus-1.0/include/dbus/dbus-arch-deps.h
+lib/libdbus-1.la
+lib/pkgconfig/dbus-1.pc
+libexec/dbus-daemon-launch-helper
+man/man1/dbus-cleanup-sockets.1
+man/man1/dbus-daemon.1
+man/man1/dbus-launch.1
+man/man1/dbus-monitor.1
+man/man1/dbus-run-session.1
+man/man1/dbus-send.1
+man/man1/dbus-test-tool.1
+man/man1/dbus-update-activation-environment.1
+man/man1/dbus-uuidgen.1
+share/dbus-1/session.conf
+share/dbus-1/system.conf
+share/doc/dbus/dbus-cleanup-sockets.1.html
+share/doc/dbus/dbus-daemon.1.html
+share/doc/dbus/dbus-faq.html
+share/doc/dbus/dbus-launch.1.html
+share/doc/dbus/dbus-monitor.1.html
+share/doc/dbus/dbus-run-session.1.html
+share/doc/dbus/dbus-send.1.html
+share/doc/dbus/dbus-specification.html
+share/doc/dbus/dbus-test-plan.html
+share/doc/dbus/dbus-test-tool.1.html
+share/doc/dbus/dbus-tutorial.html
+share/doc/dbus/dbus-update-activation-environment.1.html
+share/doc/dbus/dbus-uuidgen.1.html
+share/doc/dbus/diagram.png
+share/doc/dbus/diagram.svg
+share/doc/dbus/examples/GetAllMatchRules.py
+share/doc/dbus/examples/example-session-disable-stats.conf
+share/doc/dbus/examples/example-system-enable-stats.conf
+share/doc/dbus/introspect.dtd
+share/doc/dbus/introspect.xsl
+share/doc/dbus/system-activation.txt
diff --git a/dbus-dfbsd/TODO b/dbus-dfbsd/TODO
new file mode 100644 (file)
index 0000000..c3e18fe
--- /dev/null
@@ -0,0 +1,6 @@
+Copy port to sysutils/dbus, do not install from wip.
+
+FreeBSD and DragonFly changes discussed in
+pkg/50075 (Making dbus actually work on FreeBSD, DragonFly, and
+ probably more)
+implemented.
diff --git a/dbus-dfbsd/buildlink3.mk b/dbus-dfbsd/buildlink3.mk
new file mode 100644 (file)
index 0000000..7584389
--- /dev/null
@@ -0,0 +1,21 @@
+# $NetBSD: buildlink3.mk,v 1.16 2014/01/29 13:01:53 ryoon Exp $
+
+BUILDLINK_TREE+=       dbus
+
+.if !defined(DBUS_BUILDLINK3_MK)
+DBUS_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.dbus+=   dbus>=0.91
+BUILDLINK_PKGSRCDIR.dbus?=     ../../sysutils/dbus
+
+.if defined(USE_DBUS-ARCH-DEPS_H)
+.  if !empty(USE_DBUS-ARCH-DEPS_H:M[yY][eE][sS])
+BUILDLINK_INCDIRS.dbus+=       lib/dbus-1.0/include/dbus
+BUILDLINK_FNAME_TRANSFORM.dbus+=       -e "s|lib/dbus-1.0/||"
+.  endif
+.endif
+
+.include "../../textproc/expat/buildlink3.mk"
+.endif # DBUS_BUILDLINK3_MK
+
+BUILDLINK_TREE+=       -dbus
diff --git a/dbus-dfbsd/distinfo b/dbus-dfbsd/distinfo
new file mode 100644 (file)
index 0000000..d2b6cbb
--- /dev/null
@@ -0,0 +1,11 @@
+$NetBSD: distinfo,v 1.77 2016/12/12 13:57:44 wiz Exp $
+
+SHA1 (dbus-1.10.14.tar.gz) = ea9efcf5439b53c3bdcabf8efba838c783c3639d
+RMD160 (dbus-1.10.14.tar.gz) = 1d7143cb689a8d23faa964cda7b8d4b9d5badbde
+SHA512 (dbus-1.10.14.tar.gz) = 87eda0117ee5fd47952f37a227cc017acdaa174a28e59ecd0c9f2501ffd5d56d015865d472dd9a922d8a52184662bfebff86279eb7431d19583958dd9e4dae26
+Size (dbus-1.10.14.tar.gz) = 1985828 bytes
+SHA1 (patch-ak) = ebb0c291297577a9cff246e7bc71412bf6157254
+SHA1 (patch-al) = c70be84ae79698cc4d83087427646bfb0500f194
+SHA1 (patch-am) = ed334bc76911c9db9f5472c58fb762c56255c5b4
+SHA1 (patch-dbus_dbus-sysdeps-util-unix.c) = 9c967cdac585220a3e65443dc9642e7d4478567c
+SHA1 (patch-tools_dbus-print-message.c) = 96267d3cff2c5207911615735748ef81604a69ec
diff --git a/dbus-dfbsd/files/dbus.sh b/dbus-dfbsd/files/dbus.sh
new file mode 100644 (file)
index 0000000..6326425
--- /dev/null
@@ -0,0 +1,41 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: dbus.sh,v 1.10 2016/05/22 23:02:24 youri Exp $
+#
+# PROVIDE: dbus
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="dbus"
+rcvar="@DBUS_RCVAR@"
+command="@PREFIX@/bin/dbus-daemon"
+command_args="--system"
+pidfile="@VARBASE@/run/dbus/@DBUS_SYSTEM_PID_FILE_SH@"
+start_precmd="dbus_prestart"
+stop_postcmd="dbus_poststop"
+
+dbus_prestart() {
+       dbdir="@VARBASE@/db/dbus"
+       if @TEST@ ! -d $dbdir; then
+               @MKDIR@ $dbdir
+       fi
+       dir="@VARBASE@/run/dbus"
+       if @TEST@ ! -d $dir; then
+               @MKDIR@ $dir
+# On other systems /var/run/dbus root:wheel works fine
+#              @CHMOD@ 0755 $dir
+#              @CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
+       elif @TEST@ -f $pidfile; then
+               @RM@ -f $pidfile
+       fi
+       @PREFIX@/bin/dbus-uuidgen --ensure
+}
+
+dbus_poststop() {
+       @RM@ -f $pidfile
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/dbus-dfbsd/files/smf/dbus.sh b/dbus-dfbsd/files/smf/dbus.sh
new file mode 100755 (executable)
index 0000000..3128fe7
--- /dev/null
@@ -0,0 +1,40 @@
+#!/sbin/sh
+
+. /lib/svc/share/smf_include.sh
+
+# SMF_FMRI is the name of the target service. This allows multiple instances
+# to use the same script.
+
+if [ ! -x @PREFIX@/bin/dbus-daemon ]; then
+       echo "@PREFIX@/bin/dbus-daemon not found or not executable"
+       exit $SMF_EXIT_ERR_FATAL
+fi
+
+if [ ! -f @VARBASE@/db/dbus/machine-id ]; then
+       @PREFIX@/bin/dbus-uuidgen --ensure
+fi
+pidfile="@VARBASE@/run/dbus/pid"
+case "$1" in
+'start')
+    dir="@VARBASE@/run/dbus"
+    if ! [ -d $dir ]; then
+               @MKDIR@ $dir
+               @CHMOD@ 0755 $dir
+               @CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
+       elif [ -f $pidfile ]; then
+               rm -f $pidfile
+       fi
+       @PREFIX@/bin/dbus-daemon --system
+       err=$?
+       if [ $err -ne 0 ]; then
+               echo "dbus failed to start: error $err"
+               exit $SMF_EXIT_ERR_FATAL
+       fi
+       ;;
+*)
+       echo "Usage: $0 { start }"
+       exit $SMF_EXIT_ERR_FATAL 
+    ;;
+esac
+
+exit $SMF_EXIT_OK
diff --git a/dbus-dfbsd/files/smf/manifest.xml b/dbus-dfbsd/files/smf/manifest.xml
new file mode 100644 (file)
index 0000000..9293752
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type='manifest' name='export'>
+  <service
+       name='@SMF_PREFIX@/@SMF_NAME@'
+       type='service'
+       version='1'>
+       <create_default_instance enabled='false' />
+       <single_instance />
+       <dependency name='usr'
+               type='service'
+               grouping='require_all'
+               restart_on='none'>
+               <service_fmri value='svc:/system/filesystem/minimal' />
+       </dependency>
+       <exec_method
+               type='method'
+               name='start'
+               exec='@PREFIX@/@SMF_METHOD_FILE.dbus@ start'
+               timeout_seconds='30'>
+               <method_context>
+                       <method_credential user='root' group='@DBUS_GROUP_SH@' />
+               </method_context>
+       </exec_method>
+       <exec_method
+               type='method'
+               name='stop'
+               exec=':kill'
+               timeout_seconds='30' />
+       <property_group name='startd' type='framework'>
+               <!-- sub-process core dumps shouldn't restart session -->
+               <propval name='ignore_error' type='astring'
+                   value='core,signal' />
+       </property_group>
+       <template>
+               <common_name>
+                       <loctext xml:lang='C'>
+                       D-BUS message bus
+                       </loctext>
+               </common_name>
+               <documentation>
+                       <manpage title='dbus-daemon' section='1' manpath='@PREFIX@/@PKGMANDIR@'/>
+               </documentation>
+       </template>
+  </service>
+</service_bundle>
diff --git a/dbus-dfbsd/hacks.mk b/dbus-dfbsd/hacks.mk
new file mode 100644 (file)
index 0000000..0a0967a
--- /dev/null
@@ -0,0 +1,4 @@
+# $NetBSD: hacks.mk,v 1.3 2008/02/05 22:03:57 tnn Exp $
+
+# gcc 2.95 does not understand -Wfloat-equal
+BUILDLINK_TRANSFORM+=  rm:-Wfloat-equal
diff --git a/dbus-dfbsd/options.mk b/dbus-dfbsd/options.mk
new file mode 100644 (file)
index 0000000..8f73d02
--- /dev/null
@@ -0,0 +1,65 @@
+# $NetBSD: options.mk,v 1.10 2016/02/26 10:24:12 jperkin Exp $
+
+PKG_OPTIONS_VAR=       PKG_OPTIONS.dbus
+PKG_SUPPORTED_OPTIONS+=        debug x11 enable-in-rcvar
+PKG_SUGGESTED_OPTIONS= x11
+
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+= enable-in-rcvar        
+.endif
+
+.if (${OPSYS} == "NetBSD"  ||  \
+     ${OPSYS} == "FreeBSD" ||  \
+     ${OPSYS} == "OpenBSD" ||  \
+     ${OPSYS} == "Darwin" ||   \
+     ${OPSYS} == "DragonFly")
+PKG_SUPPORTED_OPTIONS+=        kqueue
+PKG_SUGGESTED_OPTIONS+=        kqueue
+.endif
+
+# We may want to make it SUGGESTED once we have a framework for
+# launchd support. See PR/49591.
+PKG_SUPPORTED_OPTIONS.Darwin+= launchd
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CONFIGURE_ARGS+=       --enable-asserts
+CONFIGURE_ARGS+=       --enable-verbose-mode
+.else
+CONFIGURE_ARGS+=       --disable-asserts
+CONFIGURE_ARGS+=       --disable-verbose-mode
+.endif
+
+.if !empty(PKG_OPTIONS:Mkqueue)
+CONFIGURE_ARGS+=       --enable-kqueue
+.else
+CONFIGURE_ARGS+=       --disable-kqueue
+.endif
+
+.if !empty(PKG_OPTIONS:Mx11)
+CONFIGURE_ARGS+=       --with-x
+.  include "../../x11/libX11/buildlink3.mk"
+BUILDLINK_DEPMETHOD.libXt=     build
+.  include "../../x11/libXt/buildlink3.mk"
+.else
+CONFIGURE_ARGS=                --without-x
+.endif
+
+.if !empty(PKG_OPTIONS:Mlaunchd)
+MESSAGE_SRC+=                  MESSAGE.launchd
+PLIST.launchd=                 yes
+CONFIGURE_ARGS+=               --enable-launchd
+CONFIGURE_ARGS+=               --with-launchd-agent-dir=${PREFIX}/Library/LaunchAgents
+.else
+CONFIGURE_ARGS+=               --disable-launchd
+.endif
+
+
+.if !empty(PKG_OPTIONS:Menable-in-rcvar)
+DBUS_RCVAR=            dbus_enable
+.else
+DBUS_RCVAR=            dbus
+.endif
+
+FILES_SUBST+=          DBUS_RCVAR=${DBUS_RCVAR}
diff --git a/dbus-dfbsd/patches/patch-ak b/dbus-dfbsd/patches/patch-ak
new file mode 100644 (file)
index 0000000..6947b58
--- /dev/null
@@ -0,0 +1,15 @@
+$NetBSD: patch-ak,v 1.5 2015/12/06 11:35:55 wiz Exp $
+
+Adapt path for pkgsrc.
+
+--- dbus/Makefile.in.orig      2015-08-25 15:52:09.000000000 +0000
++++ dbus/Makefile.in
+@@ -589,7 +589,7 @@ dbusdatadir = $(datadir)/dbus-1
+ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \
+       $(DBUS_STATIC_BUILD_CPPFLAGS) $(SYSTEMD_CFLAGS) \
+       $(VALGRIND_CFLAGS) -DDBUS_COMPILATION \
+-      -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\" \
++      -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/db/dbus/machine-id"\" \
+       -DDBUS_SYSTEM_CONFIG_FILE=\""$(dbusdatadir)/system.conf"\" \
+       -DDBUS_SESSION_CONFIG_FILE=\""$(dbusdatadir)/session.conf"\" \
+       $(NULL) $(am__append_2)
diff --git a/dbus-dfbsd/patches/patch-al b/dbus-dfbsd/patches/patch-al
new file mode 100644 (file)
index 0000000..b9fec8c
--- /dev/null
@@ -0,0 +1,27 @@
+$NetBSD: patch-al,v 1.5 2015/12/06 11:35:55 wiz Exp $
+
+Adapt path for pkgsrc.
+
+--- tools/Makefile.in.orig     2015-07-21 16:32:32.000000000 +0000
++++ tools/Makefile.in
+@@ -428,7 +428,7 @@ AM_CPPFLAGS = \
+       $(DBUS_STATIC_BUILD_CPPFLAGS) \
+       $(DBUS_X_CFLAGS) \
+       -DDBUS_COMPILATION \
+-      -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\" \
++      -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/db/dbus/machine-id"\" \
+       $(NULL)
+@@ -847,9 +847,9 @@ uninstall-am: uninstall-binPROGRAMS
+ .PRECIOUS: Makefile
+-# create the /var/lib/dbus directory for dbus-uuidgen
++# create the /var/db/dbus directory for dbus-uuidgen
+ install-data-local:
+-      $(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/dbus
++      $(MKDIR_P) $(DESTDIR)$(localstatedir)/db/dbus
+ installcheck-local:
+       test -d $(DESTDIR)$(localstatedir)/lib/dbus
diff --git a/dbus-dfbsd/patches/patch-am b/dbus-dfbsd/patches/patch-am
new file mode 100644 (file)
index 0000000..d8292d2
--- /dev/null
@@ -0,0 +1,28 @@
+$NetBSD: patch-am,v 1.2 2015/12/06 11:35:55 wiz Exp $
+
+on darwin configure script picks up private per-user tmp directory
+in /var/folders/xx/...+++... via the TMPDIR environment and cheerfully
+installs it in /usr/pkg/etc/dbus-1/session.conf meaning that only the
+user who installed the package will be able to write to that directory...
+except that dbus rejects directories with "+"'s in the filename so it
+won't work anyway.   use configure --with-session-socket-dir=/tmp
+to work around this.   found a description of this issue here:
+http://wiki.gnucash.org/wiki/MacOSX/Quartz in the
+"Running from the commandline" section.
+
+dbus also cannot cope with $DISPLAY containing "/" chars (like in
+darwin ... /tmp/launch-kcvznx/:0 ) so get rid of the ":" as described
+here:
+ https://trac.macports.org/attachment/ticket/16833/patch-dbus-launch-x11.c.diff
+
+--- tools/dbus-launch-x11.c.orig       2008-11-14 22:45:04.000000000 -0500
++++ tools/dbus-launch-x11.c    2008-11-14 22:45:44.000000000 -0500
+@@ -143,7 +143,7 @@
+    */
+   for (p = display; *p; ++p)
+     {
+-      if (*p == ':')
++      if (*p == ':' || *p == '/')
+         *p = '_';
+     }
+   
diff --git a/dbus-dfbsd/patches/patch-dbus_dbus-sysdeps-util-unix.c b/dbus-dfbsd/patches/patch-dbus_dbus-sysdeps-util-unix.c
new file mode 100644 (file)
index 0000000..85dc387
--- /dev/null
@@ -0,0 +1,57 @@
+$NetBSD: patch-dbus_dbus-sysdeps-util-unix.c,v 1.3 2014/09/13 09:47:11 richard Exp $
+
+add solaris specific console_user test
+
+--- dbus/dbus-sysdeps-util-unix.c.orig 2014-01-25 12:39:25.000000000 +0000
++++ dbus/dbus-sysdeps-util-unix.c
+@@ -54,6 +54,10 @@
+ #include <syslog.h>
+ #endif
++#if defined(__sun) && defined(__SVR4)
++#include <pwd.h>
++#endif
++
+ #ifdef HAVE_SYS_SYSLIMITS_H
+ #include <sys/syslimits.h>
+ #endif
+@@ -556,8 +560,31 @@ _dbus_user_at_console (const char *usern
+   DBusString u, f;
+   dbus_bool_t result;
++#if defined(__sun) && defined(__SVR4)
++  struct passwd *passwd_entry;
++#endif
+   result = FALSE;
++
++#if defined(__sun) && defined(__SVR4)
++  passwd_entry = getpwnam (username);
++  if (passwd_entry != NULL)
++    {
++      struct stat st;
++      uid_t uid;
++
++      uid = passwd_entry->pw_uid;
++
++      if (stat ("/dev/vt/console_user", &st) == 0 && st.st_uid == uid)
++        {
++         /*
++          * Owner is allowed to take over. Before we have real
++          * ownership in HAL, assume it's the console owner.
++          */
++          result = TRUE;
++        }
++    }
++#else
+   if (!_dbus_string_init (&f))
+     {
+       _DBUS_SET_OOM (error);
+@@ -582,6 +609,7 @@ _dbus_user_at_console (const char *usern
+  out:
+   _dbus_string_free (&f);
++#endif
+   return result;
+ }
diff --git a/dbus-dfbsd/patches/patch-tools_dbus-print-message.c b/dbus-dfbsd/patches/patch-tools_dbus-print-message.c
new file mode 100644 (file)
index 0000000..14ac515
--- /dev/null
@@ -0,0 +1,16 @@
+$NetBSD: patch-tools_dbus-print-message.c,v 1.2 2015/12/06 11:35:55 wiz Exp $
+
+Fix build on NetBSD 5.x and 6.x.
+
+--- tools/dbus-print-message.c.orig    2015-10-07 20:10:37.000000000 +0000
++++ tools/dbus-print-message.c
+@@ -30,6 +30,9 @@
+ #include <sys/un.h>
+ #include <unistd.h>
+ #include <netinet/in.h>
++#ifdef __NetBSD__
++#include <netinet/in_systm.h>
++#endif
+ #include <netinet/ip.h>
+ #include <arpa/inet.h>
+ #endif