source: users/ryandesign/minivmac/Portfile @ 38773

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

minivmac: merge r38772 from stable minivmac portfile: use ${applications_dir}

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.5 KB
Line 
1# $Id: Portfile 38773 2008-07-31 04:46:23Z 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
79# Can be removed once MacPorts 1.7.0 is released
80if {![info exists applications_dir]} {
81    set applications_dir /Applications/MacPorts
82}
83
84set my_appdir "${applications_dir}/Mini vMac"
85set romfile vMac.ROM
86set romfile_model "Macintosh Plus or 512Ke"
87set my_mnvm_dat "${workpath}/${my_bootstrap}/Contents/mnvm_dat"
88set my_options_file options.txt
89set my_base_options "-maintainer MacPorts -homepage http://www.macports.org/ -cl -eol unx -nex"
90set my_target ""
91set my_machine Plus
92set my_variation_machine mac[string tolower ${my_machine}]
93
94platform powerpc {
95        set my_target mach
96}
97
98platform i386 {
99        set my_target imch
100}
101
102pre-fetch {
103        if { ! [file exists ${my_appdir}/${romfile}] } {
104                ui_msg "**************************************************************"
105                ui_msg "Mini vMac requires a ROM file from the type of machine you're"
106                ui_msg "emulating in order to work. The ROM file is not included with"
107                ui_msg "this package because it is copyrighted Apple software."
108                ui_msg "Download the CopyRoms program from the Mini vMac web site"
109                ui_msg "(${homepage} > More > Extras)"
110                ui_msg "and transfer it to a real physical ${romfile_model}"
111                ui_msg "that you own. Run the CopyRoms program there, then transfer"
112                ui_msg "the ROM file back to this Mac, name it ${romfile},"
113                ui_msg "and put it in ${my_appdir}."
114                ui_msg "**************************************************************"
115                return -code error "missing ROM file"
116        }
117}
118
119post-extract {
120        system "tar -x -z -C ${workpath} -f ${distpath}/${my_bootstrap_compressed}"
121       
122        xinstall -W ${filespath} attach.exp demacbinary.sh ${workpath}
123       
124        system "${workpath}/demacbinary.sh ${distpath}/${my_system_disk_container_compressed} ${workpath}"
125       
126        file mkdir ${my_mnvm_dat}
127        ln -s ${my_appdir}/${romfile} ${my_mnvm_dat}
128       
129        # Copy the Disk Tools and Tidbits images from the container image.
130        set my_system_disk_container_mount [my_attach_disk_image ${workpath}/${my_system_disk_container} 0]
131        file copy "${my_system_disk_container_mount}/Disk Tools.image" ${workpath}/startup.img
132        file copy "${my_system_disk_container_mount}/Tidbits.image" ${workpath}/tidbits.img
133        my_detach_disk_image ${my_system_disk_container_mount}
134       
135        # The disk image mounter likes images to have the .img extension.
136        file rename ${workpath}/${my_src}/${my_src}.dsk ${workpath}/src.img
137        file rename ${workpath}/${my_autoquit}/${my_autoquit}.dsk ${workpath}/autoquit.img
138       
139        # Mount the startup disk and make room on it for our things.
140        set my_startup_disk_mount [my_attach_disk_image ${workpath}/startup.img 1]
141        file delete "${my_startup_disk_mount}/Apple HD SC Setup" "${my_startup_disk_mount}/Disk First Aid"
142       
143        # Copy autoquit to the startup disk and make it open at startup.
144        # Need to use ditto to preserve the resource fork.
145        set my_autoquit_disk_mount [my_attach_disk_image ${workpath}/autoquit.img 0]
146        set my_startup_disk_autoquit_dir "${my_startup_disk_mount}/autoquit"
147        file mkdir "${my_startup_disk_autoquit_dir}"
148        system "ditto --rsrc ${my_autoquit_disk_mount}/AutQuit7 ${my_startup_disk_autoquit_dir}"
149        my_detach_disk_image ${my_autoquit_disk_mount}
150        my_make_alias "${my_startup_disk_autoquit_dir}/AutQuit7" "${my_startup_disk_mount}/System Folder/Startup Items"
151       
152        # Mount the source disk.
153        set my_src_disk_mount [my_attach_disk_image ${workpath}/src.img 1]
154       
155        # Copy TeachText to the source disk. (No room on the startup disk.)
156        set my_tidbits_disk_mount [my_attach_disk_image ${workpath}/tidbits.img 0]
157        system "ditto --rsrc ${my_tidbits_disk_mount}/TeachText ${my_src_disk_mount}"
158        my_detach_disk_image ${my_tidbits_disk_mount}
159       
160        # Force a rebuild of the Desktop files, both to add info about TeachText and
161        # to remove that of Apple HD SC Setup and Disk First Aid (to make more room).
162        file delete ${my_startup_disk_mount}/Desktop ${my_src_disk_mount}/Desktop
163       
164        # Create an empty options file so we can make an alias to it.
165        set my_options_file_id [open ${my_src_disk_mount}/${my_options_file} "w"]
166        close ${my_options_file_id}
167        system "/Developer/Tools/SetFile -c ttxt -t TEXT ${my_src_disk_mount}/${my_options_file}"
168       
169        # Have autoquit launch the build system. If there's an alias "app" in the same directory,
170        # autoquit will open it. If there's also an alias "doc" in the same directory, autoquit
171        # will open the document "doc" into the application "app".
172        my_make_alias "${my_src_disk_mount}/Build" "${my_startup_disk_autoquit_dir}/app"
173        # The build system doesn't support reading text files yet.
174#       my_make_alias "${my_src_disk_mount}/${my_options_file}" "${my_startup_disk_autoquit_dir}/doc"
175        my_make_alias "${my_src_disk_mount}/${my_options_file}" "${my_startup_disk_mount}/System Folder/Startup Items"
176       
177        # Unmount disk images.
178        my_detach_disk_image ${my_startup_disk_mount}
179        my_detach_disk_image ${my_src_disk_mount}
180       
181        # Mini vMac looks for disks named disk1.dsk through disk3.dsk and automounts them.
182        file rename "${workpath}/startup.img" "${my_mnvm_dat}/disk1.dsk"
183}
184
185configure {
186        # Write our options file.
187        set my_variation [my_get_variation]
188        set my_options "${my_base_options} -t ${my_target} -m ${my_machine} -n ${my_variation}"
189        set my_src_disk_mount [my_attach_disk_image ${workpath}/src.img 1]
190        set my_options_file_id [open ${my_src_disk_mount}/${my_options_file} "w"]
191        puts -nonewline ${my_options_file_id} ${my_options}
192        close ${my_options_file_id}
193        my_detach_disk_image ${my_src_disk_mount}
194       
195        # Move the source disk where Mini vMac will find it.
196        file rename "${workpath}/src.img" "${my_mnvm_dat}/disk2.dsk"
197       
198        # Run the build system.
199        system "'${workpath}/${my_bootstrap}/Contents/MacOS/minivmac'"
200       
201        # Give the source disk image the .img extension to appease the disk image mounter.
202        file rename "${my_mnvm_dat}/disk2.dsk" "${workpath}/src.img"
203       
204        # Get the build product.
205        set my_src_disk_mount [my_attach_disk_image ${workpath}/src.img 1]
206        if {[file exists ${my_src_disk_mount}/output/${my_variation}]} {
207                file copy ${my_src_disk_mount}/output/${my_variation} ${workpath}
208                file delete -force ${my_src_disk_mount}/output/${my_variation}
209        }
210        my_detach_disk_image ${my_src_disk_mount}
211}
212
213pre-build {
214        set my_variation [my_get_variation]
215        build.dir ${workpath}/${my_variation}
216}
217
218post-build {
219        set my_variation [my_get_variation]
220        eval xinstall -m 644 [glob ${workpath}/${my_icons}/icons/*.icns] ${workpath}/${my_variation}/minivmac.app/Contents/Resources
221}
222
223destroot {
224        set my_variation [my_get_variation]
225        xinstall -d ${destroot}${my_appdir}
226        file copy ${workpath}/${my_variation}/minivmac.app \
227                ${destroot}${my_appdir}/Mini\ vMac\ ${my_machine}.app
228}
229
230if { ![variant_isset mac128k] && ![variant_isset mac512k] && ![variant_isset mac512ke] && ![variant_isset macse] } {
231        default_variants +macplus
232}
233
234variant mac128k conflicts mac512k mac512ke macplus macse description {Emulate a Macintosh with 128K RAM and 2 drives} {
235        patchfiles-append patch-CNFGGLOB.h-mac128k.diff
236        set romfile Mac128K.ROM
237        set romfile_model "Macintosh 128K or 512K"
238}
239
240variant mac512k conflicts mac128k mac512ke macplus macse description {Emulate a Macintosh 512K with 512K RAM and 2 drives} {
241        patchfiles-append patch-CNFGGLOB.h-mac512k.diff
242        set romfile Mac128K.ROM
243        set romfile_model "Macintosh 128K or 512K"
244}
245
246variant mac512ke conflicts mac128k mac512k macplus macse description {Emulate a Macintosh 512Ke with 512K RAM and 6 drives} {
247        patchfiles-append patch-CNFGGLOB.h-mac512ke.diff
248}
249
250variant macplus conflicts mac128k mac512k mac512ke macse description {Emulate a Macintosh Plus with 4 MB RAM and 6 drives (default)} {
251        # Mac Plus emulation is the default so we don't need to do anything here
252}
253
254variant macse conflicts mac128k mac512k mac512ke macplus description {Emulate a Macintosh SE with 4 MB RAM and 6 drives} {
255        patchfiles-append patch-CNFGGLOB.h-macse.diff
256        set romfile MacSE.ROM
257        set romfile_model "Macintosh SE"
258}
259
260proc my_attach_disk_image {disk_image allow_writing} {
261        global name workpath
262        set mountpoint [exec mktemp -d -q -t ${name}]
263        # Use this expect script instead of using hdiutil directly, because the
264        # system disk image has a license agreement we must agree to.
265        system "${workpath}/attach.exp '${disk_image}' '${mountpoint}' '${allow_writing}'"
266        return ${mountpoint}
267}
268
269proc my_detach_disk_image {mountpoint} {
270        system "hdiutil detach ${mountpoint} -force"
271        file delete -force ${mountpoint}
272}
273
274proc my_make_alias {src dst} {
275        set dst_is_dir [file isdirectory "${dst}"]
276        if {${dst_is_dir}} {
277                set dst_dir "${dst}"
278        } else {
279                set dst_dir "[file dirname ${dst}]"
280        }
281        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'"
282        if {!${dst_is_dir}} {
283                file rename "[file join ${dst_dir} [file tail ${src}]]" "${dst}"
284        }
285}
286
287proc my_get_variation {} {
288        global name version revision my_variation_machine my_target
289        return ${name}-${version}_${revision}-${my_variation_machine}-${my_target}
290}
291
292livecheck.check     regex
293livecheck.url       ${homepage}download.html
294livecheck.regex     ${name}-(\[0-9.\]+)\\.src
Note: See TracBrowser for help on using the repository browser.