source: users/ryandesign/minivmac-devel/Portfile @ 57916

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

minivmac, minivmac-devel: don't copy the scripts to worksrcpath, since we're not modifying them; run them directly from filespath. This makes it easier to test changes to the scripts because you don't have to clean first.

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