23501913 input-method-cache needs to create immodules.cache instead of gtk.immodules file
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Tue, 13 Sep 2016 19:38:07 -0700
changeset 6906 a6c8d3c7b8bf
parent 6904 d731f9896dde
child 6909 6f3076f8d9bf
23501913 input-method-cache needs to create immodules.cache instead of gtk.immodules file
components/desktop/desktop-cache/Makefile
components/desktop/desktop-cache/files/input-method-cache
components/gnome/gtk2/Makefile
components/gnome/gtk2/gtk2.p5m
--- a/components/desktop/desktop-cache/Makefile	Wed Sep 14 08:05:13 2016 -0700
+++ b/components/desktop/desktop-cache/Makefile	Tue Sep 13 19:38:07 2016 -0700
@@ -27,7 +27,7 @@
 include ../../../make-rules/shared-macros.mk
 
 COMPONENT_NAME=         desktop-cache
-COMPONENT_VERSION=      0.2.8
+COMPONENT_VERSION=      0.2.9
 COMPONENT_SRC=          # all files under files/
 COMPONENT_BUGDB=	gnome/install
 
--- a/components/desktop/desktop-cache/files/input-method-cache	Wed Sep 14 08:05:13 2016 -0700
+++ b/components/desktop/desktop-cache/files/input-method-cache	Tue Sep 13 19:38:07 2016 -0700
@@ -1,6 +1,6 @@
 #!/bin/ksh -p
 #
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the
@@ -42,107 +42,53 @@
     exit 2
 fi
 
-
-#
-# for each architecture 
-#   if cache file exist 
-#      get the list of modules newer than the cache file
-#   else
-#      make list greater than zero
-#
-#   if list generate cache
-#
-
-ARCH64=`/bin/isainfo -k`
-
-if [[ $ARCH64 != "amd64" ]] && [[ "$ARCH64" != "sparcv9" ]]; then
-  ARCH64=""
-fi
-
-start_input_method_cache ()
-{
-for DIR in "" $ARCH64; do
-  test -x /usr/bin/$DIR/gtk-query-immodules-2.0 || {
-      echo "gtk-query-immodules-2.0 not installed"
-      continue
-  }
-  test -w /etc/$DIR/gtk-2.0 || {
-      echo "/etc/$DIR/gtk-2.0 is not writable, skipping."
-      return
-  }
-  if [ -a "/etc/$DIR/gtk-2.0/gtk.immodules" ]; then
-    RESULT=`${FIND_NEWER} -c -f -m --name '*.so' \
-	--newer /etc/$DIR/gtk-2.0/gtk.immodules \
-	/usr/lib/$DIR/gtk-2.0/*/immodules 2>/dev/null`
-  else
-    RESULT="no cache file"
-  fi
-
-  if [ -n "$RESULT" ]; then 
-    echo "updating/creating im modules cache file"
-    /usr/bin/$DIR/gtk-query-immodules-2.0 /usr/lib/$DIR/gtk-2.0/*/immodules/*.so \
-	> /etc/$DIR/gtk-2.0/gtk.immodules
-    if [ $? -ne 0 ]; then
-      echo "gtk-query-immodules-2.0 exited with an error while generating the cache file /etc/$DIR/gtk-2.0/gtk.immodules"
-      exit $SMF_EXIT_ERR_FATAL
-    else
-      echo "input method cache installed in /etc/$DIR/gtk-2.0/gtk.immodules"
-    fi
-  fi
-done
-}
-
-refresh_input_method_cache ()
-{
-for DIR in "" $ARCH64; do
-  test -x /usr/bin/$DIR/gtk-query-immodules-2.0 || {
-      echo "gtk-query-immodules-2.0 not installed"
-      continue
-  }
-  test -w /etc/$DIR/gtk-2.0 || {
-      echo "/etc/$DIR/gtk-2.0 is not writable, skipping."
-      return
-  }
-  if [ -a "/etc/$DIR/gtk-2.0/gtk.immodules" ]; then
-    RESULT=`/usr/bin/find /usr/lib/$DIR/gtk-2.0/*/immodules/*.so ! -type d \
-	    -follow 2>/dev/null`
-  else
-    RESULT="no cache file"
-  fi
-
-  if [ -n "$RESULT" ]; then 
-    echo "updating/creating im modules cache file"
-    /usr/bin/$DIR/gtk-query-immodules-2.0 /usr/lib/$DIR/gtk-2.0/*/immodules/*.so \
-	> /etc/$DIR/gtk-2.0/gtk.immodules
-    if [ $? -ne 0 ]; then
-      echo "gtk-query-immodules-2.0 exited with an error while generating the cache file /etc/$DIR/gtk-2.0/gtk.immodules"
-      exit $SMF_EXIT_ERR_FATAL
-    else
-      echo "input method cache installed in /etc/$DIR/gtk-2.0/gtk.immodules"
-    fi
-  fi
-done
-}
-
-METHOD=$1
-
-case "$METHOD" in
-    'start')
-	# Continue with rest of script
-	;;
-    'refresh')
+METHOD="$1"
+case $METHOD in
+    start|refresh)
 	# Continue with rest of script
 	;;
     -*)
-	echo $USAGE
+	print "$USAGE" >&2
 	exit 2
 	;;
     *)
-	echo "Invalid method $METHOD"
+	print "Invalid method $METHOD" >&2
 	exit 2
 	;;
 esac
 
-${METHOD}_input_method_cache
+for DIR in "" "/64"; do
+    MAKE_CACHE="/usr/bin$DIR/gtk-query-immodules-2.0"
+    MODULE_DIR="/usr/lib$DIR/gtk-2.0/2.10.0/immodules/"
+    CACHE_FILE="/usr/lib$DIR/gtk-2.0/2.10.0/immodules.cache"
+    
+    if [[ ! -x "${MAKE_CACHE}" ]] ; then
+	print "${MAKE_CACHE} not installed"
+	continue
+    fi
+
+    if [[ ! -r "${CACHE_FILE}" ]]; then
+	RESULT="no cache file"
+    elif [[ "${METHOD}" == "refresh" ]]; then
+	RESULT="refresh requested"
+    elif [[ "${MODULE_DIR}" -nt "${CACHE_FILE}" ]] ; then
+	RESULT="directory updated"
+    else
+	RESULT="$(${FIND_NEWER} -c -f -m --name '*.so' \
+		--newer ${CACHE_FILE} ${MODULE_DIR} 2>/dev/null)"
+    fi
+
+    if [[ -n "$RESULT" ]]; then
+	print "updating/creating im modules cache file ($RESULT)"
+	umask 022
+	${MAKE_CACHE} --update-cache
+	if [ $? -ne 0 ]; then
+	    print "${MAKE_CACHE} exited with an error while generating the cache file ${CACHE_FILE}"
+	    exit $SMF_EXIT_ERR_FATAL
+	else
+	    print "input method cache installed in ${CACHE_FILE}"
+	fi
+    fi
+done
 
 exit $SMF_EXIT_OK
--- a/components/gnome/gtk2/Makefile	Wed Sep 14 08:05:13 2016 -0700
+++ b/components/gnome/gtk2/Makefile	Tue Sep 13 19:38:07 2016 -0700
@@ -41,11 +41,7 @@
 TPNO=			24778
 
 # Requires gdk-pixbuf, which we cannot build on 11.3, so do not publish.
-ifeq ($(BUILD_TYPE), evaluation)
-BUILD_32_and_64=
-INSTALL_32_and_64=
-PUBLISH_STAMP=
-endif
+include $(WS_MAKE_RULES)/no-evaluation.mk
 
 ETCDIR.64="$(ETCDIR)/$(MACH64)"
 
@@ -65,30 +61,6 @@
 # Tell g-ir-scanner which compiler to use since upstream Makefile forgot to
 COMPONENT_BUILD_ENV += INTROSPECTION_SCANNER_ENV='CC=$(CC_FOR_BUILD)'
 
-ifneq ($(BUILD_TYPE), evaluation)
-# Generate and install architecture-specific configuration files.
-PROTOETCGTKDIR.32=	$(PROTO_DIR)/$(ETCDIR.32)/gtk-2.0
-PROTOETCGTKDIR.64=	$(PROTO_DIR)/$(ETCDIR.64)/gtk-2.0
-PROTOETCIMMCONF.32=	$(PROTOETCGTKDIR.32)/gtk.immodules
-PROTOETCIMMCONF.64=	$(PROTOETCGTKDIR.64)/gtk.immodules
-
-$(PROTOETCIMMCONF.32):
-	$(MKDIR) $(PROTOETCGTKDIR.32); \
-	LD_LIBRARY_PATH=$(PROTO_DIR)/$(USRLIB.32) \
-	  $(PROTOUSRBINDIR)/gtk-query-immodules-2.0 \
-	  $(PROTOUSRLIBDIR)/gtk-2.0/*/immodules/*.so | \
-	  $(GSED) -e "s#$(PROTO_DIR)/##" > $(PROTOETCIMMCONF.32)
-
-$(PROTOETCIMMCONF.64):
-	$(MKDIR) $(PROTOETCGTKDIR.64); \
-	LD_LIBRARY_PATH=$(PROTO_DIR)/$(USRLIB.64) \
-	  $(PROTOUSRBINDIR64)/gtk-query-immodules-2.0 \
-	  $(PROTOUSRLIBDIR64)/gtk-2.0/*/immodules/*.so | \
-	  $(GSED) -e "s#$(PROTO_DIR)/##" > $(PROTOETCIMMCONF.64)
-
-install: $(PROTOETCIMMCONF.32) $(PROTOETCIMMCONF.64)
-endif
-
 # Needed for "gmake test" to work successfully.
 unexport SHELLOPTS
 
--- a/components/gnome/gtk2/gtk2.p5m	Wed Sep 14 08:05:13 2016 -0700
+++ b/components/gnome/gtk2/gtk2.p5m	Tue Sep 13 19:38:07 2016 -0700
@@ -39,13 +39,9 @@
 set name=org.opensolaris.arc-caseid value=LSARC/2008/510
 set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
 #
-file path=etc/$(MACH64)/gtk-2.0/gtk.immodules \
-    original_name=SUNWgtk2:etc/$(MACH64)/gtk-2.0/gtk.immodules preserve=true
 file path=etc/$(MACH64)/gtk-2.0/im-multipress.conf \
     original_name=SUNWgtk2:etc/$(MACH64)/gtk-2.0/im-multipress.conf \
     preserve=true
-file path=etc/gtk-2.0/gtk.immodules \
-    original_name=SUNWgtk2:etc/gtk-2.0/gtk.immodules preserve=true
 file path=etc/gtk-2.0/im-multipress.conf \
     original_name=SUNWgtk2:etc/gtk-2.0/im-multipress.conf preserve=true
 file path=usr/bin/$(MACH64)/gtk-builder-convert
@@ -664,3 +660,5 @@
 depend type=conditional \
     fmri=pkg:/library/desktop/gtk2/gtk-backend-cups@$(IPS_COMPONENT_VERSION) \
     predicate=library/print/cups-libs
+# need application/desktop-cache/input-method-cache to build immodules.cache
+depend type=require fmri=pkg:/service/gnome/[email protected]