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

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

minivmac-devel: allow the ROM files to optionally be in ~/Library/Preferences/Gryphel/mnvm_rom instead of in the same folder as the application

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.6 KB
Line 
1# $Id: Portfile 58118 2009-09-22 11:28:41Z ryandesign@macports.org $
2
3PortSystem              1.0
4
5name                    minivmac-devel
6conflicts               minivmac
7set my_name             minivmac
8version                 3.1.2
9revision                1
10categories              emulators aqua
11maintainers             ryandesign
12license                 GPLv2
13homepage                http://minivmac.sourceforge.net/
14use_zip                 yes
15platforms               macosx
16universal_variant       no
17use_parallel_build      yes
18dist_subdir             ${my_name}
19
20description \
21    a Mac 128K, Mac 512K, Mac 512KE, Mac Plus and Mac SE emulator
22
23long_description \
24    Mini vMac is a Macintosh emulator. It emulates the earliest Macs, \
25    from the original Mac 128K (built 1984-85) to the Mac SE (1987-1990). \
26    The default is to emulate a Mac Plus (1986-1990)\; this is also \
27    the best-tested and therefore recommended emulation.
28
29master_sites \
30    sourceforge:${my_name}:minivmac \
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}-3.1.2-umch.bin.tgz
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}:minivmac \
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_icons_distfile} \
57    ${my_blanks_distfile} \
58    ${my_clipin_distfile}
59
60checksums \
61    ${my_src_distfile} \
62        md5     e02e2e762c5f9df3451efb71733d75c4 \
63        sha1    b395715983ba651b96ef941e27b0f5e18f624aea \
64        rmd160  186d2672bf3d67f9bf61b0960a157fa36a616f4c \
65    ${my_bootstrap_distfile} \
66        md5     53239cda5f1827fcc00d9254ee1ee9e0 \
67        sha1    d6c16c541d72241cabafcbb94eec7c198e8b1670 \
68        rmd160  f3925e194c59f704f6fac391609ccc72dd12c718 \
69    ${my_icons_distfile} \
70        md5     2af006506de7549be14f94317918d59a \
71        sha1    4ef79bb56b988fedfeb82a8b6cafd8066f5bbab2 \
72        rmd160  cef6d7d7578464538d0042b0d98379ae7f18fab7 \
73    ${my_clipin_distfile} \
74        md5     e094de97d1c6c214a80fb74895124c3e \
75        sha1    725f622ad6681c77e7f9f4a64d05ac1d6a103beb \
76        rmd160  5699b56c8db62b2568c8de88b6d419180b1fb73d \
77    ${my_blanks_distfile} \
78        md5     b16321d0d78048d5ec9b635f4f86b19c \
79        sha1    9b8d7e77bd05633709907f8806d976279d7a20b7 \
80        rmd160  a0784c17c5a5ca2e159762fb836c1c800762b213 \
81    ${my_system_disk_container_distfile} \
82        md5     8a4776350b15b5a516cdf7dd18e27290 \
83        sha1    d4c8b8653de9c7a9b2594dd6126ec7120e3e2e9e \
84        rmd160  89fc3780c9c5d575a8da4068dc810c1f56c70211
85
86depends_extract \
87    port:macutil \
88    port:bsdiff \
89    bin:expect:expect
90
91set my_app_dir          "${applications_dir}/Mini vMac"
92set my_rom_dir          "~/Library/Preferences/Gryphel/mnvm_rom"
93set my_bootstrap_app    "Mini vMac.app"
94set my_rom_file         vMac.ROM
95set my_base_options     "-maintainer MacPorts -homepage http://www.macports.org/ -cl -eol unx -nex"
96set my_target           ""
97
98options my_variations
99my_variations           {128K}      {-m 128K} \
100                        {512K}      {-m 128K -mem 512K} \
101                        {512Ke}     {-m 512Ke} \
102                        {Plus}      {-m Plus -im 1} \
103                        {SE}        {-m SE} \
104                        {SE FDHD}   {-m SEFDHD} \
105                        {Classic}   {-m Classic}
106
107variant unsupported description {Also build unfinished Macintosh II and IIx emulators} {
108    my_variations-append \
109                        {II}        {-m II -mem 8M -hres 800 -vres 600 -depth 3} \
110                        {IIx}       {-m IIx -mem 8M -hres 800 -vres 600 -depth 3}
111}
112
113platform powerpc {
114    set my_target mach
115}
116
117platform i386 {
118    set my_target imch
119}
120
121pre-fetch {
122    if {![file exists ${my_rom_dir}/${my_rom_file}] && ![file exists ${my_app_dir}/${my_rom_file}]} {
123        ui_msg "****************************************************************"
124        ui_msg "To build Mini vMac, you will need a ROM file from a Macintosh"
125        ui_msg "Plus or 512Ke. And to run it, you need a ROM file from the type"
126        ui_msg "of Mac you want to emulate. ROM files are not included with this"
127        ui_msg "package because they are copyrighted Apple software."
128        ui_msg "To create a ROM file, download the CopyRoms program from"
129        ui_msg "${homepage}extras/copyroms.html"
130        ui_msg "and transfer it to a real physical early Macintosh that you own."
131        ui_msg "Run the CopyRoms program there, then transfer the ROM file back"
132        ui_msg "to this Mac and put it in ${my_rom_dir}"
133        ui_msg "or ${my_app_dir}."
134        ui_msg "****************************************************************"
135        return -code error "${my_rom_file} not found"
136    }
137}
138
139worksrcdir              stuff
140extract.mkdir           yes
141
142post-extract {
143    # Decode the system disk container image.
144    my_system "sh ${filespath}/demacbinary.sh ${distpath}/${my_system_disk_container_distfile} ${worksrcpath}"
145   
146    # Copy the Disk Tools image from the container image. The binary patchfile applied with bspatch
147    # places an alias of the output disk at System Folder:Preferences:Gryphel:Build:output.
148    set my_system_disk_container_mount [my_attach_disk_image ${worksrcpath}/${my_system_disk_container}]
149    my_system "bspatch '${my_system_disk_container_mount}/Disk Tools.image' '${worksrcpath}/Disk Tools.dsk' '${filespath}/Disk Tools.dsk.bsdiff'"
150    my_detach_disk_image ${my_system_disk_container_mount}
151   
152    # Get a large empty disk image to store the output.
153    my_system "unzip -q ${worksrcpath}/${my_blanks}/hfs24M.zip -d ${worksrcpath}"
154   
155    # Use the .img extension for the output disk image so that we can mount it on Mac OS X later.
156    file rename ${worksrcpath}/hfs24M.DSK ${worksrcpath}/output.img
157   
158    # Unrestrict the permissions on the output disk image so the Build program
159    # can write its output to it.
160    file attributes ${worksrcpath}/output.img -permissions 0777
161   
162    # Extract the bootstrap version of Mini vMac.
163    my_system "tar -x -z -C ${worksrcpath} -f ${distpath}/${my_bootstrap_distfile}"
164   
165    # Make the data directory, where Mini vMac looks for the files it needs.
166    set my_mnvm_dat "${worksrcpath}/${my_bootstrap_app}/Contents/mnvm_dat"
167    file mkdir ${my_mnvm_dat}
168   
169    # Symlink the ROM file into the data directory.
170    ln -s ${my_app_dir}/${my_rom_file} ${my_mnvm_dat}
171   
172    # Symlink the disk images into the data directory with sequentially-numbered
173    # names so Mini vMac will find them and automatically mount them.
174    ln -s "${worksrcpath}/Disk Tools.dsk" "${my_mnvm_dat}/disk1.dsk"
175    ln -s ${worksrcpath}/${my_src}/${my_src}.dsk "${my_mnvm_dat}/disk2.dsk"
176    ln -s ${worksrcpath}/${my_clipin}/${my_clipin}.dsk "${my_mnvm_dat}/disk3.dsk"
177    ln -s ${worksrcpath}/output.img "${my_mnvm_dat}/disk4.dsk"
178}
179
180pre-configure {
181    set i 0
182    foreach {my_machine my_variation_options} ${my_variations} {
183        if {${i} > 0} {
184            configure.args-append {\;}
185        }
186        configure.args-append \
187            ${my_base_options} \
188            -t ${my_target} \
189            ${my_variation_options} \
190            -n ${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
191        incr i
192    }
193   
194    # Launch Mini vMac so the configure script can talk to it.
195    my_system "open '${worksrcpath}/${my_bootstrap_app}'"
196}
197
198configure.cmd           osascript
199configure.pre_args      ${filespath}/configure.applescript
200
201build.dir               ${workpath}/variations
202
203post-configure {
204    file mkdir ${build.dir}
205    set my_variation_dirs ""
206    set my_output_disk_mount [my_attach_disk_image ${worksrcpath}/output.img]
207    foreach my_variation_dir [glob -nocomplain -type d -tails -directory ${my_output_disk_mount} *] {
208        set my_variation_dirs "${my_variation_dirs} ${my_variation_dir}"
209       
210        # Get the configured source code.
211        file copy ${my_output_disk_mount}/${my_variation_dir} ${build.dir}
212       
213        # Use the right compiler.
214        reinplace "s|gcc|${configure.cc}|g" ${build.dir}/${my_variation_dir}/Makefile
215       
216        # Remove references to SDKs -- the 10.4u SDK is not installed by default on 10.6
217        # and even if you install it manually it does not work here.
218        reinplace -E {s|-isysroot /Developer/SDKs/[^ ]+||g} ${build.dir}/${my_variation_dir}/Makefile
219    }
220    my_detach_disk_image ${my_output_disk_mount}
221   
222    # Set up the global Makefile.
223    xinstall ${filespath}/Makefile.in ${build.dir}/Makefile
224    reinplace "s|@SUBDIRS@|${my_variation_dirs}|" ${build.dir}/Makefile
225   
226    # If no variation directoriess were produced by configuration, either the flags we
227    # passed in were bad, or the automation script got out of sync with the emulator;
228    # if the latter, the delays in configure.applescript may need to be adjusted.
229    if {"" == ${my_variation_dirs}} {
230        return -code error "configuration failed!"
231    }
232}
233
234set my_share_dir        ${prefix}/share/${my_name}
235
236post-build {
237    # To save space, keep only a single copy of the Resources directory.
238    set i 0
239    foreach my_variation_dir [glob -type d -tails -directory ${build.dir} *] {
240        set my_resources_dir ${build.dir}/${my_variation_dir}/minivmac.app/Contents/Resources
241        if {0 == ${i}} {
242            move ${my_resources_dir} ${build.dir}
243        } else {
244            delete ${my_resources_dir}
245        }
246        ln -s ${my_share_dir}/Resources ${my_resources_dir}
247        incr i
248    }
249   
250    # Install the prettier icons.
251    eval xinstall -m 644 [glob ${worksrcpath}/${my_icons}/icons/*.icns] ${build.dir}/Resources
252}
253
254destroot {
255    # Install the global Resources directory.
256    xinstall -d ${destroot}${my_share_dir}
257    copy ${build.dir}/Resources ${destroot}${my_share_dir}
258   
259    # Install the programs.
260    xinstall -d ${destroot}${my_app_dir}
261    foreach {my_machine my_variation_options} ${my_variations} {
262        set my_variation_dir ${version}_${revision}-[strsed [string tolower ${my_machine}] {g/[^a-z0-9_-]//}]-${my_target}
263        file copy ${build.dir}/${my_variation_dir}/minivmac.app \
264            "${destroot}${my_app_dir}/Mini vMac ${my_machine}.app"
265    }
266}
267
268# Mounts a disk image.
269proc my_attach_disk_image {disk_image} {
270    global my_name filespath
271    set mountpoint [mkdtemp "/tmp/${my_name}.XXXXXXXX"]
272    # Use this expect script instead of using hdiutil directly, because the
273    # system disk image has a license agreement we must agree to.
274    my_system "expect ${filespath}/attach.exp '${disk_image}' '${mountpoint}'"
275    return ${mountpoint}
276}
277
278# Unmounts a disk image.
279proc my_detach_disk_image {mountpoint} {
280    my_system "hdiutil detach ${mountpoint} -force"
281    file delete -force ${mountpoint}
282}
283
284proc my_system {cmd} {
285     ui_debug ${cmd}
286     system ${cmd}
287}
288
289livecheck.type          regex
290livecheck.url           ${homepage}beta/index.html
291livecheck.regex         ${my_name}-(\[0-9.\]+)\\.src
Note: See TracBrowser for help on using the repository browser.