source: trunk/dports/emulators/minivmac/Portfile @ 67220

Last change on this file since 67220 was 67220, checked in by ryandesign@…, 10 years ago

minivmac, minivmac-devel: update description and long description

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 15.0 KB
Line 
1# $Id: Portfile 67220 2010-05-03 00:49:40Z ryandesign@macports.org $
2
3PortSystem              1.0
4
5name                    minivmac
6conflicts               minivmac-devel
7set my_name             minivmac
8version                 3.1.3
9categories              emulators aqua
10maintainers             ryandesign
11license                 GPLv2
12homepage                http://minivmac.sourceforge.net/
13use_zip                 yes
14platforms               macosx
15universal_variant       no
16use_parallel_build      yes
17dist_subdir             ${my_name}
18
19description             an emulator of the Macintosh Plus and other early Macintosh models
20
21long_description        The Mini vMac emulator helps preserve software made for early \
22                        Macintosh computers -- those sold by Apple from 1984 to 1996 \
23                        based on Motorola's 680x0 microprocessors. \
24                        The best-tested version emulates a Macintosh Plus, but there are \
25                        also emulations of the Macintosh 128K, 512K, 512Ke, SE, Classic, \
26                        and SE FDHD, and work on Macintosh II emulation is in progress.
27
28master_sites \
29    sourceforge:${my_name}:minivmac \
30    macports:${my_name}:macports \
31    http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/System/Older_System/System_7.0.x/:apple
32
33distname                                    ${my_name}-${version}
34set my_src                                  ${distname}.src
35set my_src_distfile                         ${my_src}.zip
36set my_bootstrap_distfile                   ${my_name}-bootstrap-3.1.2_1.zip
37set my_blanks                               blanks
38set my_blanks_distfile                      ${my_blanks}-0.2.0.zip
39set my_clipin                               clipin-1.1.0
40set my_clipin_distfile                      ${my_clipin}.zip
41set my_icons                                icnsosx-1.0.0
42set my_icons_distfile                       ${my_icons}.zip
43set my_system_disk_container                System_7.0.1.smi
44set my_system_disk_container_distfile       ${my_system_disk_container}.bin
45
46distfiles \
47    ${my_src_distfile}:minivmac \
48    ${my_bootstrap_distfile}:macports \
49    ${my_icons_distfile}:minivmac \
50    ${my_clipin_distfile}:minivmac \
51    ${my_blanks_distfile}:minivmac \
52    ${my_system_disk_container_distfile}:apple
53
54extract.only \
55    ${my_src_distfile} \
56    ${my_bootstrap_distfile} \
57    ${my_icons_distfile} \
58    ${my_blanks_distfile} \
59    ${my_clipin_distfile}
60
61checksums \
62    ${my_src_distfile} \
63        md5     5243ae167cc00920e03b4abca2b40af5 \
64        sha1    b9967ac258baf1a15785e884c306bf0d42097d45 \
65        rmd160  2af69ebf5420f8f8d0baece03664dc7326e13e38 \
66    ${my_bootstrap_distfile} \
67        md5     65fa9b7fb19a24dc6c9e711387c1bc30 \
68        sha1    4ad44559e75894d45e91ae62cc7ddb420062f968 \
69        rmd160  58884cac487a537b5d00fc6093fdfecb6ccc5a2f \
70    ${my_icons_distfile} \
71        md5     2af006506de7549be14f94317918d59a \
72        sha1    4ef79bb56b988fedfeb82a8b6cafd8066f5bbab2 \
73        rmd160  cef6d7d7578464538d0042b0d98379ae7f18fab7 \
74    ${my_clipin_distfile} \
75        md5     e094de97d1c6c214a80fb74895124c3e \
76        sha1    725f622ad6681c77e7f9f4a64d05ac1d6a103beb \
77        rmd160  5699b56c8db62b2568c8de88b6d419180b1fb73d \
78    ${my_blanks_distfile} \
79        md5     b16321d0d78048d5ec9b635f4f86b19c \
80        sha1    9b8d7e77bd05633709907f8806d976279d7a20b7 \
81        rmd160  a0784c17c5a5ca2e159762fb836c1c800762b213 \
82    ${my_system_disk_container_distfile} \
83        md5     8a4776350b15b5a516cdf7dd18e27290 \
84        sha1    d4c8b8653de9c7a9b2594dd6126ec7120e3e2e9e \
85        rmd160  89fc3780c9c5d575a8da4068dc810c1f56c70211
86
87depends_extract \
88    port:bsdiff \
89    bin:expect:expect
90
91if {${os.major} < 9} {
92    depends_extract-append port:macutil
93}
94
95set my_app_dir          "${applications_dir}/Mini vMac"
96set my_rom_dir          "~/Library/Preferences/Gryphel/mnvm_rom"
97set my_bootstrap_app    "Mini vMac Bootstrap.app"
98set my_rom_file         vMac.ROM
99set my_base_options     "-maintainer MacPorts -homepage http://www.macports.org/ -cl -eol unx -nex"
100set my_archs            {}
101
102options my_variations
103my_variations           {128K}      {-m 128K} \
104                        {512K}      {-m 128K -mem 512K} \
105                        {512Ke}     {-m 512Ke} \
106                        {Plus}      {-m Plus -im 1} \
107                        {SE}        {-m SE} \
108                        {SE FDHD}   {-m SEFDHD} \
109                        {Classic}   {-m Classic}
110
111variant unsupported description {Also build unfinished Macintosh II and IIx emulators} {
112    my_variations-append \
113                        {II}        {-m II -mem 8M -hres 800 -vres 600 -depth 3} \
114                        {IIx}       {-m IIx -mem 8M -hres 800 -vres 600 -depth 3}
115}
116
117# The universal variant is disabled until MacPorts 1.8.3 is released.
118if {0} {
119# To build the bootstrap, use "sudo port install bootstrap=yes".
120# The variant is hidden because it is useful only to the port maintainer.
121if {[tbool bootstrap]} {
122    variant bootstrap conflicts unsupported requires universal description {Build the bootstrap version of Mini vMac} {
123        my_variations   {Bootstrap} {-m Plus -sound 0 -bg 1 -speed a}
124        depends_build-append port:p7zip
125        post-destroot {
126            exec 7za a ${destroot}${my_app_dir}/${my_name}-bootstrap-${version}_${revision}.zip ${destroot}${my_app_dir}/${my_bootstrap_app}
127        }
128    }
129    default_variants +bootstrap
130}
131
132variant universal {
133    configure.universal_args
134    configure.universal_archs ppc i386
135    set my_archs ${configure.universal_archs}
136}
137}
138if {[info exists supported_archs]} {
139    supported_archs i386 ppc
140}
141if {![variant_exists universal] || ![variant_isset universal]} {
142    switch ${os.arch} {
143        powerpc {
144            configure.build_arch ppc
145        }
146        default {
147            configure.build_arch ${os.arch}
148        }
149    }
150    set my_archs ${configure.build_arch}
151}
152
153pre-fetch {
154    set my_real_rom_dir [exec osascript ${filespath}/readalias.applescript [file normalize ${my_rom_dir}]]
155    if {![file exists ${my_real_rom_dir}/${my_rom_file}] && ![file exists ${my_app_dir}/${my_rom_file}]} {
156        ui_msg "****************************************************************"
157        ui_msg "To build Mini vMac, you will need a ROM file from a Macintosh"
158        ui_msg "Plus or 512Ke. And to run it, you need a ROM file from the type"
159        ui_msg "of Mac you want to emulate. ROM files are not included with this"
160        ui_msg "package because they are copyrighted Apple software."
161        ui_msg "To create a ROM file, download the CopyRoms program from"
162        ui_msg "${homepage}extras/copyroms.html"
163        ui_msg "and transfer it to a real physical early Macintosh that you own."
164        ui_msg "Run the CopyRoms program there, then transfer the ROM file back"
165        ui_msg "to this Mac and put it in ${my_rom_dir}"
166        ui_msg "(which can be an alias or symlink if desired) or"
167        ui_msg "${my_app_dir}."
168        ui_msg "****************************************************************"
169        return -code error "${my_rom_file} not found"
170    }
171}
172
173worksrcdir              stuff
174extract.mkdir           yes
175
176post-extract {
177    # Decode the system disk container image.
178    my_system "sh ${filespath}/demacbinary.sh ${distpath}/${my_system_disk_container_distfile} ${worksrcpath}"
179   
180    # Copy the Disk Tools image from the container image. The binary patchfile applied with bspatch
181    # places an alias of the output disk at System Folder:Preferences:Gryphel:Build:output.
182    set my_system_disk_container_mount [my_attach_disk_image ${worksrcpath}/${my_system_disk_container}]
183    my_system "bspatch '${my_system_disk_container_mount}/Disk Tools.image' '${worksrcpath}/Disk Tools.dsk' '${filespath}/Disk Tools.dsk.bsdiff'"
184    my_detach_disk_image ${my_system_disk_container_mount}
185   
186    # Get a large empty disk image to store the output.
187    my_system "unzip -q ${worksrcpath}/${my_blanks}/hfs24M.zip -d ${worksrcpath}"
188   
189    # Make the data directory, where Mini vMac looks for the files it needs.
190    set my_mnvm_dat "${worksrcpath}/${my_bootstrap_app}/Contents/mnvm_dat"
191    file mkdir ${my_mnvm_dat}
192   
193    # Symlink the ROM file into the data directory.
194    ln -s ${my_app_dir}/${my_rom_file} ${my_mnvm_dat}
195   
196    # Symlink the disk images into the data directory with sequentially-numbered
197    # names so Mini vMac will find them and automatically mount them.
198    ln -s "${worksrcpath}/Disk Tools.dsk" "${my_mnvm_dat}/disk1.dsk"
199    ln -s ${worksrcpath}/output.img "${my_mnvm_dat}/disk2.dsk"
200    ln -s ${worksrcpath}/${my_src}/${my_src}.dsk "${my_mnvm_dat}/disk3.dsk"
201    ln -s ${worksrcpath}/${my_clipin}/${my_clipin}.dsk "${my_mnvm_dat}/disk4.dsk"
202}
203
204pre-configure {
205    # Set the name of the bootstrap app in the configure script.
206    xinstall -m 755 ${filespath}/configure.applescript.in ${worksrcpath}/configure.applescript
207    reinplace "s|@BOOTSTRAP_APP@|${my_bootstrap_app}|g" ${worksrcpath}/configure.applescript
208   
209    # Copy the large blank disk image to store the output.
210    # Use the .img extension so that we can mount it on Mac OS X later.
211    copy -force ${worksrcpath}/hfs24M.DSK ${worksrcpath}/output.img
212   
213    # Unrestrict the permissions on the output disk image so the Build program
214    # can write its output to it.
215    file attributes ${worksrcpath}/output.img -permissions 0777
216   
217    # Build up the combined configure args for all variations.
218    set i 0
219    foreach my_arch ${my_archs} {
220        set my_target [my_arch_to_target ${my_arch}]
221        foreach {my_machine my_variation_options} ${my_variations} {
222            if {${i} > 0} {
223                configure.args-append {\;}
224            }
225            configure.args-append \
226                ${my_base_options} \
227                -t ${my_target} \
228                ${my_variation_options} \
229                -n ${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
230            incr i
231        }
232    }
233   
234    # Launch the bootstrap Mini vMac so the configure script can talk to it.
235    my_system "open '${worksrcpath}/${my_bootstrap_app}'"
236}
237
238configure.cmd           osascript
239configure.pre_args      ./configure.applescript
240
241build.dir               ${workpath}/variations
242
243post-configure {
244    file mkdir ${build.dir}
245    set my_variation_dirs {}
246    set my_output_disk_mount [my_attach_disk_image ${worksrcpath}/output.img]
247    foreach my_arch ${my_archs} {
248        file mkdir ${build.dir}/${my_arch}
249        set my_target [my_arch_to_target ${my_arch}]
250        foreach {my_machine unused} ${my_variations} {
251            set my_src_dir ${my_output_disk_mount}/${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
252            if {[file isdirectory ${my_src_dir}]} {
253                set my_variation_dir ${my_arch}/${my_machine}
254                lappend my_variation_dirs [strsed ${my_variation_dir} {g/ /\\\\ /}]
255               
256                # Get the configured source code.
257                file copy ${my_src_dir} ${build.dir}/${my_variation_dir}
258               
259                # Use the right compiler.
260                reinplace "s|gcc|${configure.cc}|g" ${build.dir}/${my_variation_dir}/Makefile
261               
262                # Remove references to SDKs -- the 10.4u SDK is not installed by default on 10.6
263                # and even if you install it manually it does not work here.
264                reinplace -E {s|-isysroot /Developer/SDKs/[^ ]+||g} ${build.dir}/${my_variation_dir}/Makefile
265            }
266        }
267    }
268    my_detach_disk_image ${my_output_disk_mount}
269   
270    # Set up the global Makefile.
271    xinstall ${filespath}/Makefile.in ${build.dir}/Makefile
272    reinplace "s|@SUBDIRS@|[join ${my_variation_dirs}]|" ${build.dir}/Makefile
273   
274    # If no variation directories were produced by configuration, either the flags we
275    # passed in were bad, or the automation script got out of sync with the emulator;
276    # if the latter, the delays in configure.applescript may need to be adjusted.
277    if {"" == ${my_variation_dirs}} {
278        return -code error "configuration failed!"
279    }
280}
281
282set my_share_dir        ${prefix}/share/${my_name}
283
284post-build {
285    set i 0
286    foreach my_arch ${my_archs} {
287        set my_target [my_arch_to_target ${my_arch}]
288        foreach {my_machine unused} ${my_variations} {
289            if {[variant_exists universal] && [variant_isset universal]} {
290                reinplace "s|${my_target}|umch|" ${build.dir}/${my_arch}/${my_machine}/minivmac.app/Contents/Info.plist
291            }
292            if {![variant_exists bootstrap] || ![variant_isset bootstrap]} {
293                # To save space, keep only a single copy of the Resources directory.
294                set my_resources_dir ${build.dir}/${my_arch}/${my_machine}/minivmac.app/Contents/Resources
295                if {0 == ${i}} {
296                    move ${my_resources_dir} ${build.dir}
297                } else {
298                    delete ${my_resources_dir}
299                }
300                ln -s ${my_share_dir}/Resources ${my_resources_dir}
301            }
302            incr i
303        }
304    }
305   
306    if {![variant_exists bootstrap] || ![variant_isset bootstrap]} {
307        # Install the prettier icons.
308        eval xinstall -m 644 [glob ${worksrcpath}/${my_icons}/icons/*.icns] ${build.dir}/Resources
309    }
310}
311
312destroot {
313    if {![variant_exists bootstrap] || ![variant_isset bootstrap]} {
314        # Install the global Resources directory.
315        xinstall -d ${destroot}${my_share_dir}
316        copy ${build.dir}/Resources ${destroot}${my_share_dir}
317    }
318   
319    # Install the programs.
320    foreach my_arch ${my_archs} {
321        if {[variant_exists universal] && [variant_isset universal]} {
322            set my_dest ${workpath}/pre-dest/${my_arch}
323        } else {
324            set my_dest ${destroot}
325        }
326        xinstall -d ${my_dest}${my_app_dir}
327        foreach {my_machine unused} ${my_variations} {
328            copy ${build.dir}/${my_arch}/${my_machine}/minivmac.app \
329                "${my_dest}${my_app_dir}/Mini vMac ${my_machine}.app"
330        }
331    }
332    if {[variant_exists universal] && [variant_isset universal]} {
333        merge ${workpath}/pre-dest
334    }
335}
336
337# Converts normal arch names into Mini vMac target names.
338proc my_arch_to_target {arch} {
339    switch ${arch} {
340        i386 {
341            return imch
342        }
343        ppc {
344            return mach
345        }
346        default {
347            return -code error "unsupported architecture ${arch}"
348        }
349    }
350}
351
352# Mounts a disk image.
353proc my_attach_disk_image {disk_image} {
354    global my_name filespath
355    set mountpoint [mkdtemp "/tmp/${my_name}.XXXXXXXX"]
356    # Use this expect script instead of using hdiutil directly, because the
357    # system disk image has a license agreement we must agree to.
358    my_system "expect ${filespath}/attach.exp '${disk_image}' '${mountpoint}'"
359    return ${mountpoint}
360}
361
362# Unmounts a disk image.
363proc my_detach_disk_image {mountpoint} {
364    my_system "hdiutil detach ${mountpoint} -force"
365    file delete -force ${mountpoint}
366}
367
368proc my_system {cmd} {
369     ui_debug ${cmd}
370     system ${cmd}
371}
372
373livecheck.type          regex
374livecheck.url           ${homepage}doc/download.html
375livecheck.regex         ${my_name}-(\[0-9.\]+)\\.src
Note: See TracBrowser for help on using the repository browser.