Subject: proposal for solution un unprivileged imake install issue
To: None <tech-pkg@netbsd.org>
From: Georg Schwarz <georg.schwarz@freenet.de>
List: tech-pkg
Date: 12/04/2005 22:56:37
Here's my proposal for a solution to the unprivileged imake install issue
reported earlier today. It applies to Darwin only here, but I would assume that
other systems need similar fixes.
Feedback would be very much appreciated:

In pkgsrc/pkgtools/xpkgwedge I changed:

--- Makefile.orig       2005-12-04 20:55:20.000000000 +0100
+++ Makefile    2005-12-04 21:34:24.000000000 +0100
@@ -41,6 +41,13 @@
 FILES_SUBST+=          MAKE=${IMAKE_MAKE:Q}
 USE_TOOLS+=            ${IMAKE_TOOLS}
 
+.if ${OPSYS} == "Darwin"
+PLIST_SUBST+=          IS_DARWIN=
+USE_TOOLS+=            patch
+.else
+PLIST_SUBST+=          IS_DARWIN="@comment "
+.endif
+
 .include "../../mk/x11.buildlink3.mk"
 
 post-extract:
@@ -67,5 +74,11 @@
        ${INSTALL_DATA_DIR} ${PREFIX}/lib/X11/config
        ${INSTALL_DATA} ${WRKSRC}/xpkgwedge.def ${PREFIX}/lib/X11/config
        ${INSTALL_SCRIPT} ${WRKSRC}/pkgxmkmf ${PREFIX}/bin/pkgxmkmf
+       @case ${OPSYS} in \
+       Darwin) \
+       ${INSTALL_DATA} ${X11BASE}/lib/X11/config/darwin.cf
${PREFIX}/lib/X11/config; \
+       cd ${PREFIX}/lib/X11/config && patch ${PATCH_STRIP} <
${FILESDIR}/darwin.cf.patch \
+       ;; \
+       esac
 
 .include "../../mk/bsd.pkg.mk"


and


--- PLIST.orig  2005-12-04 20:56:03.000000000 +0100
+++ PLIST       2005-12-04 20:57:23.000000000 +0100
@@ -1,3 +1,4 @@
 @comment $NetBSD: PLIST,v 1.4 2003/11/23 06:46:54 jlam Exp $
 bin/pkgxmkmf
 lib/X11/config/xpkgwedge.def
+${IS_DARWIN}lib/X11/config/darwin.cf





Comment: it looks like one cannot use ${PATCH} in Makefile, can one?

The new file cat files/darwin.cf.patch looks like this:

--- darwin.cf.orig      2005-12-04 20:52:30.000000000 +0100
+++ darwin.cf   2005-12-04 20:51:38.000000000 +0100
@@ -289,6 +289,8 @@
 # undef ServerExtraDefines
 # define ServerExtraDefines XFree86ServerDefines -UX_BYTE_ORDER -DROOTLESS
-DDDXTIME
 
+#ifndef InstallFlags
 #define InstallFlags -c -o root -g wheel
+#endif
 
 #endif /* XAppleServer */



Comment: I hope this applies to the darwin.cf provided by all versions of Darwin
out there. If not we must further differenciate.


In addition I made the follwing change:

--- pkgsrc/mk/platform/Darwin.mk.orig   2005-12-04 21:42:27.000000000 +0100
+++ pkgsrc/mk/platform/Darwin.mk        2005-12-04 21:55:47.000000000 +0100
@@ -16,6 +16,9 @@
 SU?=           /usr/bin/su
 TYPE?=         type                            # Shell builtin
 IMAKEOPTS+=    -DBuildHtmlManPages=NO
+.if defined(UNPRIVILEGED) && !empty(UNPRIVILEGED:M[Yy][Ee][Ss])
+IMAKEOPTS+=    -DInstallFlags=-c               # do not set user or group
+.endif
 
 .if !defined(PKGSRC_COMPILER) || !empty(PKGSRC_COMPILER:Mgcc)
 CPP_PRECOMP_FLAGS?=    -no-cpp-precomp # use the GNU cpp, not the OS X cpp



Or do you think it would be better to put that code in
pkgsrc/mk/unprivileged.mk?






-- 
Georg Schwarz    http://home.pages.de/~schwarz/
 georg.schwarz@freenet.de  +49 178 8545053