[91334] trunk/dports/sysutils/MacPorts/Portfile

jmr at macports.org jmr at macports.org
Thu Mar 29 18:33:11 PDT 2012


Revision: 91334
          https://trac.macports.org/changeset/91334
Author:   jmr at macports.org
Date:     2012-03-29 18:33:11 -0700 (Thu, 29 Mar 2012)
Log Message:
-----------
MacPorts port: distribution pkg support

Modified Paths:
--------------
    trunk/dports/sysutils/MacPorts/Portfile

Modified: trunk/dports/sysutils/MacPorts/Portfile
===================================================================
--- trunk/dports/sysutils/MacPorts/Portfile	2012-03-30 01:00:56 UTC (rev 91333)
+++ trunk/dports/sysutils/MacPorts/Portfile	2012-03-30 01:33:11 UTC (rev 91334)
@@ -61,36 +61,64 @@
     delete ${destroot}${prefix}/etc/macports/variants.conf
 }
 
-set resources_path ${workpath}/pkg_resources
-set resources_lang ${resources_path}/English.lproj
+# don't enable until releases have a Distribution file
+package.flat    no
+if {![info exists package.resources]} {
+    set package.resources ${workpath}/pkg_resources
+    set package.scripts   ${workpath}/pkg_resources
+} elseif {!${package.flat}} {
+    package.scripts   ${package.resources}
+}
+set resources_lang ${package.resources}/English.lproj
 
-#package.flat    no
-
 pre-pkg {
     file copy -force -- ${worksrcpath}/portmgr/dmg/ReadMe.rtf ${resources_lang}
     file copy -force -- ${worksrcpath}/portmgr/dmg/License.html ${resources_lang}
-    file copy -force -- ${worksrcpath}/portmgr/dmg/postflight ${resources_path}
-    file copy -force -- ${worksrcpath}/portmgr/dmg/InstallationCheck ${resources_path}
-    file copy -force -- ${worksrcpath}/portmgr/dmg/InstallationCheck.strings ${resources_lang}
-    file copy -force -- ${worksrcpath}/src/upgrade_sources_conf_default.tcl ${resources_path}
-    file copy -force -- ${worksrcpath}/src/images_to_archives.tcl ${resources_path}
+    file copy -force -- ${worksrcpath}/portmgr/dmg/postflight ${package.scripts}
+    file copy -force -- ${worksrcpath}/src/upgrade_sources_conf_default.tcl ${package.scripts}
+    file copy -force -- ${worksrcpath}/src/images_to_archives.tcl ${package.scripts}
 
-    file attributes ${resources_path}/postflight -permissions 0755
-    file attributes ${resources_path}/InstallationCheck -permissions 0755
-    file attributes ${resources_path}/upgrade_sources_conf_default.tcl -permissions 0755
-    file attributes ${resources_path}/images_to_archives.tcl -permissions 0755
+    file attributes ${package.scripts}/postflight -permissions 0755
+    file attributes ${package.scripts}/upgrade_sources_conf_default.tcl -permissions 0755
+    file attributes ${package.scripts}/images_to_archives.tcl -permissions 0755
     file attributes ${resources_lang}/ReadMe.rtf -permissions 0644
     file attributes ${resources_lang}/License.html -permissions 0644
-    file attributes ${resources_lang}/InstallationCheck.strings -permissions 0644
 
     reinplace "s|__PREFIX__|${prefix}|g" \
-              ${resources_path}/InstallationCheck \
-              ${resources_path}/postflight \
+              ${package.scripts}/postflight \
               ${resources_lang}/ReadMe.rtf
     reinplace "s|is built|contains a Universal installer|" ${resources_lang}/ReadMe.rtf
-    reinplace "s|__XVERS__|${macosx_deployment_target}|" ${resources_lang}/ReadMe.rtf \
+    reinplace "s|__XVERS__|${macosx_deployment_target}|" ${resources_lang}/ReadMe.rtf
+    if {${package.flat}} {
+        if {[file exists ${worksrcpath}/portmgr/dmg/Distribution]} {
+            file copy -force -- ${worksrcpath}/portmgr/dmg/Distribution ${workpath}
+        } else {
+            file copy -force -- ${filespath}/Distribution ${workpath}
+        }
+        file attributes ${workpath}/Distribution -permissions 0644
+        reinplace "s|__PREFIX__|${prefix}|g" ${workpath}/Distribution
+        switch $macosx_deployment_target {
+            10.4    {set xcode_cli "Command Line Support"}
+            10.5    -
+            10.6    {set xcode_cli "UNIX Development"}
+            default {set xcode_cli "Command Line Tools or UNIX Development"}
+        }
+        reinplace "s|__XCODECLITOOLS__|${xcode_cli}|g" ${workpath}/Distribution
+        reinplace "s|__XVERS__|${macosx_deployment_target}|" ${workpath}/Distribution
+        set next_major [lindex [split $macosx_deployment_target .] 0].[expr [lindex [split $macosx_deployment_target .] 1] + 1]
+        reinplace "s|__NEXT_XVERS__|$next_major|" ${workpath}/Distribution
+        reinplace "s|__VERSION__|${version}|" ${workpath}/Distribution
+    } else {
+        file copy -force -- ${worksrcpath}/portmgr/dmg/InstallationCheck ${package.resources}
+        file copy -force -- ${worksrcpath}/portmgr/dmg/InstallationCheck.strings ${resources_lang}
+        file attributes ${package.resources}/InstallationCheck -permissions 0755
+        file attributes ${resources_lang}/InstallationCheck.strings -permissions 0644
+        reinplace "s|__PREFIX__|${prefix}|g" \
+              ${package.resources}/InstallationCheck
+        reinplace "s|__DARWINVERS__|${os.major}|" ${package.resources}/InstallationCheck
+        reinplace "s|__XVERS__|${macosx_deployment_target}|" \
             ${resources_lang}/InstallationCheck.strings
-    reinplace "s|__DARWINVERS__|${os.major}|" ${resources_path}/InstallationCheck
+    }
     # won't be there before the pkg is built with older base versions
     if {[file isfile ${resources_lang}/Welcome.html]} {
         reinplace "s|or newer ||" ${resources_lang}/Welcome.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120329/6afa5215/attachment-0001.html>


More information about the macports-changes mailing list