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

jmr at macports.org jmr at macports.org
Thu Mar 29 09:33:36 PDT 2012


Revision: 91318
          https://trac.macports.org/changeset/91318
Author:   jmr at macports.org
Date:     2012-03-29 09:33:35 -0700 (Thu, 29 Mar 2012)
Log Message:
-----------
MacPorts port: use correct pkg_resources dir instead of modifying files inside the finished pkg when possible, and greatly simplify the platform stuff

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

Modified: trunk/dports/sysutils/MacPorts/Portfile
===================================================================
--- trunk/dports/sysutils/MacPorts/Portfile	2012-03-29 16:22:41 UTC (rev 91317)
+++ trunk/dports/sysutils/MacPorts/Portfile	2012-03-29 16:33:35 UTC (rev 91318)
@@ -61,36 +61,53 @@
     delete ${destroot}${prefix}/etc/macports/variants.conf
 }
 
-set resources_scripts ${workpath}/${name}-${version}.pkg/Contents/Resources
-set resources_lang ${workpath}/${name}-${version}.pkg/Contents/Resources
+set resources_path ${workpath}/pkg_resources
+set resources_lang ${resources_path}/English.lproj
 
-post-pkg {
-    global resources_scripts resources_lang
-    if {[file exists ${resources_scripts}/English.lproj]} {
-        set resources_lang ${resources_scripts}/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_scripts}
-    file copy -force -- ${worksrcpath}/portmgr/dmg/InstallationCheck ${resources_scripts}
+    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_scripts}
-    file copy -force -- ${worksrcpath}/src/images_to_archives.tcl ${resources_scripts}
+    file copy -force -- ${worksrcpath}/src/upgrade_sources_conf_default.tcl ${resources_path}
+    file copy -force -- ${worksrcpath}/src/images_to_archives.tcl ${resources_path}
 
+    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 ${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_scripts}/InstallationCheck \
-              ${resources_scripts}/postflight \
+              ${resources_path}/InstallationCheck \
+              ${resources_path}/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 \
+            ${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
+        if {${os.major} > 8} {
+            reinplace "s|10\\.4|${macosx_deployment_target}|" ${resources_lang}/Welcome.html
+        }
+    }
 }
 
-platform darwin 8 {
-    post-pkg {
-        global resources_scripts resources_lang
-        reinplace "s|is built|contains a Universal installer|" ${resources_lang}/ReadMe.rtf
-        reinplace "s|__XVERS__|10.4|" ${resources_lang}/ReadMe.rtf \
-            ${resources_lang}/InstallationCheck.strings
+post-pkg {
+    # for older base versions
+    set lproj ${workpath}/${name}-${version}.pkg/Contents/Resources/English.lproj
+    if {[file isfile ${lproj}/Welcome.html]} {
         reinplace "s|or newer ||" ${resources_lang}/Welcome.html
-        reinplace "s|__DARWINVERS__|8|" ${resources_scripts}/InstallationCheck
+        if {${os.major} > 8} {
+            reinplace "s|10\\.4|${macosx_deployment_target}|" ${resources_lang}/Welcome.html
+        }
     }
 }
 
@@ -118,70 +135,19 @@
 }
 
 platform darwin 9 {
-    post-pkg {
-        global resources_scripts resources_lang
-        reinplace "s|is built|contains a Universal installer|" ${resources_lang}/ReadMe.rtf
-        reinplace "s|__XVERS__|10.5|" ${resources_lang}/ReadMe.rtf \
-            ${resources_lang}/InstallationCheck.strings
-        reinplace "s|10.4|10.5|" ${resources_lang}/Welcome.html
-        reinplace "s|or newer ||" ${resources_lang}/Welcome.html
-        reinplace "s|__DARWINVERS__|9|" ${resources_scripts}/InstallationCheck
-    }
-}
-
-platform darwin 9 powerpc {
-    pre-configure {
-        set sdkrootpath /Developer/SDKs/MacOSX10.5.sdk
-        if {[file exists ${sdkrootpath}]} {
-            # User has SDK installed.
-            set tclstubpath /System/Library/Frameworks/Tcl.framework/Versions/8.4/libtclstub8.4.a
-            if {![file exists ${sdkrootpath}${tclstubpath}]} {
-                ui_msg "Fixing your MacOSX10.5 installation by copying libtclstub8.4.a to ${sdkrootpath}${tclstubpath}"
-                xinstall -p ${tclstubpath} ${sdkrootpath}${tclstubpath}
-            }
-            # Supply architecture and sysroot flags to build MacPorts universal.
-            configure.cflags-append -isysroot ${sdkrootpath} -arch ppc -arch i386
-            configure.env-append SHLIB_LDFLAGS='-Wl,-syslibroot,${sdkrootpath} -arch ppc -arch i386'
-        }
-    }
-}
-
-platform darwin 9 i386 {
     # Supply architecture flags to build MacPorts universal.
     configure.cflags-append -arch ppc -arch i386
     configure.args-append SHLIB_LDFLAGS='-arch ppc -arch i386'
 }
 
-platform darwin 10 {
-    # Supply architecture flags to build MacPorts universal.
-    configure.cflags-append -arch x86_64 -arch i386
-    configure.args-append SHLIB_LDFLAGS='-arch x86_64 -arch i386'
-    post-pkg {
-        global resources_scripts resources_lang
-        reinplace "s|is built|contains a Universal installer|" ${resources_lang}/ReadMe.rtf
-        reinplace "s|__XVERS__|10.6|" ${resources_lang}/ReadMe.rtf \
-            ${resources_lang}/InstallationCheck.strings
-        reinplace "s|10.4|10.6|" ${resources_lang}/Welcome.html
-        reinplace "s|or newer ||" ${resources_lang}/Welcome.html
-        reinplace "s|__DARWINVERS__|10|" ${resources_scripts}/InstallationCheck
+platform darwin {
+    if {${os.major} >= 10} {
+        # Supply architecture flags to build MacPorts universal.
+        configure.cflags-append -arch x86_64 -arch i386
+        configure.args-append SHLIB_LDFLAGS='-arch x86_64 -arch i386'
     }
 }
 
-platform darwin 11 {
-    # Supply architecture flags to build MacPorts universal.
-    configure.cflags-append -arch x86_64 -arch i386
-    configure.args-append SHLIB_LDFLAGS='-arch x86_64 -arch i386'
-    post-pkg {
-        global resources_scripts resources_lang
-        reinplace "s|is built|contains a Universal installer|" ${resources_lang}/ReadMe.rtf
-        reinplace "s|__XVERS__|10.7|" ${resources_lang}/ReadMe.rtf \
-            ${resources_lang}/InstallationCheck.strings
-        reinplace "s|10.4|10.7|" ${resources_lang}/Welcome.html
-        reinplace "s|or newer ||" ${resources_lang}/Welcome.html
-        reinplace "s|__DARWINVERS__|11|" ${resources_scripts}/InstallationCheck
-    }
-}
-
 destroot.violate_mtree yes
 destroot.keepdirs    ${destroot}${prefix}/include \
                      ${destroot}${prefix}/lib \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120329/748ae99a/attachment-0001.html>


More information about the macports-changes mailing list