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