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

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

minivmac-devel: add Macintosh SE FDHD version to standard install, and move Macintosh Classic version from unsupported variant to standard install

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.4 KB
Line 
1# $Id: Portfile 52879 2009-06-25 02:13:26Z ryandesign@macports.org $
2
3PortSystem              1.0
4
5name                    minivmac-devel
6set my_name             minivmac
7version                 3.1.0-20090402
8revision                5
9set version_number      [lindex [split ${version} -] 0]
10set version_date        [lindex [split ${version} -] 1]
11set version_short_date  [string range ${version_date} 2 end]
12categories              emulators aqua
13maintainers             ryandesign
14homepage                http://minivmac.sourceforge.net/
15use_zip                 yes
16platforms               macosx
17universal_variant       no
18build.target
19use_parallel_build      yes
20dist_subdir             ${my_name}
21
22description \
23    a Mac 128K, Mac 512K, Mac 512KE, Mac Plus and Mac SE emulator
24
25long_description \
26    Mini vMac is a Macintosh emulator. It emulates the earliest Macs, \
27    from the original Mac 128K (built 1984-85) to the Mac SE (1987-1990). \
28    The default is to emulate a Mac Plus (1986-1990)\; this is also \
29    the best-tested and therefore recommended emulation.
30
31master_sites            sourceforge:${my_name}
32
33distname                ${my_name}${version_short_date}
34set my_src              ${distname}.src
35set my_src_distfile     ${my_src}.zip
36set my_icons            icnsosx-1.0.0
37set my_icons_distfile   ${my_icons}.zip
38
39distfiles \
40    ${my_src_distfile} \
41    ${my_icons_distfile}
42
43checksums \
44    ${my_src_distfile} \
45        md5     7defdcb859cdda0df3bdc3c252370a70 \
46        sha1    f4a80b326380746b88993d53eeb6a7d46768358b \
47        rmd160  828eb032ea3ac0f52054d0c8af1d6910ded1dff0 \
48    ${my_icons_distfile} \
49        md5     2af006506de7549be14f94317918d59a \
50        sha1    4ef79bb56b988fedfeb82a8b6cafd8066f5bbab2 \
51        rmd160  cef6d7d7578464538d0042b0d98379ae7f18fab7
52
53patchfiles \
54    patch-build.diff \
55    patch-gcc.diff
56
57set my_appdir           "${applications_dir}/Mini vMac"
58set my_target           ""
59
60#   variation_id    variation_suffix    variation_options
61set my_variations {
62    128K            "128K"              {-m 128K}
63    512K            "512K"              {-m 128K -mem 512K}
64    512Ke           "512Ke"             {-m 512Ke}
65    Plus            "Plus"              {-m Plus -im 1}
66    SE              "SE"                {-m SE}
67    SEFDHD          "SE FDHD"           {-m SEFDHD}
68    Classic         "Classic"           {-m Classic}
69}
70
71set my_romfiles {
72    Mac128K.ROM
73    vMac.ROM
74    MacSE.ROM
75    SEFDHD.ROM
76    Classic.ROM
77}
78
79variant unsupported description {Also build unfinished Macintosh II and IIx emulators} {
80    set my_variations [concat ${my_variations} {
81        II          "II"                {-m II -mem 8M -hres 800 -vres 600 -depth 3}
82        IIx         "IIx"               {-m IIx -mem 8M -hres 800 -vres 600 -depth 3}
83    }]
84    set my_romfiles [concat ${my_romfiles} {
85        MacII.ROM
86        MacIIx.ROM
87    }]
88}
89
90platform powerpc {
91    set my_target mach
92}
93
94platform i386 {
95    set my_target imch
96}
97
98post-install {
99    set found 0
100    foreach my_romfile ${my_romfiles} {
101        if {[file exists ${my_appdir}/${my_romfile}]} {
102            ui_debug "Found ROM file ${my_appdir}/${my_romfile}"
103            set found 1
104        }
105    }
106    if {!${found}} {
107        ui_msg "****************************************************************"
108        ui_msg "Mini vMac requires a ROM file from the type of machine(s) you're"
109        ui_msg "emulating in order to work. ROM files are not included with this"
110        ui_msg "package because they are copyrighted Apple software."
111        ui_msg "To create a ROM file, download the CopyRoms program from"
112        ui_msg "${homepage}extras/copyroms.html"
113        ui_msg "and transfer it to a real physical early Macintosh that you own."
114        ui_msg "Run the CopyRoms program there, then transfer the ROM file back"
115        ui_msg "to this Mac and put it in ${my_appdir}."
116        ui_msg "****************************************************************"
117    }
118}
119
120post-extract {
121    xinstall -W ${filespath} runbuild.sh ${workpath}
122   
123    # The disk image mounter likes images to have the .img extension.
124    file rename ${workpath}/${my_src}/${my_src}.dsk ${workpath}/src.img
125   
126    # Mount the source disk image.
127    set my_src_disk_mount [my_attach_disk_image ${workpath}/src.img 0]
128   
129    # Copy the source from the disk image into the workpath.
130    file mkdir ${worksrcpath}
131    foreach thing {COPYING.txt README.txt output projects source} {
132        copy ${my_src_disk_mount}/${thing} ${worksrcpath}
133    }
134   
135    # Unmount the disk image.
136    my_detach_disk_image ${my_src_disk_mount}
137   
138    # Convert CR to LF line endings.
139    fs-traverse thing ${worksrcpath} {
140        if {[file isfile ${thing}]} {
141            foreach extension {.a .c .h .i .plist .r Makefile} {
142                if {[string match "*${extension}" ${thing}]} {
143                    reinplace "s/\r/\\\n/g" ${thing}
144                }
145            }
146        }
147    }
148}
149
150build.env-append        CC=${configure.cc}
151
152configure {
153    # Build the build system.
154    if {![file exists ${worksrcpath}/Build.app]} {
155        set my_cmd "cd ${worksrcpath}/projects/gcc_${my_target} && ${build.env} [build_getnicevalue] make [build_getmakejobs]"
156        ui_debug ${my_cmd}
157        system ${my_cmd}
158        file rename ${worksrcpath}/projects/gcc_${my_target}/Build.app ${worksrcpath}
159    }
160   
161    file mkdir ${workpath}/${my_target}
162    foreach {variation_id variation_suffix variation_options} ${my_variations} {
163        ui_debug "Configuring ${variation_id}"
164       
165        # Due to limitations of the build system, the variation name cannot be longer than 27 characters.
166        set variation_name ${version}_${revision}-${variation_id}
167       
168        # Write our options file.
169        set my_options_file ${workpath}/${variation_name}.txt
170        set my_options "-maintainer MacPorts -homepage http://www.macports.org/ -cl -eol unx -nex -t ${my_target} -n ${variation_name} ${variation_options}"
171        set my_options_file_id [open ${my_options_file} "w"]
172        puts -nonewline ${my_options_file_id} ${my_options}
173        close ${my_options_file_id}
174       
175        # Run the build system.
176        set my_cmd "${workpath}/runbuild.sh ${worksrcpath} ${my_options_file}"
177        ui_debug ${my_cmd}
178        system ${my_cmd}
179       
180        # Get the build product.
181        file rename ${worksrcpath}/output/${variation_name} ${workpath}/${my_target}/${variation_id}
182    }
183}
184
185build {
186    foreach {variation_id variation_suffix variation_options} ${my_variations} {
187        ui_debug "Building ${variation_id}"
188       
189        build.dir ${workpath}/${my_target}/${variation_id}
190        set my_cmd "cd ${build.dir} && ${build.env} [build_getnicevalue] ${build.cmd} ${build.target} [build_getmakejobs]"
191        ui_debug ${my_cmd}
192        system ${my_cmd}
193       
194        # Only keep a single copy of the Resources to save space.
195        if {![file exists ${workpath}/Resources]} {
196            copy ${workpath}/${my_target}/${variation_id}/minivmac.app/Contents/Resources ${workpath}
197        }
198        delete ${workpath}/${my_target}/${variation_id}/minivmac.app/Contents/Resources
199    }
200}
201
202destroot {
203    set my_sharedir ${prefix}/share/${my_name}/
204    xinstall -d ${destroot}${my_sharedir}
205    copy ${workpath}/Resources ${destroot}${my_sharedir}
206    eval xinstall -m 644 [glob ${workpath}/${my_icons}/icons/*.icns] ${destroot}${my_sharedir}/Resources
207   
208    xinstall -d ${destroot}${my_appdir}
209    foreach {variation_id variation_suffix variation_options} ${my_variations} {
210        ui_debug "Staging ${variation_id}"
211       
212        set my_app "${my_appdir}/Mini vMac ${variation_suffix}.app"
213        file copy ${workpath}/${my_target}/${variation_id}/minivmac.app \
214            ${destroot}${my_app}
215        ln -s ${my_sharedir}/Resources ${destroot}${my_app}/Contents
216    }
217}
218
219proc my_attach_disk_image {disk_image allow_writing} {
220    global name workpath
221    set mountpoint [exec mktemp -d -q -t ${name}]
222    if {${allow_writing}} {
223        set flag "-readwrite"
224    } else {
225        set flag "-readonly"
226    }
227    set my_cmd "hdiutil attach ${disk_image} -mountpoint ${mountpoint} -private -nobrowse -noautoopen -noautofsck -noverify ${flag}"
228    ui_debug ${my_cmd}
229    system ${my_cmd}
230    return ${mountpoint}
231}
232
233proc my_detach_disk_image {mountpoint} {
234    set my_cmd "hdiutil detach ${mountpoint} -force"
235    ui_debug ${my_cmd}
236    system ${my_cmd}
237    file delete -force ${mountpoint}
238}
239
240livecheck.check         regex
241livecheck.version       ${version_short_date}
242livecheck.url           ${homepage}develop/
243livecheck.regex         ${my_name}(\[0-9\]+)\\.src
Note: See TracBrowser for help on using the repository browser.