pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc Essentially from OBATA Akio in private mail, June 2015:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/fba66373247d
branches:  trunk
changeset: 363735:fba66373247d
user:      prlw1 <prlw1%pkgsrc.org@localhost>
date:      Wed Jun 14 16:23:09 2017 +0000

description:
Essentially from OBATA Akio in private mail, June 2015:

Introduce Icon Theme cache handling framework

Icon Theme cache files are used by GTK+ and maintained with the
gtk-update-icon-cache tool.  Each Icon Theme package duplicates
its own maintainance scripts: only the specified icon theme directory
differs.  With this framework, if packages have ICON_THEMES=yes,
associated icon themes will be detected and their cache files will
be maintained automatically.

Change cache handling behaviour as follows:
* Icon theme caches will be updated if either gtk2+ or gtk3+
  gtk-update-icon-cache tool is available.
* With installation of gtk2+ package, not only hicolor icon theme but
  also any other icon theme cache files will be updated.
* Prevent removal of icon caches at deinstall, gtk3+ may be installed and
  using them.
* Ditto with gtk3+, gtk2+ may not be installed now, so caches must be
  maintained by gtk3+.

diffstat:

 graphics/adwaita-icon-theme/Makefile      |    8 +-
 graphics/gnome-icon-theme/Makefile        |    8 +-
 graphics/gnome-icon-theme/buildlink3.mk   |   10 +--
 graphics/hicolor-icon-theme/Makefile      |    8 +-
 graphics/hicolor-icon-theme/buildlink3.mk |   12 +--
 mk/check/check-files.mk                   |    7 +-
 mk/pkginstall/bsd.pkginstall.mk           |   58 ++++++++++++++++-
 mk/pkginstall/deinstall                   |   12 +++-
 mk/pkginstall/icon-themes                 |  103 ++++++++++++++++++++++++++++++
 mk/pkginstall/install                     |    8 ++-
 mk/plist/plist.mk                         |    8 ++-
 mk/plist/print-plist.mk                   |    5 +-
 pkgtools/pkglint4/files/makevars.map      |    3 +-
 pkgtools/pkglint4/files/pkglint.pl        |    9 ++-
 x11/gtk2/Makefile                         |    5 +-
 x11/gtk2/files/icon-cache.tmpl            |   12 +-
 x11/gtk3/Makefile                         |    6 +-
 17 files changed, 227 insertions(+), 55 deletions(-)

diffs (truncated from 529 to 300 lines):

diff -r fc2a7c81d537 -r fba66373247d graphics/adwaita-icon-theme/Makefile
--- a/graphics/adwaita-icon-theme/Makefile      Wed Jun 14 16:16:34 2017 +0000
+++ b/graphics/adwaita-icon-theme/Makefile      Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2016/09/30 13:09:10 wiz Exp $
+# $NetBSD: Makefile,v 1.8 2017/06/14 16:23:09 prlw1 Exp $
 
 DISTNAME=              adwaita-icon-theme-3.22.0
 CATEGORIES=            graphics gnome
@@ -26,11 +26,7 @@
 # but isn't
 INSTALLATION_DIRS+=    share/icons/Adwaita/96x96/places
 
-FILES_SUBST+=          GTK_UPDATE_ICON_CACHE="${LOCALBASE}/bin/gtk-update-icon-cache"
-FILES_SUBST+=          ICON_THEME_DIR="${LOCALBASE}/share/icons/Adwaita"
-INSTALL_TEMPLATES+=    ../../graphics/adwaita-icon-theme/files/icon-cache.tmpl
-DEINSTALL_TEMPLATES+=  ../../graphics/adwaita-icon-theme/files/icon-cache.tmpl
-PRINT_PLIST_AWK+=      /^share\/icons\/gnome\/icon-theme.cache$$/ { next; }
+ICON_THEMES=           yes
 
 post-install:
 .for s in 16 22 24 32 48 96 256
diff -r fc2a7c81d537 -r fba66373247d graphics/gnome-icon-theme/Makefile
--- a/graphics/gnome-icon-theme/Makefile        Wed Jun 14 16:16:34 2017 +0000
+++ b/graphics/gnome-icon-theme/Makefile        Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.100 2016/07/09 06:38:21 wiz Exp $
+# $NetBSD: Makefile,v 1.101 2017/06/14 16:23:09 prlw1 Exp $
 
 DISTNAME=              gnome-icon-theme-3.12.0
 PKGREVISION=           1
@@ -27,11 +27,7 @@
 # the current pkgsrc version.
 BUILDLINK_API_DEPENDS.icon-naming-utils+=      icon-naming-utils>=0.8.90
 
-FILES_SUBST+=          GTK_UPDATE_ICON_CACHE="${LOCALBASE}/bin/gtk-update-icon-cache"
-FILES_SUBST+=          ICON_THEME_DIR="${PREFIX}/share/icons/gnome"
-INSTALL_TEMPLATES+=    ../../graphics/gnome-icon-theme/files/icon-cache.tmpl
-DEINSTALL_TEMPLATES+=  ../../graphics/gnome-icon-theme/files/icon-cache.tmpl
-PRINT_PLIST_AWK+=      /^share\/icons\/gnome\/icon-theme.cache$$/ { next; }
+ICON_THEMES=   yes
 
 post-install:
        ${LOCALBASE}/bin/rsvg-convert ${FILESDIR}/distributor-logo.svg -w 16 -h 16 -o ${DESTDIR}${PREFIX}/share/icons/gnome/16x16/places/start-here.png
diff -r fc2a7c81d537 -r fba66373247d graphics/gnome-icon-theme/buildlink3.mk
--- a/graphics/gnome-icon-theme/buildlink3.mk   Wed Jun 14 16:16:34 2017 +0000
+++ b/graphics/gnome-icon-theme/buildlink3.mk   Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.20 2015/11/25 12:50:43 jperkin Exp $
+# $NetBSD: buildlink3.mk,v 1.21 2017/06/14 16:23:09 prlw1 Exp $
 
 BUILDLINK_TREE+=       gnome-icon-theme
 
@@ -17,13 +17,7 @@
 .include "../../mk/bsd.fast.prefs.mk"
 
 .if !defined(GNOME_ICON_THEME_DEPEND_ONLY)
-FILES_SUBST+=          GTK_UPDATE_ICON_CACHE="${LOCALBASE}/bin/gtk-update-icon-cache"
-FILES_SUBST+=          ICON_THEME_DIR="${BUILDLINK_PREFIX.gnome-icon-theme}/share/icons/gnome"
-INSTALL_TEMPLATES+=    ../../graphics/gnome-icon-theme/files/icon-cache.tmpl
-DEINSTALL_TEMPLATES+=  ../../graphics/gnome-icon-theme/files/icon-cache.tmpl
-
-PRINT_PLIST_AWK+=      /^share\/icons\/gnome\/icon-theme.cache$$/ { next; }
-CHECK_FILES_SKIP+=     ${PREFIX}/share/icons/gnome/icon-theme.cache
+ICON_THEMES=   yes
 
 .if !defined(NOOP_GTK_UPDATE_ICON_CACHE)
 NOOP_GTK_UPDATE_ICON_CACHE=
diff -r fc2a7c81d537 -r fba66373247d graphics/hicolor-icon-theme/Makefile
--- a/graphics/hicolor-icon-theme/Makefile      Wed Jun 14 16:16:34 2017 +0000
+++ b/graphics/hicolor-icon-theme/Makefile      Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2015/11/25 12:50:43 jperkin Exp $
+# $NetBSD: Makefile,v 1.23 2017/06/14 16:23:09 prlw1 Exp $
 
 DISTNAME=      hicolor-icon-theme-0.13
 CATEGORIES=    graphics
@@ -14,10 +14,6 @@
 USE_LANGUAGES= # none, not even C
 USE_TOOLS+=    gmake
 
-FILES_SUBST+=          GTK_UPDATE_ICON_CACHE="${LOCALBASE}/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; }
+ICON_THEMES=   yes
 
 .include "../../mk/bsd.pkg.mk"
diff -r fc2a7c81d537 -r fba66373247d graphics/hicolor-icon-theme/buildlink3.mk
--- a/graphics/hicolor-icon-theme/buildlink3.mk Wed Jun 14 16:16:34 2017 +0000
+++ b/graphics/hicolor-icon-theme/buildlink3.mk Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.19 2015/11/25 12:50:43 jperkin Exp $
+# $NetBSD: buildlink3.mk,v 1.20 2017/06/14 16:23:09 prlw1 Exp $
 
 BUILDLINK_TREE+=       hicolor-icon-theme
 
@@ -12,16 +12,8 @@
 .include "../../mk/bsd.fast.prefs.mk"
 
 .if !defined(HICOLOR_ICON_THEME_DEPEND_ONLY)
-FILES_SUBST+=          GTK_UPDATE_ICON_CACHE="${LOCALBASE}/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
 
-# The icon-theme cache file generated by gtk-update-icon-cache should
-# never be in any PLIST.
-#
-PRINT_PLIST_AWK+=      /^share\/icons\/hicolor\/icon-theme.cache$$/ { next; }
-CHECK_FILES_SKIP+=     ${PREFIX}/share/icons/hicolor/icon-theme.cache
+ICON_THEMES=   yes
 
 .if !defined(NOOP_GTK_UPDATE_ICON_CACHE)
 NOOP_GTK_UPDATE_ICON_CACHE=
diff -r fc2a7c81d537 -r fba66373247d mk/check/check-files.mk
--- a/mk/check/check-files.mk   Wed Jun 14 16:16:34 2017 +0000
+++ b/mk/check/check-files.mk   Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-files.mk,v 1.34 2017/06/01 02:15:10 jlam Exp $
+# $NetBSD: check-files.mk,v 1.35 2017/06/14 16:23:09 prlw1 Exp $
 #
 # This file checks that the list of installed files matches the PLIST.
 # For that purpose it records the file list of LOCALBASE before and
@@ -101,6 +101,11 @@
 CHECK_FILES_SKIP+=     ${PREFIX}/.*/fonts.cache-1
 .endif
 
+# Mutable icon theme cache files
+.if !empty(ICON_THEMES:M[Yy][Ee][Ss])
+CHECK_FILES_SKIP+=     ${PREFIX}/share/icons/.*/icon-theme.cache
+.endif
+
 # Mutable charset.alias file
 CHECK_FILES_SKIP+=     ${PREFIX}/lib/charset.alias
 
diff -r fc2a7c81d537 -r fba66373247d mk/pkginstall/bsd.pkginstall.mk
--- a/mk/pkginstall/bsd.pkginstall.mk   Wed Jun 14 16:16:34 2017 +0000
+++ b/mk/pkginstall/bsd.pkginstall.mk   Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.70 2017/06/01 13:29:18 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.71 2017/06/14 16:23:09 prlw1 Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and implements the
 # common INSTALL/DEINSTALL scripts framework.  To use the pkginstall
@@ -47,6 +47,7 @@
        PKG_SYSCONFDIR_PERMS \
        PKG_SHELL \
        FONTS_DIRS.ttf FONTS_DIRS.type1 FONTS_DIRS.x11 \
+       ICON_THEMES
 _SYS_VARS.pkginstall= \
        SETUID_ROOT_PERMS \
        SETGID_GAMES_PERMS \
@@ -965,6 +966,61 @@
                ${TOUCH} ${TOUCH_ARGS} ${.TARGET};                      \
        fi
 
+# ICON_THEMES indicates whether icon theme cache files should be automatically
+#      updated with the gtk-update-con-cache tool from a GTK+ package if available.
+#      It is either YES or NO and defaults to NO.
+#
+ICON_THEMES?=  NO
+
+_INSTALL_ICON_THEMES_FILE=     ${_PKGINSTALL_DIR}/icon-themes
+_INSTALL_ICON_THEMES_DATAFILE= ${_PKGINSTALL_DIR}/icon-themes-data
+_INSTALL_UNPACK_TMPL+=         ${_INSTALL_ICON_THEMES_FILE}
+_INSTALL_DATA_TMPL+=           ${_INSTALL_ICON_THEMES_DATAFILE}
+
+# The icon theme cache is used by GTK+2 and GTK3+ applications.
+# List their update-icon-cache tools.
+#
+.if !empty(ICON_THEMES:M[Yy][Ee][Ss])
+FILES_SUBST+=          GTK2_UPDATE_ICON_CACHE=${LOCALBASE}/bin/gtk2-update-icon-cache
+FILES_SUBST+=          GTK3_UPDATE_ICON_CACHE=${LOCALBASE}/bin/gtk-update-icon-cache
+.endif
+
+${_INSTALL_ICON_THEMES_DATAFILE}:
+       ${RUN}${MKDIR} ${.TARGET:H}
+       ${RUN}${RM} -f ${.TARGET}
+       ${RUN}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
+
+.if !empty(ICON_THEMES:M[Yy][Ee][Ss])
+.PHONY: install-script-data-icon-themes
+install-script-data: install-script-data-icon-themes
+install-script-data-icon-themes:
+       ${RUN}${_FUNC_STRIP_PREFIX};                                    \
+       if ${TEST} -x ${INSTALL_FILE}; then                             \
+               ${ICON_THEMES_cmd} |                                    \
+               while read theme; do                                    \
+                       theme=`strip_prefix "$$theme"`;                 \
+                       ${ECHO} "# ICON_THEME: $$theme"                 \
+                               >> ${INSTALL_FILE};                     \
+               done;                                                   \
+               cd ${PKG_DB_TMPDIR} && ${PKGSRC_SETENV} ${INSTALL_SCRIPTS_ENV} \
+               ${_PKG_DEBUG_SCRIPT} ${INSTALL_FILE} ${PKGNAME}         \
+                       UNPACK +ICON_THEMES;                            \
+       fi
+.endif
+
+${_INSTALL_ICON_THEMES_FILE}: ${_INSTALL_ICON_THEMES_DATAFILE}
+${_INSTALL_ICON_THEMES_FILE}: ../../mk/pkginstall/icon-themes
+       ${RUN}${MKDIR} ${.TARGET:H}
+       ${RUN}                                                          \
+       ${SED} ${FILES_SUBST_SED} ../../mk/pkginstall/icon-themes > ${.TARGET}
+.if empty(ICON_THEMES:M[Yy][Ee][Ss])
+       ${RUN}                                                          \
+       if ${_ZERO_FILESIZE_P} ${_INSTALL_ICON_THEMES_DATAFILE}; then   \
+               ${RM} -f ${.TARGET};                                    \
+               ${TOUCH} ${TOUCH_ARGS} ${.TARGET};                      \
+       fi
+.endif
+
 # PKG_CREATE_USERGROUP indicates whether the INSTALL script should
 #      automatically add any needed users/groups to the system using
 #      useradd/groupadd.  It is either YES or NO and defaults to YES.
diff -r fc2a7c81d537 -r fba66373247d mk/pkginstall/deinstall
--- a/mk/pkginstall/deinstall   Wed Jun 14 16:16:34 2017 +0000
+++ b/mk/pkginstall/deinstall   Wed Jun 14 16:23:09 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: deinstall,v 1.4 2016/04/12 15:52:29 jaapb Exp $
+# $NetBSD: deinstall,v 1.5 2017/06/14 16:23:09 prlw1 Exp $
 
 case ${STAGE} in
 DEINSTALL)
@@ -14,6 +14,11 @@
        ${TEST} ! -x ./+INFO_FILES ||
                ./+INFO_FILES REMOVE ${PKG_METADATA_DIR}
        #
+       # Remove any icon theme caches.
+       #
+       ${TEST} ! -x ./+ICON_THEMES ||
+               ./+ICON_THEMES REMOVE ${PKG_METADATA_DIR}
+       #
        # Remove shells from /etc/shells.
        #
        ${TEST} ! -x ./+SHELL ||
@@ -35,6 +40,11 @@
        ${TEST} ! -x ./+FONTS ||
                ./+FONTS ${PKG_METADATA_DIR}
        #
+       # Update any icon theme caches.
+       #
+       ${TEST} ! -x ./+ICON_THEMES ||
+               ./+ICON_THEMES UPDATE ${PKG_METADATA_DIR}
+       #
        # Rebuild the system run-time library search path database.
        #
        ${TEST} ! -x ./+SHLIBS ||
diff -r fc2a7c81d537 -r fba66373247d mk/pkginstall/icon-themes
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/pkginstall/icon-themes Wed Jun 14 16:23:09 2017 +0000
@@ -0,0 +1,103 @@
+# $NetBSD: icon-themes,v 1.1 2017/06/14 16:23:09 prlw1 Exp $
+#
+# Generate an +ICON_THEMES script that handles the icon theme cache for
+# the package.
+#
+case "${STAGE},$1" in
+UNPACK,|UNPACK,+ICON_THEMES)
+       ${CAT} > ./+ICON_THEMES << 'EOF'
+#!@SH@
+#
+# +ICON_THEMES - icon theme cache management script
+#
+# Usage: ./+ICON_THEMES ADD|REMOVE [metadatadir]
+#
+# This script supports two actions, UPDATE and REMOVE, that will update or
+# remove cache files for icon themes from the package associated with
+# <metadatadir>.
+#
+# Lines starting with "# ICON_THEME: " are data read by this script that
+# name the icon theme and directory containing the "index.theme".
+#
+#      # ICON_THEME: hicolor
+#      # ICON_THEME: gnome
+#
+# For each ICON_THEME entry, if the path is relative, that it is taken to be
+# relative to ${PKG_PREFIX}/share/icons.
+#
+
+ECHO="@ECHO@"
+GREP="@GREP@"
+INSTALL_INFO="@INSTALL_INFO@"
+MKDIR="@MKDIR@"
+PWD_CMD="@PWD_CMD@"
+RM="@RM@"
+RMDIR="@RMDIR@"
+SED="@SED@"
+SORT="@SORT@"
+TEST="@TEST@"
+GTK2_UPDATE_ICON_CACHE="@GTK2_UPDATE_ICON_CACHE@"
+GTK3_UPDATE_ICON_CACHE="@GTK3_UPDATE_ICON_CACHE@"
+: ${GTK_UPDATE_ICON_CACHE=@TRUE@}
+
+SELF=$0
+ACTION=$1
+
+CURDIR=`${PWD_CMD}`
+PKG_METADATA_DIR="${2-${CURDIR}}"



Home | Main Index | Thread Index | Old Index