Index: Portfile
===================================================================
--- Portfile	(revision 116611)
+++ Portfile	(working copy)
@@ -44,14 +44,15 @@
 
 post-extract {
     if {[variant_isset gui]} {
-        copy ${filespath}/PSPP ${worksrcpath}
+        copy ${filespath}/PSPP ${filespath}/postflight ${worksrcpath}
         file attributes ${worksrcpath}/PSPP -permissions ugo+rx
     }
 }
 
 post-patch {
     if {[variant_isset gui]} {
-        reinplace s|@@PREFIX@@|${prefix}| ${worksrcpath}/PSPP
+        reinplace s|@@PREFIX@@|${prefix}| ${worksrcpath}/PSPP \
+                  ${worksrcpath}/postflight
     }
 }
 
@@ -154,7 +155,17 @@
 
 post-activate {
     system "${prefix}/bin/gtk-update-icon-cache --ignore-theme-index ${prefix}/share/icons/hicolor"
+}
 
+pre-pkg {
+    if {[variant_isset gui]} {
+        package.scripts ${package.resources}
+        file copy -force -- ${worksrcpath}/postflight ${package.scripts}
+        file attributes ${package.scripts}/postflight -permissions 0755
+        if {${package.flat}} {
+            move ${package.scripts}/postflight ${package.scripts}/postinstall
+        }
+    }
 }
 
 post-deactivate {
Index: files/postflight
===================================================================
--- files/postflight	(revision 0)
+++ files/postflight	(working copy)
@@ -0,0 +1 @@
+@@PREFIX@@/bin/gtk-update-icon-cache --ignore-theme-index @@PREFIX@@/share/icons/hicolor
