Ignore:
Timestamp:
Oct 5, 2009, 12:35:02 PM (11 years ago)
Author:
ryandesign@…
Message:

minivmac, minivmac-devel: add machinery to build for multiple architectures; universal build is not possible until a new version of MacPorts with a fixed merge procedure (see r58777 and r58788) is released

Location:
trunk/dports/emulators/minivmac-devel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/emulators/minivmac-devel/Portfile

    r58174 r58792  
    9494set my_rom_file         vMac.ROM
    9595set my_base_options     "-maintainer MacPorts -homepage http://www.macports.org/ -cl -eol unx -nex"
    96 set my_target           ""
     96set my_archs            {}
    9797
    9898options my_variations
     
    111111}
    112112
    113 platform powerpc {
    114     set my_target mach
    115 }
    116 
    117 platform i386 {
    118     set my_target imch
     113# The universal variant is disabled until MacPorts 1.8.2 is released.
     114if {0} {
     115variant universal {
     116    configure.universal_args
     117    configure.universal_archs ppc i386
     118    set my_archs ${configure.universal_archs}
     119}
     120}
     121if {![variant_isset universal]} {
     122    switch ${os.arch} {
     123        powerpc {
     124            configure.build_arch ppc
     125        }
     126        default {
     127            configure.build_arch ${os.arch}
     128        }
     129    }
     130    set my_archs ${configure.build_arch}
    119131}
    120132
     
    182194pre-configure {
    183195    set i 0
    184     foreach {my_machine my_variation_options} ${my_variations} {
    185         if {${i} > 0} {
    186             configure.args-append {\;}
    187         }
    188         configure.args-append \
    189             ${my_base_options} \
    190             -t ${my_target} \
    191             ${my_variation_options} \
    192             -n ${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
    193         incr i
     196    foreach my_arch ${my_archs} {
     197        set my_target [my_arch_to_target ${my_arch}]
     198        foreach {my_machine my_variation_options} ${my_variations} {
     199            if {${i} > 0} {
     200                configure.args-append {\;}
     201            }
     202            configure.args-append \
     203                ${my_base_options} \
     204                -t ${my_target} \
     205                ${my_variation_options} \
     206                -n ${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
     207            incr i
     208        }
    194209    }
    195210   
     
    207222    set my_variation_dirs ""
    208223    set my_output_disk_mount [my_attach_disk_image ${worksrcpath}/output.img]
    209     foreach my_variation_dir [glob -nocomplain -type d -tails -directory ${my_output_disk_mount} *] {
    210         set my_variation_dirs "${my_variation_dirs} ${my_variation_dir}"
    211        
    212         # Get the configured source code.
    213         file copy ${my_output_disk_mount}/${my_variation_dir} ${build.dir}
    214        
    215         # Use the right compiler.
    216         reinplace "s|gcc|${configure.cc}|g" ${build.dir}/${my_variation_dir}/Makefile
    217        
    218         # Remove references to SDKs -- the 10.4u SDK is not installed by default on 10.6
    219         # and even if you install it manually it does not work here.
    220         reinplace -E {s|-isysroot /Developer/SDKs/[^ ]+||g} ${build.dir}/${my_variation_dir}/Makefile
     224    foreach my_arch ${my_archs} {
     225        file mkdir ${build.dir}/${my_arch}
     226        set my_target [my_arch_to_target ${my_arch}]
     227        foreach {my_machine unused} ${my_variations} {
     228            set my_src_dir ${my_output_disk_mount}/${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
     229            if {[file isdirectory ${my_src_dir}]} {
     230                set my_variation_dir ${my_arch}/${my_machine}
     231                set my_variation_dirs "${my_variation_dirs} [strsed ${my_variation_dir} {g/ /\\\\ /}]"
     232               
     233                # Get the configured source code.
     234                file copy ${my_src_dir} ${build.dir}/${my_variation_dir}
     235               
     236                # Use the right compiler.
     237                reinplace "s|gcc|${configure.cc}|g" ${build.dir}/${my_variation_dir}/Makefile
     238               
     239                # Remove references to SDKs -- the 10.4u SDK is not installed by default on 10.6
     240                # and even if you install it manually it does not work here.
     241                reinplace -E {s|-isysroot /Developer/SDKs/[^ ]+||g} ${build.dir}/${my_variation_dir}/Makefile
     242            }
     243        }
    221244    }
    222245    my_detach_disk_image ${my_output_disk_mount}
     
    239262    # To save space, keep only a single copy of the Resources directory.
    240263    set i 0
    241     foreach my_variation_dir [glob -type d -tails -directory ${build.dir} *] {
    242         set my_resources_dir ${build.dir}/${my_variation_dir}/minivmac.app/Contents/Resources
    243         if {0 == ${i}} {
    244             move ${my_resources_dir} ${build.dir}
    245         } else {
    246             delete ${my_resources_dir}
    247         }
    248         ln -s ${my_share_dir}/Resources ${my_resources_dir}
    249         incr i
     264    foreach my_arch ${my_archs} {
     265        set my_target [my_arch_to_target ${my_arch}]
     266        foreach {my_machine unused} ${my_variations} {
     267            if {[variant_isset universal]} {
     268                reinplace "s|${my_target}|umch|" ${build.dir}/${my_arch}/${my_machine}/minivmac.app/Contents/Info.plist
     269            }
     270            set my_resources_dir ${build.dir}/${my_arch}/${my_machine}/minivmac.app/Contents/Resources
     271            if {0 == ${i}} {
     272                move ${my_resources_dir} ${build.dir}
     273            } else {
     274                delete ${my_resources_dir}
     275            }
     276            ln -s ${my_share_dir}/Resources ${my_resources_dir}
     277            incr i
     278        }
    250279    }
    251280   
     
    260289   
    261290    # Install the programs.
    262     xinstall -d ${destroot}${my_app_dir}
    263     foreach {my_machine my_variation_options} ${my_variations} {
    264         set my_variation_dir ${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
    265         file copy ${build.dir}/${my_variation_dir}/minivmac.app \
    266             "${destroot}${my_app_dir}/Mini vMac ${my_machine}.app"
     291    foreach my_arch ${my_archs} {
     292        if {[variant_isset universal]} {
     293            set my_dest ${workpath}/pre-dest/${my_arch}
     294        } else {
     295            set my_dest ${destroot}
     296        }
     297        xinstall -d ${my_dest}${my_app_dir}
     298        foreach {my_machine unused} ${my_variations} {
     299            copy ${build.dir}/${my_arch}/${my_machine}/minivmac.app \
     300                "${my_dest}${my_app_dir}/Mini vMac ${my_machine}.app"
     301        }
     302    }
     303    if {[variant_isset universal]} {
     304        merge ${workpath}/pre-dest
     305    }
     306}
     307
     308# Converts normal arch names into Mini vMac target names.
     309proc my_arch_to_target {arch} {
     310    switch ${arch} {
     311        i386 {
     312            return imch
     313        }
     314        ppc {
     315            return mach
     316        }
     317        default {
     318            return -code error "unsupported architecture ${arch}"
     319        }
    267320    }
    268321}
  • trunk/dports/emulators/minivmac-devel/files/Makefile.in

    r57848 r58792  
    88
    99$(SUBDIRS):
    10         $(MAKE) -C $@
     10        $(MAKE) -C "$@"
Note: See TracChangeset for help on using the changeset viewer.