diff -ruN x2goserver_3.0.99.10.orig/x2goserver/Makefile x2goserver_3.0.99.10/x2goserver/Makefile
--- x2goserver_3.0.99.10.orig/x2goserver/Makefile	2012-02-01 13:41:59.000000000 +0100
+++ x2goserver_3.0.99.10/x2goserver/Makefile	2012-02-07 13:52:15.310405613 +0100
@@ -3,9 +3,15 @@
 SRC_DIR=$(CURDIR)
 SHELL=/bin/bash
 
-INSTALL_DIR=install -d -o root -g root -m 755
-INSTALL_FILE=install -o root -g root -m 644
-INSTALL_PROGRAM=install -o root -g root -m 755
+INSTALL_TYPE=
+ifeq ($(INSTALL_TYPE),pkgbuild)
+INSTALL_OWNER=
+else
+INSTALL_OWNER=-o root -g root
+endif
+INSTALL_DIR=install $(INSTALL_OWNER) -d -m 755
+INSTALL_FILE=install $(INSTALL_OWNER) -m 644
+INSTALL_PROGRAM=install $(INSTALL_OWNER) -m 755
 
 RM_FILE=rm -f
 RM_DIR=rmdir -p --ignore-fail-on-non-empty
diff -ruN x2goserver_3.0.99.10.orig/x2goserver-compat/Makefile x2goserver_3.0.99.10/x2goserver-compat/Makefile
--- x2goserver_3.0.99.10.orig/x2goserver-compat/Makefile	2012-02-01 13:41:59.000000000 +0100
+++ x2goserver_3.0.99.10/x2goserver-compat/Makefile	2012-02-07 13:52:37.598261233 +0100
@@ -3,9 +3,15 @@
 SRC_DIR=$(CURDIR)
 SHELL=/bin/bash
 
-INSTALL_DIR=install -d -o root -g root -m 755
-INSTALL_FILE=install -o root -g root -m 644
-INSTALL_PROGRAM=install -o root -g root -m 755
+INSTALL_TYPE=
+ifeq ($(INSTALL_TYPE),pkgbuild)
+INSTALL_OWNER=
+else
+INSTALL_OWNER=-o root -g root
+endif
+INSTALL_DIR=install $(INSTALL_OWNER) -d -m 755
+INSTALL_FILE=install $(INSTALL_OWNER) -m 644
+INSTALL_PROGRAM=install $(INSTALL_OWNER) -m 755
 
 RM_FILE=rm -f
 RM_DIR=rmdir -p --ignore-fail-on-non-empty
diff -ruN x2goserver_3.0.99.10.orig/x2goserver-extensions/Makefile x2goserver_3.0.99.10/x2goserver-extensions/Makefile
--- x2goserver_3.0.99.10.orig/x2goserver-extensions/Makefile	2012-02-01 13:41:59.000000000 +0100
+++ x2goserver_3.0.99.10/x2goserver-extensions/Makefile	2012-02-07 13:52:57.861130005 +0100
@@ -3,9 +3,15 @@
 SRC_DIR=$(CURDIR)
 SHELL=/bin/bash
 
-INSTALL_DIR=install -d -o root -g root -m 755
-INSTALL_FILE=install -o root -g root -m 644
-INSTALL_PROGRAM=install -o root -g root -m 755
+INSTALL_TYPE=
+ifeq ($(INSTALL_TYPE),pkgbuild)
+INSTALL_OWNER=
+else
+INSTALL_OWNER=-o root -g root
+endif
+INSTALL_DIR=install $(INSTALL_OWNER) -d -m 755
+INSTALL_FILE=install $(INSTALL_OWNER) -m 644
+INSTALL_PROGRAM=install $(INSTALL_OWNER) -m 755
 
 RM_FILE=rm -f
 RM_DIR=rmdir -p --ignore-fail-on-non-empty
diff -ruN x2goserver_3.0.99.10.orig/x2goserver-printing/Makefile x2goserver_3.0.99.10/x2goserver-printing/Makefile
--- x2goserver_3.0.99.10.orig/x2goserver-printing/Makefile	2012-02-01 13:41:59.000000000 +0100
+++ x2goserver_3.0.99.10/x2goserver-printing/Makefile	2012-02-07 13:53:44.101830615 +0100
@@ -3,9 +3,15 @@
 SRC_DIR=$(CURDIR)
 SHELL=/bin/bash
 
-INSTALL_DIR=install -d -o root -g root -m 755
-INSTALL_FILE=install -o root -g root -m 644
-INSTALL_PROGRAM=install -o root -g root -m 755
+INSTALL_TYPE=
+ifeq ($(INSTALL_TYPE),pkgbuild)
+INSTALL_OWNER=
+else
+INSTALL_OWNER=-o root -g root
+endif
+INSTALL_DIR=install $(INSTALL_OWNER) -d -m 755
+INSTALL_FILE=install $(INSTALL_OWNER) -m 644
+INSTALL_PROGRAM=install $(INSTALL_OWNER) -m 755
 
 RM_FILE=rm -f
 RM_DIR=rmdir -p --ignore-fail-on-non-empty
diff -ruN x2goserver_3.0.99.10.orig/x2goserver-pyhoca/Makefile x2goserver_3.0.99.10/x2goserver-pyhoca/Makefile
--- x2goserver_3.0.99.10.orig/x2goserver-pyhoca/Makefile	2012-02-01 13:41:59.000000000 +0100
+++ x2goserver_3.0.99.10/x2goserver-pyhoca/Makefile	2012-02-07 13:54:51.006397655 +0100
@@ -3,9 +3,15 @@
 SRC_DIR=$(CURDIR)
 SHELL=/bin/bash
 
-INSTALL_DIR=install -d -o root -g root -m 755
-INSTALL_FILE=install -o root -g root -m 644
-INSTALL_PROGRAM=install -o root -g root -m 755
+INSTALL_TYPE=
+ifeq ($(INSTALL_TYPE),pkgbuild)
+INSTALL_OWNER=
+else
+INSTALL_OWNER=-o root -g root
+endif
+INSTALL_DIR=install $(INSTALL_OWNER) -d -m 755
+INSTALL_FILE=install $(INSTALL_OWNER) -m 644
+INSTALL_PROGRAM=install $(INSTALL_OWNER) -m 755
 
 RM_FILE=rm -f
 RM_DIR=rmdir -p --ignore-fail-on-non-empty
diff -ruN x2goserver_3.0.99.10.orig/x2goserver-xsession/Makefile x2goserver_3.0.99.10/x2goserver-xsession/Makefile
--- x2goserver_3.0.99.10.orig/x2goserver-xsession/Makefile	2012-02-01 13:41:59.000000000 +0100
+++ x2goserver_3.0.99.10/x2goserver-xsession/Makefile	2012-02-07 13:51:33.795674609 +0100
@@ -3,17 +3,24 @@
 SRC_DIR=$(CURDIR)
 SHELL=/bin/bash
 
-INSTALL_DIR=install -d -o root -g root -m 755
-INSTALL_FILE=install -o root -g root -m 644
+INSTALL_TYPE=
+ifeq ($(INSTALL_TYPE),pkgbuild)
+INSTALL_OWNER=
+else
+INSTALL_OWNER=-o root -g root
+endif
+INSTALL_DIR=install $(INSTALL_OWNER) -d -m 755
+INSTALL_FILE=install $(INSTALL_OWNER) -m 644
+INSTALL_PROGRAM=install $(INSTALL_OWNER) -m 755
 INSTALL_SYMLINK=ln -s -f
-INSTALL_PROGRAM=install -o root -g root -m 755
 
 RM_FILE=rm -f
 RM_DIR=rmdir -p --ignore-fail-on-non-empty
 
 DESTDIR=
 PREFIX=/usr/local
-ETCDIR=/etc/x2go
+SYSCONFDIR=/etc
+ETCDIR=$(SYSCONFDIR)/x2go
 #BINDIR=$(PREFIX)/bin
 #SBINDIR=$(PREFIX)/sbin
 #LIBDIR=$(PREFIX)/lib/x2go
@@ -64,9 +71,9 @@
 install_config:
 	$(INSTALL_DIR) $(DESTDIR)$(ETCDIR)
 #       provide target dirs for X11 related symlinks
-	mkdir -p $(DESTDIR)/etc/X11/Xresources
-	mkdir -p $(DESTDIR)/etc/X11/Xsession.d
-	touch $(DESTDIR)/etc/X11/Xsession.options
+	mkdir -p $(DESTDIR)$(SYSCONFDIR)/X11/Xresources
+	mkdir -p $(DESTDIR)$(SYSCONFDIR)/X11/Xsession.d
+	touch $(DESTDIR)$(SYSCONFDIR)/X11/Xsession.options
 	$(INSTALL_FILE) etc/Xsession                    $(DESTDIR)$(ETCDIR)/
 	$(INSTALL_SYMLINK) /etc/X11/Xresources          $(DESTDIR)$(ETCDIR)/
 	$(INSTALL_SYMLINK) /etc/X11/Xsession.d          $(DESTDIR)$(ETCDIR)/

