source: users/ryandesign/minivmac/Portfile @ 44609

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

graphviz, graphviz-devel, lisaem, minivmac: Remove setting applications_dir which MacPorts 1.7.0 now takes care of for us.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.4 KB
Line 
1# $Id: Portfile 44609 2008-12-31 07:41:06Z ryandesign@macports.org $
2
3PortSystem          1.0
4
5name                minivmac
6version             3.0.4
7revision            1
8categories          emulators aqua
9maintainers         ryandesign
10homepage            http://minivmac.sourceforge.net/
11use_zip             yes
12platforms           macosx
13universal_variant   no
14build.target
15use_parallel_build  yes
16
17description \
18        a Mac 128K, Mac 512K, Mac 512KE, Mac Plus and Mac SE emulator
19
20long_description \
21        Mini vMac is a Macintosh emulator. It emulates the earliest Macs, \
22        from the original Mac 128K (built 1984-85) to the Mac SE (1987-1990). \
23        The default is to emulate a Mac Plus (1986-1990)\; this is also \
24        the best-tested and therefore recommended emulation.
25
26master_sites \
27        sourceforge:${name}:minivmac \
28        http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-International/Macintosh/System/Full_Installs/:apple
29
30set my_src                                  ${distname}.src
31set my_src_compressed                       ${my_src}.zip
32set my_bootstrap_version                    3.0.4
33set my_bootstrap                            "Mini vMac.app"
34set my_bootstrap_compressed                 ${name}-${my_bootstrap_version}-umch.bin.tgz
35set my_autoquit                             autquit7-1.1.0
36set my_autoquit_compressed                  ${my_autoquit}.zip
37set my_icons                                icnsosx-1.0.0
38set my_icons_compressed                     ${my_icons}.zip
39set my_system_disk_container                Z-System_7.0.1.smi
40set my_system_disk_container_compressed     ${my_system_disk_container}.bin
41
42distfiles \
43        ${my_src_compressed}:minivmac \
44        ${my_icons_compressed}:minivmac \
45        ${my_autoquit_compressed}:minivmac \
46        ${my_system_disk_container_compressed}:apple
47
48extract.only \
49        ${my_src_compressed} \
50        ${my_icons_compressed} \
51        ${my_autoquit_compressed}
52
53checksums \
54        ${my_src_compressed} \
55                md5 ab308459e98bd5103ad8bbb7dd158eb6 \
56                sha1 ff99aa72da0868a5306631f0d06ae190cbd2a03a \
57                rmd160 b8f1f5269d21835ff3e9e428da12a7b6c224e60e \
58        ${my_bootstrap_compressed} \
59                md5 298565ec1ccfe6876768156aaf5f76a0 \
60                sha1 34212dedb1cfb744e6ca8124693f2f6e40094833 \
61                rmd160 042eacfb9ec853589d661c86ffb99d509061eb0f \
62        ${my_icons_compressed} \
63                md5 2af006506de7549be14f94317918d59a \
64                sha1 4ef79bb56b988fedfeb82a8b6cafd8066f5bbab2 \
65                rmd160 cef6d7d7578464538d0042b0d98379ae7f18fab7 \
66        ${my_autoquit_compressed} \
67                md5 eebe87a27d6db8e8f247f0fffe0f2bd5 \
68                sha1 8199e1da12d01fc210ae1eaa50f794e5b8c479c1 \
69                rmd160 f493a59fd637caa8a7937fbefaf6ebdf4a07c7f5 \
70        ${my_system_disk_container_compressed} \
71                md5 5e7b4c0ce13e65546eb795c35879751a \
72                sha1 bf37fde76dfd9d4ed35526954c149566d761c2a6 \
73                rmd160 08788cbcca023ea9a0713ecec4781c35aa5a9185
74
75depends_build \
76        port:macutil \
77        bin:expect:expect
78
79set my_appdir "${applications_dir}/Mini vMac"
80set romfile vMac.ROM
81set romfile_model "Macintosh Plus or 512Ke"
82set my_mnvm_dat "${workpath}/${my_bootstrap}/Contents/mnvm_dat"
83set my_options_file options.txt
84set my_base_options "-maintainer MacPorts -homepage http://www.macports.org/ -cl -eol unx -nex"
85set my_target ""
86set my_machine Plus
87set my_variation_machine mac[string tolower ${my_machine}]
88
89platform powerpc {
90        set my_target mach
91}
92
93platform i386 {
94        set my_target imch
95}
96
97pre-fetch {
98        if { ! [file exists ${my_appdir}/${romfile}] } {
99                ui_msg "**************************************************************"
100                ui_msg "Mini vMac requires a ROM file from the type of machine you're"
101                ui_msg "emulating in order to work. The ROM file is not included with"
102                ui_msg "this package because it is copyrighted Apple software."
103                ui_msg "Download the CopyRoms program from the Mini vMac web site"
104                ui_msg "(${homepage} > More > Extras)"
105                ui_msg "and transfer it to a real physical ${romfile_model}"
106                ui_msg "that you own. Run the CopyRoms program there, then transfer"
107                ui_msg "the ROM file back to this Mac, name it ${romfile},"
108                ui_msg "and put it in ${my_appdir}."
109                ui_msg "**************************************************************"
110                return -code error "missing ROM file"
111        }
112}
113
114post-extract {
115        system "tar -x -z -C ${workpath} -f ${distpath}/${my_bootstrap_compressed}"
116       
117        xinstall -W ${filespath} attach.exp demacbinary.sh ${workpath}
118       
119        system "${workpath}/demacbinary.sh ${distpath}/${my_system_disk_container_compressed} ${workpath}"
120       
121        file mkdir ${my_mnvm_dat}
122        ln -s ${my_appdir}/${romfile} ${my_mnvm_dat}
123       
124        # Copy the Disk Tools and Tidbits images from the container image.
125        set my_system_disk_container_mount [my_attach_disk_image ${workpath}/${my_system_disk_container} 0]
126        file copy "${my_system_disk_container_mount}/Disk Tools.image" ${workpath}/startup.img
127        file copy "${my_system_disk_container_mount}/Tidbits.image" ${workpath}/tidbits.img
128        my_detach_disk_image ${my_system_disk_container_mount}
129       
130        # The disk image mounter likes images to have the .img extension.
131        file rename ${workpath}/${my_src}/${my_src}.dsk ${workpath}/src.img
132        file rename ${workpath}/${my_autoquit}/${my_autoquit}.dsk ${workpath}/autoquit.img
133       
134        # Mount the startup disk and make room on it for our things.
135        set my_startup_disk_mount [my_attach_disk_image ${workpath}/startup.img 1]
136        file delete "${my_startup_disk_mount}/Apple HD SC Setup" "${my_startup_disk_mount}/Disk First Aid"
137       
138        # Copy autoquit to the startup disk and make it open at startup.
139        # Need to use ditto to preserve the resource fork.
140        set my_autoquit_disk_mount [my_attach_disk_image ${workpath}/autoquit.img 0]
141        set my_startup_disk_autoquit_dir "${my_startup_disk_mount}/autoquit"
142        file mkdir "${my_startup_disk_autoquit_dir}"
143        system "ditto --rsrc ${my_autoquit_disk_mount}/AutQuit7 ${my_startup_disk_autoquit_dir}"
144        my_detach_disk_image ${my_autoquit_disk_mount}
145        my_make_alias "${my_startup_disk_autoquit_dir}/AutQuit7" "${my_startup_disk_mount}/System Folder/Startup Items"
146       
147        # Mount the source disk.
148        set my_src_disk_mount [my_attach_disk_image ${workpath}/src.img 1]
149       
150        # Copy TeachText to the source disk. (No room on the startup disk.)
151        set my_tidbits_disk_mount [my_attach_disk_image ${workpath}/tidbits.img 0]
152        system "ditto --rsrc ${my_tidbits_disk_mount}/TeachText ${my_src_disk_mount}"
153        my_detach_disk_image ${my_tidbits_disk_mount}
154       
155        # Force a rebuild of the Desktop files, both to add info about TeachText and
156        # to remove that of Apple HD SC Setup and Disk First Aid (to make more room).
157        file delete ${my_startup_disk_mount}/Desktop ${my_src_disk_mount}/Desktop
158       
159        # Create an empty options file so we can make an alias to it.
160        set my_options_file_id [open ${my_src_disk_mount}/${my_options_file} "w"]
161        close ${my_options_file_id}
162        system "/Developer/Tools/SetFile -c ttxt -t TEXT ${my_src_disk_mount}/${my_options_file}"
163       
164        # Have autoquit launch the build system. If there's an alias "app" in the same directory,
165        # autoquit will open it. If there's also an alias "doc" in the same directory, autoquit
166        # will open the document "doc" into the application "app".
167        my_make_alias "${my_src_disk_mount}/Build" "${my_startup_disk_autoquit_dir}/app"
168        # The build system doesn't support reading text files yet.
169#       my_make_alias "${my_src_disk_mount}/${my_options_file}" "${my_startup_disk_autoquit_dir}/doc"
170        my_make_alias "${my_src_disk_mount}/${my_options_file}" "${my_startup_disk_mount}/System Folder/Startup Items"
171       
172        # Unmount disk images.
173        my_detach_disk_image ${my_startup_disk_mount}
174        my_detach_disk_image ${my_src_disk_mount}
175       
176        # Mini vMac looks for disks named disk1.dsk through disk3.dsk and automounts them.
177        file rename "${workpath}/startup.img" "${my_mnvm_dat}/disk1.dsk"
178}
179
180configure {
181        # Write our options file.
182        set my_variation [my_get_variation]
183        set my_options "${my_base_options} -t ${my_target} -m ${my_machine} -n ${my_variation}"
184        set my_src_disk_mount [my_attach_disk_image ${workpath}/src.img 1]
185        set my_options_file_id [open ${my_src_disk_mount}/${my_options_file} "w"]
186        puts -nonewline ${my_options_file_id} ${my_options}
187        close ${my_options_file_id}
188        my_detach_disk_image ${my_src_disk_mount}
189       
190        # Move the source disk where Mini vMac will find it.
191        file rename "${workpath}/src.img" "${my_mnvm_dat}/disk2.dsk"
192       
193        # Run the build system.
194        system "'${workpath}/${my_bootstrap}/Contents/MacOS/minivmac'"
195       
196        # Give the source disk image the .img extension to appease the disk image mounter.
197        file rename "${my_mnvm_dat}/disk2.dsk" "${workpath}/src.img"
198       
199        # Get the build product.
200        set my_src_disk_mount [my_attach_disk_image ${workpath}/src.img 1]
201        if {[file exists ${my_src_disk_mount}/output/${my_variation}]} {
202                file copy ${my_src_disk_mount}/output/${my_variation} ${workpath}
203                file delete -force ${my_src_disk_mount}/output/${my_variation}
204        }
205        my_detach_disk_image ${my_src_disk_mount}
206}
207
208pre-build {
209        set my_variation [my_get_variation]
210        build.dir ${workpath}/${my_variation}
211}
212
213post-build {
214        set my_variation [my_get_variation]
215        eval xinstall -m 644 [glob ${workpath}/${my_icons}/icons/*.icns] ${workpath}/${my_variation}/minivmac.app/Contents/Resources
216}
217
218destroot {
219        set my_variation [my_get_variation]
220        xinstall -d ${destroot}${my_appdir}
221        file copy ${workpath}/${my_variation}/minivmac.app \
222                ${destroot}${my_appdir}/Mini\ vMac\ ${my_machine}.app
223}
224
225if { ![variant_isset mac128k] && ![variant_isset mac512k] && ![variant_isset mac512ke] && ![variant_isset macse] } {
226        default_variants +macplus
227}
228
229variant mac128k conflicts mac512k mac512ke macplus macse description {Emulate a Macintosh with 128K RAM and 2 drives} {
230        patchfiles-append patch-CNFGGLOB.h-mac128k.diff
231        set romfile Mac128K.ROM
232        set romfile_model "Macintosh 128K or 512K"
233}
234
235variant mac512k conflicts mac128k mac512ke macplus macse description {Emulate a Macintosh 512K with 512K RAM and 2 drives} {
236        patchfiles-append patch-CNFGGLOB.h-mac512k.diff
237        set romfile Mac128K.ROM
238        set romfile_model "Macintosh 128K or 512K"
239}
240
241variant mac512ke conflicts mac128k mac512k macplus macse description {Emulate a Macintosh 512Ke with 512K RAM and 6 drives} {
242        patchfiles-append patch-CNFGGLOB.h-mac512ke.diff
243}
244
245variant macplus conflicts mac128k mac512k mac512ke macse description {Emulate a Macintosh Plus with 4 MB RAM and 6 drives (default)} {
246        # Mac Plus emulation is the default so we don't need to do anything here
247}
248
249variant macse conflicts mac128k mac512k mac512ke macplus description {Emulate a Macintosh SE with 4 MB RAM and 6 drives} {
250        patchfiles-append patch-CNFGGLOB.h-macse.diff
251        set romfile MacSE.ROM
252        set romfile_model "Macintosh SE"
253}
254
255proc my_attach_disk_image {disk_image allow_writing} {
256        global name workpath
257        set mountpoint [exec mktemp -d -q -t ${name}]
258        # Use this expect script instead of using hdiutil directly, because the
259        # system disk image has a license agreement we must agree to.
260        system "${workpath}/attach.exp '${disk_image}' '${mountpoint}' '${allow_writing}'"
261        return ${mountpoint}
262}
263
264proc my_detach_disk_image {mountpoint} {
265        system "hdiutil detach ${mountpoint} -force"
266        file delete -force ${mountpoint}
267}
268
269proc my_make_alias {src dst} {
270        set dst_is_dir [file isdirectory "${dst}"]
271        if {${dst_is_dir}} {
272                set dst_dir "${dst}"
273        } else {
274                set dst_dir "[file dirname ${dst}]"
275        }
276        system "osascript -e 'set src to POSIX file \"${src}\"' -e 'set dst_dir to POSIX file \"${dst_dir}\"' -e 'tell app \"Finder\" to make new alias file at dst_dir to src' -e 'return'"
277        if {!${dst_is_dir}} {
278                file rename "[file join ${dst_dir} [file tail ${src}]]" "${dst}"
279        }
280}
281
282proc my_get_variation {} {
283        global name version revision my_variation_machine my_target
284        return ${name}-${version}_${revision}-${my_variation_machine}-${my_target}
285}
286
287livecheck.check     regex
288livecheck.url       ${homepage}download.html
289livecheck.regex     ${name}-(\[0-9.\]+)\\.src
Note: See TracBrowser for help on using the repository browser.