source: trunk/dports/emulators/minivmac-devel/Portfile @ 61546

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

minivmac-devel: update to 3.2.0

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 15.2 KB
Line 
1# $Id: Portfile 61546 2009-12-14 10:22:38Z ryandesign@macports.org $
2
3PortSystem              1.0
4
5name                    minivmac-devel
6conflicts               minivmac
7set my_name             minivmac
8epoch                   1
9version                 3.2.0
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 \
22    a Mac 128K, Mac 512K, Mac 512KE, Mac Plus and Mac SE emulator
23
24long_description \
25    Mini vMac is a Macintosh emulator. It emulates the earliest Macs, \
26    from the original Mac 128K (built 1984-85) to the Mac SE (1987-1990). \
27    The default is to emulate a Mac Plus (1986-1990)\; this is also \
28    the best-tested and therefore recommended emulation.
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     1347a9652d8136474788e69dc30aeba9 \
73        sha1    6d15fba52320f1016582922d85ac230e0e657163 \
74        rmd160  1b1dede1d1e47ac5ba922213ab6467b80495f7d7 \
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.2 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 {![variant_exists universal] || ![variant_isset universal]} {
148    switch ${os.arch} {
149        powerpc {
150            configure.build_arch ppc
151        }
152        default {
153            configure.build_arch ${os.arch}
154        }
155    }
156    set my_archs ${configure.build_arch}
157}
158
159pre-fetch {
160    set my_real_rom_dir [exec osascript ${filespath}/readalias.applescript [file normalize ${my_rom_dir}]]
161    if {![file exists ${my_real_rom_dir}/${my_rom_file}] && ![file exists ${my_app_dir}/${my_rom_file}]} {
162        ui_msg "****************************************************************"
163        ui_msg "To build Mini vMac, you will need a ROM file from a Macintosh"
164        ui_msg "Plus or 512Ke. And to run it, you need a ROM file from the type"
165        ui_msg "of Mac you want to emulate. ROM files are not included with this"
166        ui_msg "package because they are copyrighted Apple software."
167        ui_msg "To create a ROM file, download the CopyRoms program from"
168        ui_msg "${homepage}extras/copyroms.html"
169        ui_msg "and transfer it to a real physical early Macintosh that you own."
170        ui_msg "Run the CopyRoms program there, then transfer the ROM file back"
171        ui_msg "to this Mac and put it in ${my_rom_dir}"
172        ui_msg "(which can be an alias or symlink if desired) or"
173        ui_msg "${my_app_dir}."
174        ui_msg "****************************************************************"
175        return -code error "${my_rom_file} not found"
176    }
177}
178
179worksrcdir              stuff
180extract.mkdir           yes
181
182post-extract {
183    # Decode the system disk container image.
184    my_system "sh ${filespath}/demacbinary.sh ${distpath}/${my_system_disk_container_distfile} ${worksrcpath}"
185   
186    # Copy the Disk Tools image from the container image. The binary patchfile applied with bspatch
187    # places an alias of the output disk at System Folder:Preferences:Gryphel:Build:output.
188    set my_system_disk_container_mount [my_attach_disk_image ${worksrcpath}/${my_system_disk_container}]
189    my_system "bspatch '${my_system_disk_container_mount}/Disk Tools.image' '${worksrcpath}/Disk Tools.dsk' '${filespath}/Disk Tools.dsk.bsdiff'"
190    my_detach_disk_image ${my_system_disk_container_mount}
191   
192    # Get a large empty disk image to store the output.
193    my_system "unzip -q ${worksrcpath}/${my_blanks}/hfs24M.zip -d ${worksrcpath}"
194   
195    # Make the data directory, where Mini vMac looks for the files it needs.
196    set my_mnvm_dat "${worksrcpath}/${my_bootstrap_app}/Contents/mnvm_dat"
197    file mkdir ${my_mnvm_dat}
198   
199    # Symlink the ROM file into the data directory.
200    ln -s ${my_app_dir}/${my_rom_file} ${my_mnvm_dat}
201   
202    # Symlink the disk images into the data directory with sequentially-numbered
203    # names so Mini vMac will find them and automatically mount them.
204    ln -s "${worksrcpath}/Disk Tools.dsk" "${my_mnvm_dat}/disk1.dsk"
205    ln -s ${worksrcpath}/output.img "${my_mnvm_dat}/disk2.dsk"
206    ln -s ${worksrcpath}/${my_src}/${my_src}.dsk "${my_mnvm_dat}/disk3.dsk"
207    ln -s ${worksrcpath}/${my_clipin}/${my_clipin}.dsk "${my_mnvm_dat}/disk4.dsk"
208}
209
210pre-configure {
211    # Set the name of the bootstrap app in the configure script.
212    xinstall -m 755 ${filespath}/configure.applescript.in ${worksrcpath}/configure.applescript
213    reinplace "s|@BOOTSTRAP_APP@|${my_bootstrap_app}|g" ${worksrcpath}/configure.applescript
214   
215    # Copy the large blank disk image to store the output.
216    # Use the .img extension so that we can mount it on Mac OS X later.
217    copy -force ${worksrcpath}/hfs24M.DSK ${worksrcpath}/output.img
218   
219    # Unrestrict the permissions on the output disk image so the Build program
220    # can write its output to it.
221    file attributes ${worksrcpath}/output.img -permissions 0777
222   
223    # Build up the combined configure args for all variations.
224    set i 0
225    foreach my_arch ${my_archs} {
226        set my_target [my_arch_to_target ${my_arch}]
227        foreach {my_machine my_variation_options} ${my_variations} {
228            if {${i} > 0} {
229                configure.args-append {\;}
230            }
231            configure.args-append \
232                ${my_base_options} \
233                -t ${my_target} \
234                ${my_variation_options} \
235                -n ${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
236            incr i
237        }
238    }
239   
240    # Launch the bootstrap Mini vMac so the configure script can talk to it.
241    my_system "open '${worksrcpath}/${my_bootstrap_app}'"
242}
243
244configure.cmd           osascript
245configure.pre_args      ./configure.applescript
246
247build.dir               ${workpath}/variations
248
249post-configure {
250    file mkdir ${build.dir}
251    set my_variation_dirs {}
252    set my_output_disk_mount [my_attach_disk_image ${worksrcpath}/output.img]
253    foreach my_arch ${my_archs} {
254        file mkdir ${build.dir}/${my_arch}
255        set my_target [my_arch_to_target ${my_arch}]
256        foreach {my_machine unused} ${my_variations} {
257            set my_src_dir ${my_output_disk_mount}/${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
258            if {[file isdirectory ${my_src_dir}]} {
259                set my_variation_dir ${my_arch}/${my_machine}
260                lappend my_variation_dirs [strsed ${my_variation_dir} {g/ /\\\\ /}]
261               
262                # Get the configured source code.
263                file copy ${my_src_dir} ${build.dir}/${my_variation_dir}
264               
265                # Use the right compiler.
266                reinplace "s|gcc|${configure.cc}|g" ${build.dir}/${my_variation_dir}/Makefile
267               
268                # Remove references to SDKs -- the 10.4u SDK is not installed by default on 10.6
269                # and even if you install it manually it does not work here.
270                reinplace -E {s|-isysroot /Developer/SDKs/[^ ]+||g} ${build.dir}/${my_variation_dir}/Makefile
271            }
272        }
273    }
274    my_detach_disk_image ${my_output_disk_mount}
275   
276    # Set up the global Makefile.
277    xinstall ${filespath}/Makefile.in ${build.dir}/Makefile
278    reinplace "s|@SUBDIRS@|[join ${my_variation_dirs}]|" ${build.dir}/Makefile
279   
280    # If no variation directoriess were produced by configuration, either the flags we
281    # passed in were bad, or the automation script got out of sync with the emulator;
282    # if the latter, the delays in configure.applescript may need to be adjusted.
283    if {"" == ${my_variation_dirs}} {
284        return -code error "configuration failed!"
285    }
286}
287
288set my_share_dir        ${prefix}/share/${my_name}
289
290post-build {
291    set i 0
292    foreach my_arch ${my_archs} {
293        set my_target [my_arch_to_target ${my_arch}]
294        foreach {my_machine unused} ${my_variations} {
295            if {[variant_exists universal] && [variant_isset universal]} {
296                reinplace "s|${my_target}|umch|" ${build.dir}/${my_arch}/${my_machine}/minivmac.app/Contents/Info.plist
297            }
298            if {![variant_exists bootstrap] || ![variant_isset bootstrap]} {
299                # To save space, keep only a single copy of the Resources directory.
300                set my_resources_dir ${build.dir}/${my_arch}/${my_machine}/minivmac.app/Contents/Resources
301                if {0 == ${i}} {
302                    move ${my_resources_dir} ${build.dir}
303                } else {
304                    delete ${my_resources_dir}
305                }
306                ln -s ${my_share_dir}/Resources ${my_resources_dir}
307            }
308            incr i
309        }
310    }
311   
312    if {![variant_exists bootstrap] || ![variant_isset bootstrap]} {
313        # Install the prettier icons.
314        eval xinstall -m 644 [glob ${worksrcpath}/${my_icons}/icons/*.icns] ${build.dir}/Resources
315    }
316}
317
318destroot {
319    if {![variant_exists bootstrap] || ![variant_isset bootstrap]} {
320        # Install the global Resources directory.
321        xinstall -d ${destroot}${my_share_dir}
322        copy ${build.dir}/Resources ${destroot}${my_share_dir}
323    }
324   
325    # Install the programs.
326    foreach my_arch ${my_archs} {
327        if {[variant_exists universal] && [variant_isset universal]} {
328            set my_dest ${workpath}/pre-dest/${my_arch}
329        } else {
330            set my_dest ${destroot}
331        }
332        xinstall -d ${my_dest}${my_app_dir}
333        foreach {my_machine unused} ${my_variations} {
334            copy ${build.dir}/${my_arch}/${my_machine}/minivmac.app \
335                "${my_dest}${my_app_dir}/Mini vMac ${my_machine}.app"
336        }
337    }
338    if {[variant_exists universal] && [variant_isset universal]} {
339        merge ${workpath}/pre-dest
340    }
341}
342
343# Converts normal arch names into Mini vMac target names.
344proc my_arch_to_target {arch} {
345    switch ${arch} {
346        i386 {
347            return imch
348        }
349        ppc {
350            return mach
351        }
352        default {
353            return -code error "unsupported architecture ${arch}"
354        }
355    }
356}
357
358# Mounts a disk image.
359proc my_attach_disk_image {disk_image} {
360    global my_name filespath
361    set mountpoint [mkdtemp "/tmp/${my_name}.XXXXXXXX"]
362    # Use this expect script instead of using hdiutil directly, because the
363    # system disk image has a license agreement we must agree to.
364    my_system "expect ${filespath}/attach.exp '${disk_image}' '${mountpoint}'"
365    return ${mountpoint}
366}
367
368# Unmounts a disk image.
369proc my_detach_disk_image {mountpoint} {
370    my_system "hdiutil detach ${mountpoint} -force"
371    file delete -force ${mountpoint}
372}
373
374proc my_system {cmd} {
375     ui_debug ${cmd}
376     system ${cmd}
377}
378
379livecheck.type          regex
380livecheck.version       ${my_version}
381livecheck.regex         ${my_name}-?(\[0-9.\]+)\\.src
382
383# Development versions:
384#livecheck.url           ${homepage}develop/index.html
385
386# Alpha versions:
387livecheck.url           ${homepage}alpha/index.html
388
389# Beta versions:
390#livecheck.url           ${homepage}beta/index.html
Note: See TracBrowser for help on using the repository browser.