Subject: Re: KDE, gtk2+ and hicolor-icon-theme
To: Julio M. Merino Vidal <jmmv84@gmail.com>
From: Mark Davies <mark@mcs.vuw.ac.nz>
List: tech-pkg
Date: 01/19/2007 12:02:13
--Boundary-00=_1x/rFGkdebHvWpz
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Thursday 18 January 2007 22:08, Julio M. Merino Vidal wrote:


> hicolor-icon-theme could be modified to only run the
> gtk-update-icon-cache utility if, and only if, it is already
> installed. Be aware that doing so will also require changes to gtk2
> so that the utility is run if gtk2 is installed _after_
> hicolor-icon-theme.

> (This scheme could be applicable to many other install scripts that
> we have
> in pkgsrc now...  I guess this could be generalized to that
> "triggers" proposal, made by joerg@ IIRC.)

I don't remember the "triggers" proposal but below is a first cut at 
the specific case.

I don't particularly like the ${PREFIX} in referencing the path from 
the other package - is there a way to do the equivalent of 
${BUILDLINK_PREFIX.package} without pulling in a dependency on the 
package?  Also not sure how this interacts with pkgviews or the 
destdir stuff.

cheers
mark

--Boundary-00=_1x/rFGkdebHvWpz
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="gtk2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="gtk2.diff"

Index: Makefile
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/x11/gtk2/Makefile,v
retrieving revision 1.133
diff -u -r1.133 Makefile
--- Makefile	5 Dec 2006 21:26:58 -0000	1.133
+++ Makefile	18 Jan 2007 22:54:13 -0000
@@ -76,6 +76,12 @@
 	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/lib/gtk-2.0/modules
 	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/lib/gtk-2.0/2.10.0/filesystems
 
+FILES_SUBST+=		GTK_UPDATE_ICON_CACHE="${PREFIX}/bin/gtk-update-icon-cac
+he"
+FILES_SUBST+=		ICON_THEME_DIR="${PREFIX}/share/icons/hicolor"
+INSTALL_TEMPLATES+=	../../x11/gtk2/files/icon-cache.tmpl
+PRINT_PLIST_AWK+=	/^share\/icons\/hicolor\/icon-theme.cache$$/ { next; }
+
 _BUILDING_GTK2=	yes
 .include "modules.mk"
 
--- /dev/null	2007-01-19 11:29:15.000000000 +1300
+++ files/icon-cache.tmpl	2007-01-19 11:25:34.000000000 +1300
@@ -0,0 +1,17 @@
+# $NetBSD: icon-cache.tmpl,v 1.1 2006/03/30 20:47:44 jmmv Exp $
+#
+# Rebuild the icon cache.
+#
+
+GTK_UPDATE_ICON_CACHE="@GTK_UPDATE_ICON_CACHE@"
+ICON_THEME_DIR="@ICON_THEME_DIR@"
+
+case ${STAGE} in
+POST-INSTALL)
+	${TEST} -d ${ICON_THEME_DIR} && \
+	${GTK_UPDATE_ICON_CACHE} -f -t ${ICON_THEME_DIR} >/dev/null 2>&1 || \
+		${TRUE}
+	;;
+*)
+	;;
+esac

--Boundary-00=_1x/rFGkdebHvWpz
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="hicolor.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="hicolor.diff"

Index: Makefile
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/graphics/hicolor-icon-theme/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- Makefile	28 Nov 2006 22:02:34 -0000	1.13
+++ Makefile	18 Jan 2007 22:22:01 -0000
@@ -18,11 +18,11 @@
 USE_LANGUAGES=	# none, not even C
 USE_TOOLS+=	gmake
 
-FILES_SUBST+=		GTK_UPDATE_ICON_CACHE="${BUILDLINK_PREFIX.gtk2}/bin/gtk-update-icon-cache"
+FILES_SUBST+=		GTK_UPDATE_ICON_CACHE="${PREFIX}/bin/gtk-update-icon-cache"
 FILES_SUBST+=		ICON_THEME_DIR="${PREFIX}/share/icons/hicolor"
 INSTALL_TEMPLATES+=	../../graphics/hicolor-icon-theme/files/icon-cache.tmpl
 DEINSTALL_TEMPLATES+=	../../graphics/hicolor-icon-theme/files/icon-cache.tmpl
 PRINT_PLIST_AWK+=	/^share\/icons\/hicolor\/icon-theme.cache$$/ { next; }
 
-.include "../../x11/gtk2/buildlink3.mk"
+#.include "../../x11/gtk2/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
Index: buildlink3.mk
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/graphics/hicolor-icon-theme/buildlink3.mk,v
retrieving revision 1.12
diff -u -r1.12 buildlink3.mk
--- buildlink3.mk	12 Dec 2006 21:52:36 -0000	1.12
+++ buildlink3.mk	18 Jan 2007 22:20:48 -0000
@@ -27,8 +27,8 @@
 .  undef dirs
 
 .if !defined(HICOLOR_ICON_THEME_DEPEND_ONLY)
-.include  "../../x11/gtk2/buildlink3.mk"
-FILES_SUBST+=		GTK_UPDATE_ICON_CACHE="${BUILDLINK_PREFIX.gtk2}/bin/gtk-update-icon-cache"
+#.include  "../../x11/gtk2/buildlink3.mk"
+FILES_SUBST+=		GTK_UPDATE_ICON_CACHE="${PREFIX}/bin/gtk-update-icon-cache"
 FILES_SUBST+=		ICON_THEME_DIR="${BUILDLINK_PREFIX.hicolor-icon-theme}/share/icons/hicolor"
 INSTALL_TEMPLATES+=	../../graphics/hicolor-icon-theme/files/icon-cache.tmpl
 DEINSTALL_TEMPLATES+=	../../graphics/hicolor-icon-theme/files/icon-cache.tmpl
Index: files/icon-cache.tmpl
===================================================================
RCS file: /src/cvs/netbsd/pkgsrc/graphics/hicolor-icon-theme/files/icon-cache.tmpl,v
retrieving revision 1.1
diff -u -r1.1 icon-cache.tmpl
--- files/icon-cache.tmpl	30 Mar 2006 20:47:44 -0000	1.1
+++ files/icon-cache.tmpl	18 Jan 2007 22:16:44 -0000
@@ -8,6 +8,7 @@
 
 case ${STAGE} in
 POST-INSTALL)
+	${TEST} -x ${GTK_UPDATE_ICON_CACHE} && \
 	${GTK_UPDATE_ICON_CACHE} -f -t ${ICON_THEME_DIR} >/dev/null 2>&1 || \
 		${TRUE}
 	;;
@@ -17,6 +18,7 @@
 	;;
 POST-DEINSTALL)
 	${TEST} "${PKGBASE}" != "hicolor-icon-theme" && \
+		${TEST} -x ${GTK_UPDATE_ICON_CACHE} && \
 		${GTK_UPDATE_ICON_CACHE} -f -t ${ICON_THEME_DIR} >/dev/null \
 			2>&1 || ${TRUE}
 	;;

--Boundary-00=_1x/rFGkdebHvWpz--