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

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

Mark conflicting ports

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