From 5b879a05dba7ec6528b5bc18c3dad40a4e68e8dc Mon Sep 17 00:00:00 2001
From: gusi <gusi@df743ca5-7f9a-e211-a948-0013205c9059>
Date: Thu, 7 Nov 2013 19:21:23 +0000
Subject: Fix gdm to work with our gnome3.6 stack:

	- add three pam services needed by gdm 3.6. Those are taken from the OpenBSD
	  port
	- remove the unneeded gdm-welcome pam service
	- add the files/patch-daemon_gdm-session.c which fixes the credentials
	  retrieval (this one will be send upstream)
	- tidy up and rework the options given to the configure
	  system
	- stagify the port (it leaves two dirs left)
	- while here, check lib_depends follows the new style

Note that the port is a bit fragile and may break. If it does please report.
Also note that this gdm needs the updated dconf (r18855) to work.


git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@18858 df743ca5-7f9a-e211-a948-0013205c9059
---
 x11/gdm/Makefile                                   | 50 ++++++++++++++--------
 x11/gdm/files/gdm-autologin.in                     | 12 ++++++
 x11/gdm/files/gdm-launch-environment.in            | 12 ++++++
 x11/gdm/files/gdm-password.in                      | 12 ++++++
 x11/gdm/files/patch-daemon_gdm-session.c           | 11 +++++
 x11/gdm/files/patch-data_00-upstream-settings      | 11 +++++
 ...ch-data_applications_mime-dummy-handler.desktop | 10 +++++
 x11/gdm/pkg-plist                                  | 18 +++++---
 8 files changed, 112 insertions(+), 24 deletions(-)
 create mode 100644 x11/gdm/files/gdm-autologin.in
 create mode 100644 x11/gdm/files/gdm-launch-environment.in
 create mode 100644 x11/gdm/files/gdm-password.in
 create mode 100644 x11/gdm/files/patch-daemon_gdm-session.c
 create mode 100644 x11/gdm/files/patch-data_00-upstream-settings
 create mode 100644 x11/gdm/files/patch-data_applications_mime-dummy-handler.desktop

diff --git a/x11/gdm/Makefile b/x11/gdm/Makefile
index cda43a184..fec5ee97a 100644
--- a/x11/gdm/Makefile
+++ b/x11/gdm/Makefile
@@ -1,6 +1,6 @@
 # Created by: Joe Marcus Clarke <marcus@FreeBSD.org>
 # $FreeBSD$
-#   $MCom: ports/trunk/x11/gdm3/Makefile 18610 2013-06-30 16:33:05Z marcus $
+#   $MCom$
 
 PORTNAME=	gdm
 PORTVERSION=	3.6.2
@@ -16,18 +16,18 @@ BUILD_DEPENDS=	zenity3>=3.0.0:${PORTSDIR}/x11/zenity3 \
     		${LOCALBASE}/libdata/pkgconfig/iso-codes.pc:${PORTSDIR}/misc/iso-codes
 LIB_DEPENDS=	libck-connector.so:${PORTSDIR}/sysutils/consolekit \
 		libdbus-glib-1.so:${PORTSDIR}/devel/dbus-glib \
-		libpolkit-gtk-1.so:${PORTSDIR}/sysutils/polkit-gnome \
 		libupower-glib.so:${PORTSDIR}/sysutils/upower \
 		libnss3.so:${PORTSDIR}/security/nss \
 		libfontconfig.so:${PORTSDIR}/x11-fonts/fontconfig \
 		libaccountsservice.so:${PORTSDIR}/sysutils/accountsservice \
-		libxklavier.so:${PORTSDIR}/x11/libxklavier \
+		libexecinfo.so:${PORTSDIR}/devel/libexecinfo \
 		libcanberra-gtk3.so:${PORTSDIR}/audio/libcanberra-gtk3
 RUN_DEPENDS=	zenity3>=3.0.0:${PORTSDIR}/x11/zenity3 \
 		gnome-settings-daemon>=3.0.0:${PORTSDIR}/sysutils/gnome-settings-daemon \
 		gnome-keyring-3:${PORTSDIR}/security/gnome-keyring3 \
 		gnome-session>=3.0.0:${PORTSDIR}/x11/gnome-session \
 		gnome-icon-theme-symbolic>=0:${PORTSDIR}/x11-themes/gnome-icon-theme-symbolic \
+		polkit-gnome>=0.105:${PORTSDIR}/sysutils/polkit-gnome \
 		${LOCALBASE}/libexec/at-spi2-registryd:${PORTSDIR}/accessibility/at-spi2-core \
 		${LOCALBASE}/libdata/pkgconfig/iso-codes.pc:${PORTSDIR}/misc/iso-codes
 # used in scripts
@@ -36,9 +36,12 @@ RUN_DEPENDS+=	xrdb:${PORTSDIR}/x11/xrdb \
 		xmodmap:${PORTSDIR}/x11/xmodmap \
 		xterm:${PORTSDIR}/x11/xterm
 
+CONFLICTS=	gdm-2.[0-9]*
+
 USERS=		gdm
 GROUPS=		gdm
 
+LATEST_LINK=	gdm3
 USE_XZ=		yes
 USE_LDCONFIG=	yes
 USE_XORG=	dmx dmxproto
@@ -47,25 +50,35 @@ INSTALLS_ICONS=	yes
 USE_RC_SUBR=	gdm
 USE_GNOME_SUBR=	yes
 USES=		gettext gmake pathfix pkgconfig
-USE_GNOME=	dconf gnomehier gnomeprefix intlhack librsvg2 gnomepanel3
+USE_GNOME=	dconf gnomehier gnomeprefix intlhack introspection librsvg2 gnomepanel3
 GNU_CONFIGURE=	yes
 GLIB_SCHEMAS=	org.gnome.login-screen.gschema.xml
-CONFIGURE_ARGS=	--with-working-directory=${PREFIX}/etc/gdm/home \
+CONFIGURE_ARGS=	--disable-static \
+		--mandir=${PREFIX}/man \
+		--with-lang-file=${PREFIX}/etc/gdm/i18n \
 		--with-at-spi-registryd-directory=${LOCALBASE}/libexec \
+		--with-custom-conf=${PREFIX}/etc/gdm/custom.conf \
+		--with-dbus-sys=${PREFIX}/etc/dbus-1/system.d \
+		--with-log-dir=/var/log/gdm \
+		--with-working-directory=${PREFIX}/etc/gdm/home \
+		--with-sysconfsubdir=gdm \
+		--with-pid-file=/var/run/gdm.pid \
+		--with-dmconfdir=${LOCALBASE}/share/xsessions \
+		--with-screenshot-dir=/var/run/gdm/greeter \
 		--enable-authentication-scheme=pam \
-		--with-console-kit \
-		--with-initial-vt=9 \
+		--with-user=gdm \
+		--with-group=gdm \
+ 		--with-initial-vt=09 \
 		--with-systemd=no
+
 # this is a hack until we can get our own pam dir and dir in order.
 CONFIGURE_ARGS+=--with-default-pam-config=redhat
 CPPFLAGS+=	-I${LOCALBASE}/include -DHAS_SA_LEN
 LDFLAGS+=	-L${LOCALBASE}/lib
-CONFIGLIBS=	-lm
-CONFIGURE_ENV=	LIBS="${CONFIGLIBS}" \
-		GTKDOC="false" \
-		ac_cv_header_execinfo_h=no
 
-SUB_FILES+=	gdm.pam
+SUB_FILES+=	gdm-launch-environment \
+		gdm-password \
+		gdm-autologin
 
 GDMDIR?=	${PREFIX}/etc/gdm
 PKGMESSAGE=	${WRKDIR}/pkg-message
@@ -98,12 +111,9 @@ CONFIGURE_ARGS+=	--disable-ipv6
 post-patch:
 	@${REINPLACE_CMD} -e 's|root:root|root:wheel|g' \
 		${WRKSRC}/data/Makefile.in
-	@${REINPLACE_CMD} -e 's|-lexecinfo||g' \
-		${WRKSRC}/common/Makefile.in
 	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
 	    	-e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
 	    	${WRKSRC}/daemon/gdm-session-worker.c
-#		${WRKSRC}/gui/simple-greeter/extensions/password/gdm-password.pam
 	@${REINPLACE_CMD} -e 's|/usr/X11R6|${LOCALBASE}|g' \
 		-e 's|/usr/bin/X|${LOCALBASE}/bin/X|g' \
 		-e 's|/usr/bin/Xorg|${LOCALBASE}/bin/Xorg|g' \
@@ -122,15 +132,21 @@ post-patch:
 		${WRKSRC}/data/applications/gnome-mag.desktop \
 		${WRKSRC}/data/applications/gnome-shell.desktop \
 		${WRKSRC}/data/applications/gok.desktop
-#		${WRKSRC}/data/applications/orca-screen-reader.desktop
 
 post-install:
 	${INSTALL_DATA} ${WRKSRC}/data/gdm.conf-custom \
 		${STAGEDIR}${PREFIX}/etc/gdm/custom.conf.default
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/xsessions
-	${INSTALL_DATA} ${WRKDIR}/gdm.pam ${STAGEDIR}${PREFIX}/etc/pam.d/gdm-welcome
+	${MKDIR} -p ${STAGEDIR}${PREFIX}/etc/gdm/Sessions
+	${MKDIR} -p ${STAGEDIR}${PREFIX}/etc/dm/Sessions
+
+	${INSTALL_DATA} ${WRKDIR}/gdm-autologin ${STAGEDIR}${PREFIX}/etc/pam.d/gdm-autologin
+	${INSTALL_DATA} ${WRKDIR}/gdm-launch-environment ${STAGEDIR}${PREFIX}/etc/pam.d/gdm-launch-environment
+	${INSTALL_DATA} ${WRKDIR}/gdm-password ${STAGEDIR}${PREFIX}/etc/pam.d/gdm-password
+
 	@${SED} -e 's|%%PREFIX%%|${PREFIX}|g' < ${PKGDIR}/pkg-message \
 		| /usr/bin/fmt 75 79 > ${PKGMESSAGE}
+
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libgdm*.so.1
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/gdm/simple-greeter/extensions/lib*.so
 
diff --git a/x11/gdm/files/gdm-autologin.in b/x11/gdm/files/gdm-autologin.in
new file mode 100644
index 000000000..378cd549e
--- /dev/null
+++ b/x11/gdm/files/gdm-autologin.in
@@ -0,0 +1,12 @@
+# $OpenBSD: gdm-autologin,v 1.4 2012/10/10 08:47:14 ajacoutot Exp $
+#
+# gdm-autologin settings for pam(3)
+
+auth		required	pam_permit.so
+
+account		required	pam_nologin.so
+account		include		system
+
+password	include		system
+
+session		include		system
diff --git a/x11/gdm/files/gdm-launch-environment.in b/x11/gdm/files/gdm-launch-environment.in
new file mode 100644
index 000000000..f2de8abe8
--- /dev/null
+++ b/x11/gdm/files/gdm-launch-environment.in
@@ -0,0 +1,12 @@
+# $OpenBSD: gdm-launch-environment,v 1.3 2012/10/10 08:47:14 ajacoutot Exp $
+#
+# gdm-launch-environment settings for pam(3)
+
+auth		required	pam_permit.so
+
+account		required	pam_nologin.so
+account		include		system
+
+password	include		system
+
+session		include		system
diff --git a/x11/gdm/files/gdm-password.in b/x11/gdm/files/gdm-password.in
new file mode 100644
index 000000000..01ca683c7
--- /dev/null
+++ b/x11/gdm/files/gdm-password.in
@@ -0,0 +1,12 @@
+# $OpenBSD: gdm-password,v 1.4 2012/10/10 08:47:14 ajacoutot Exp $
+#
+# gdm-password settings for pam(3)
+
+auth		include		system
+
+account		required	pam_nologin.so
+account		include		system
+
+password	include		system
+
+session		include		system
diff --git a/x11/gdm/files/patch-daemon_gdm-session.c b/x11/gdm/files/patch-daemon_gdm-session.c
new file mode 100644
index 000000000..fedc0d93f
--- /dev/null
+++ b/x11/gdm/files/patch-daemon_gdm-session.c
@@ -0,0 +1,11 @@
+--- daemon/gdm-session.orig.c	2013-08-28 16:29:01.973683917 +0000
++++ daemon/gdm-session.c	2013-08-28 16:29:10.164681622 +0000
+@@ -980,7 +980,7 @@
+         native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_LINUX_UCRED);
+         pid = (GPid) ((struct ucred *) native_credentials)->pid;
+ #elif defined (__FreeBSD__)
+-        native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED);
++        native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED);
+         pid = (GPid) ((struct cmsgcred *) native_credentials)->cmcred_pid;
+ #elif defined (__OpenBSD__)
+         native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED);
diff --git a/x11/gdm/files/patch-data_00-upstream-settings b/x11/gdm/files/patch-data_00-upstream-settings
new file mode 100644
index 000000000..2ef8da4ea
--- /dev/null
+++ b/x11/gdm/files/patch-data_00-upstream-settings
@@ -0,0 +1,11 @@
+--- data/00-upstream-settings.orig	2013-08-26 09:40:51.130280797 +0000
++++ data/00-upstream-settings	2013-08-26 09:41:19.482277022 +0000
+@@ -13,7 +13,7 @@
+ show-desktop-icons=false
+ 
+ [org/gnome/desktop/default-applications/terminal]
+-exec='/bin/true'
++exec='/usr/bin/true'
+ 
+ [org/gnome/desktop/interface]
+ toolkit-accessibility=true
diff --git a/x11/gdm/files/patch-data_applications_mime-dummy-handler.desktop b/x11/gdm/files/patch-data_applications_mime-dummy-handler.desktop
new file mode 100644
index 000000000..e1183761c
--- /dev/null
+++ b/x11/gdm/files/patch-data_applications_mime-dummy-handler.desktop
@@ -0,0 +1,10 @@
+--- data/applications/mime-dummy-handler.desktop.orig	2013-08-26 10:09:17.171162980 +0000
++++ data/applications/mime-dummy-handler.desktop	2013-08-26 10:09:28.342160146 +0000
+@@ -1,6 +1,6 @@
+ [Desktop Entry]
+ Type=Application
+ Name=Dummy URI Handler
+-Exec=/bin/true %U
++Exec=/usr/bin/true %U
+ Terminal=false
+ StartupNotify=false
diff --git a/x11/gdm/pkg-plist b/x11/gdm/pkg-plist
index 0462751e1..60608a53b 100644
--- a/x11/gdm/pkg-plist
+++ b/x11/gdm/pkg-plist
@@ -4,7 +4,6 @@ etc/dbus-1/system.d/gdm.conf
 etc/dconf/db/gdm.d/00-upstream-settings
 etc/dconf/db/gdm.d/locks/00-upstream-settings-locks
 @unexec /bin/rm -f %D/etc/dconf/db/gdm
-etc/dconf/profile/gdm
 etc/gdm/Init/Default
 etc/gdm/PostLogin/Default.sample
 etc/gdm/PostSession/Default
@@ -13,27 +12,24 @@ etc/gdm/Xsession
 @unexec if cmp -s %D/etc/gdm/custom.conf %D/etc/gdm/custom.conf.default; then rm -f %D/etc/gdm/custom.conf; fi
 etc/gdm/custom.conf.default
 @exec [ -f %B/custom.conf ] || cp %B/%f %B/custom.conf
-etc/pam.d/gdm-welcome
+etc/pam.d/gdm-autologin
+etc/pam.d/gdm-launch-environment
+etc/pam.d/gdm-password
 include/gdm/gdm-client-glue.h
 include/gdm/gdm-client.h
 include/gdm/gdm-sessions.h
 include/gdm/gdm-user-switching.h
 include/gdm/simple-greeter/gdm-login-extension.h
-lib/gdm/simple-greeter/extensions/libfingerprint.a
 lib/gdm/simple-greeter/extensions/libfingerprint.la
 lib/gdm/simple-greeter/extensions/libfingerprint.so
-lib/gdm/simple-greeter/extensions/libpassword.a
 lib/gdm/simple-greeter/extensions/libpassword.la
 lib/gdm/simple-greeter/extensions/libpassword.so
-lib/gdm/simple-greeter/extensions/libsmartcard.a
 lib/gdm/simple-greeter/extensions/libsmartcard.la
 lib/gdm/simple-greeter/extensions/libsmartcard.so
 lib/girepository-1.0/Gdm-1.0.typelib
-lib/libgdm.a
 lib/libgdm.la
 lib/libgdm.so
 lib/libgdm.so.1
-lib/libgdmsimplegreeter.a
 lib/libgdmsimplegreeter.la
 lib/libgdmsimplegreeter.so
 lib/libgdmsimplegreeter.so.1
@@ -223,7 +219,12 @@ share/pixmaps/nobody.png
 share/pixmaps/nohost.png
 @exec mkdir -p %D/share/xsessions
 @exec dconf update
+@unexec /bin/rm -f %D/etc/dconf/profile/gdm
 @unexec dconf update
+@cwd /
+@dirrmtry var/run/gdm
+@dirrmtry var/log/gdm
+@cwd
 @dirrm /var/gdm
 @dirrm /var/cache/gdm
 @dirrmtry share/xsessions
@@ -269,11 +270,14 @@ share/pixmaps/nohost.png
 @dirrmtry etc/gdm/home/.config/dconf
 @dirrmtry etc/gdm/home/.config
 @dirrmtry etc/gdm/home
+@dirrmtry etc/gdm/Sessions
 @dirrmtry etc/gdm/PreSession
 @dirrmtry etc/gdm/PostSession
 @dirrmtry etc/gdm/PostLogin
 @dirrmtry etc/gdm/Init
 @dirrmtry etc/gdm
+@dirrmtry etc/dm/Sessions
+@dirrmtry etc/dm
 @dirrm etc/dconf/db/gdm.d/locks
 @dirrm etc/dconf/db/gdm.d
 @dirrmtry share/locale/zu/LC_MESSAGES
-- 
cgit v1.2.3