source: trunk/dports/science/sumo/Portfile

Last change on this file was 150848, checked in by khindenburg@…, 12 months ago

sumo: update to 0.27.1 maintainer #51924

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.5 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 150848 2016-07-30 01:43:21Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                sumo
7version             0.27.1
8categories          science devel
9platforms           darwin
10maintainers         gmail.com:tlockhart1976 openmaintainer
11license             GPL-3
12
13description         Simulation of Urban MObility (SUMO)
14long_description \
15    Simulation of Urban MObility (SUMO) is an open source, highly portable, \
16    microscopic road traffic simulation package designed to handle large \
17    road networks. It is mainly developed by employees of the Institute of \
18    Transportation Systems at the German Aerospace Center.
19
20homepage            http://sumo-sim.org/
21master_sites        sourceforge:project/sumo/sumo/version%20${version}/
22
23distname            ${name}-src-${version}
24worksrcdir          ${name}-${version}
25
26checksums           rmd160  f6a69aceda49bd0bd0d0518fa65c827609095a92 \
27                    sha256  4494190bd6570646df7a020befe25bc66355377273d922753685737c0d38bfdf
28
29default_variants    +subseconds +messages
30
31depends_build       port:coreutils
32
33depends_lib-append \
34    port:fox \
35    port:gdal \
36    port:libtool \
37    port:proj \
38    port:xercesc3
39
40# py27-matplotlib requires perl so let it choose which version
41depends_lib-append \
42    port:python27 \
43    port:py27-matplotlib \
44    port:py27-protobuf
45
46set bindir            ${prefix}/bin
47set libdir            ${prefix}/lib
48set sharedir          ${prefix}/share/${name}
49set docdir            ${prefix}/share/doc/${name}
50set python_bin        ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
51set python_lib        ${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages
52
53post-extract {
54    copy ${filespath}/README.macosx ${worksrcpath}/
55}
56
57post-patch {
58    reinplace "s#std::getenv(\"SUMO_HOME\")#\"${sharedir}\"#" src/utils/xml/SUMOSAXReader.cpp
59    reinplace "s#\./PHEMlight/#${sharedir}/data/PHEMlight/#" src/microsim/MSFrame.cpp
60    reinplace "s#\./PHEMlight/#${sharedir}/data/PHEMlight/#" src/router/ROFrame.cpp
61    reinplace -locale C "s#./PHEMlight/#${sharedir}/data/PHEMlight/#" src/tools/emissionsDrivingCycle_main.cpp
62    reinplace -locale C "s#./PHEMlight/#${sharedir}/data/PHEMlight/#" src/tools/emissionsMap_main.cpp
63    set python_bin ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
64    foreach f [list {*}$python_scripts {*}$python_libs {*}$python_tutorials] {
65        reinplace "s#/usr/bin/env python#${python_bin}#" $f
66        reinplace -E "s|^( *)(sys.path.append)|\\1# \\2|" $f
67        reinplace -E "s|^( *)(.*__file__.*\\.\\.)|\\1# \\2|" $f
68        reinplace -E "s|^( *)(os.path.join.*\\.\\.)|\\1# \\2|" $f
69        reinplace -E "s|^( *)(SUMO_HOME =)|\\1  # \\2|" $f
70        reinplace -E "s|^(if .*SUMO_HOME)|if True:  # \\1|" $f
71        reinplace -E "s|^( +)(.*os.path.join.*SUMO_HOME)|\\1# \\2|" $f
72        reinplace -E "s#^( *)from (assign|costMemory|dijkstra|duaIterate|elements|inputs|network|outputs|routeChoices|statisticsElements|tables)#\\1from sumolib.assign.\\2#" $f
73        reinplace -E "s#^( *)from (miscutils|OrderedMultiSet|output|testUtil)#\\1from sumolib.\\2#" $f
74        reinplace -E "s#^import (detector|route2trips|xsd|xml2csv|collectinghandler|connections|netshiftadaptor|route_departOffset|sort_routes|turndefinitions|rmsd|xml2protobuf)#from sumolib import \\1#" $f
75        reinplace -E "s#^import (os,.*), helpers#import \\1, sumolib.helpers as helpers#" $f
76    }
77    reinplace -E "s#@BINDIR@#${bindir}#" README.macosx
78    reinplace -E "s#@LIBDIR@#${libdir}#" README.macosx
79    reinplace -E "s#@DOCDIR@#${docdir}#" README.macosx
80    reinplace -E "s#@PYTHON_LIBDIR@#${python_lib}#" README.macosx
81}
82
83# List of all python scripts. Used later to ensure usage of python27
84# (instead of the currently active python)
85# available in the next release:
86# tools/tlsCoordinator.py
87set python_scripts [list \
88    tools/districts2poly.py \
89    tools/edgesInDistricts.py \
90    tools/generateBidiDistricts.py \
91    tools/pedestrianFlow.py \
92    tools/randomTrips.py \
93    tools/route2trips.py \
94    tools/route2sel.py \
95    tools/traceExporter.py \
96    tools/assign/Assignment.py \
97    tools/assign/cadytsIterate.py \
98    tools/assign/costFunctionChecker.py \
99    tools/assign/duaIterate.py \
100    tools/assign/duaIterate_analysis.py \
101    tools/assign/matrixDailyToHourly.py \
102    tools/assign/networkStatistics.py \
103    tools/assign/one-shot.py \
104    tools/traceExporter.py \
105    tools/detector/aggregateFlows.py \
106    tools/detector/deleteUnusedDetectors.py \
107    tools/detector/flowFromRoutes.py \
108    tools/detector/flowrouter.py \
109    tools/detector/validate.py \
110    tools/district/countConnectionsInDistricts.py \
111    tools/district/districtMapper.py \
112    tools/import/osm/osmPopulationExtractor.py \
113    tools/import/vissim/convert_detectors2SUMO.py \
114    tools/import/vissim/convert_vissimXML_flows_statRoutes.py \
115    tools/import/vissim/tls_vissimXML2SUMOnet_update.py \
116    tools/import/vissim/vissim_parseBusStops.py \
117    tools/import/vissim/vissim_parseRoutes.py \
118    tools/import/visum/visum_convertEdgeTypes.py \
119    tools/import/visum/visum_convertRoutes.py \
120    tools/import/visum/visum_convertTurnPercentages.py \
121    tools/import/visum/visum_parseZaehlstelle.py \
122    tools/net/0103to0110.py \
123    tools/net/0123to0130.py \
124    tools/net/batch0103to0110.py \
125    tools/net/createRoundaboutConnections.py \
126    tools/net/netcheck.py \
127    tools/net/netdiff.py \
128    tools/net/netduplicate.py \
129    tools/net/netextract.py \
130    tools/net/netextract_subPart.py \
131    tools/net/netmatch.py \
132    tools/net/netstats.py \
133    tools/net/network_statistics.py \
134    tools/net/odConnectionsCheck.py \
135    tools/net/patchNetFiles.py \
136    tools/net/prepareVISUM.py \
137    tools/net/reprojectpolys.py \
138    tools/net/visum_mapDistricts.py \
139    tools/net/xmlconnections_mapEdges.py \
140    tools/net/xmledges_applyOffset.py \
141    tools/net/xmlnodes_applyOffset.py \
142    tools/output/accelerations.py \
143    tools/output/analyze_teleports.py \
144    tools/output/generateITetrisIntersectionMetrics.py \
145    tools/output/generateITetrisNetworkMetrics.py \
146    tools/output/generateMeanDataDefinitions.py \
147    tools/output/generateTLSE1Detectors.py \
148    tools/output/generateTLSE2Detectors.py \
149    tools/output/generateTLSE3Detectors.py \
150    tools/output/netdumpdiff.py \
151    tools/output/netdumpmean.py \
152    tools/output/timingStats.py \
153    tools/output/vehLanes.py \
154    tools/output/vehroute2amitranOD.py \
155    tools/output/vehrouteDiff.py \
156    tools/purgatory/10to11.py \
157    tools/purgatory/findUTurns.py \
158    tools/purgatory/kShortest.py \
159    tools/purgatory/routes2OD.py \
160    tools/route/cutRoutes.py \
161    tools/route/route2alts.py \
162    tools/route/route2poly.py \
163    tools/route/routeDiffStats.py \
164    tools/route/route_1htoDay.py \
165    tools/route/route_departOffset.py \
166    tools/route/routecheck.py \
167    tools/route/routecompare.py \
168    tools/route/routes_Join.py \
169    tools/route/sort_routes.py \
170    tools/route/tracegenerator.py \
171    tools/route/tracemapper.py \
172    tools/route/vehicle2flow.py \
173    tools/shapes/CSV2polyconvertXML.py \
174    tools/shapes/circlePolygon.py \
175    tools/shapes/poi_alongRoads.py \
176    tools/shapes/poi_atTLS.py \
177    tools/shapes/pois2inductionLoops.py \
178    tools/tls/tls_check.py \
179    tools/tls/tls_csv2SUMO.py \
180    tools/traci/rebuildConstants.py \
181    tools/traci/traciToHex.py \
182    tools/trigger/csv2vss.py \
183    tools/turn-defs/generateTurnDefs.py \
184    tools/visualization/mpl_dump_onNet.py \
185    tools/visualization/mpl_dump_timeline.py \
186    tools/visualization/mpl_dump_twoAgainst.py \
187    tools/visualization/mpl_tripinfos_twoAgainst.py \
188    tools/visualization/plot_csv_bars.py \
189    tools/visualization/plot_csv_pie.py \
190    tools/visualization/plot_csv_timeline.py \
191    tools/visualization/plot_net_dump.py \
192    tools/visualization/plot_net_selection.py \
193    tools/visualization/plot_net_speeds.py \
194    tools/visualization/plot_net_trafficLights.py \
195    tools/visualization/plot_summary.py \
196    tools/visualization/plot_tripinfo_distributions.py \
197    tools/xml/binary2plain.py \
198    tools/xml/csv2xml.py \
199    tools/xml/protobuf2xml.py \
200    tools/xml/rebuildSchemata.py \
201    tools/xml/schemaCheck.py \
202    tools/xml/xml2csv.py \
203    tools/xml/xml2protobuf.py \
204]
205
206set python_libs [list \
207    tools/route2trips.py \
208    tools/assign/assign.py \
209    tools/assign/costMemory.py \
210    tools/assign/dijkstra.py \
211    tools/assign/elements.py \
212    tools/assign/inputs.py \
213    tools/assign/network.py \
214    tools/assign/outputs.py \
215    tools/assign/run.py \
216    tools/assign/statisticsElements.py \
217    tools/assign/tables.py \
218    tools/net/netshiftadaptor.py \
219    tools/net/OrderedMultiSet.py \
220    tools/route/route_departOffset.py \
221    tools/sumolib/geomhelper.py \
222    tools/trigger/csv2vss.py \
223    tools/turn-defs/connections.py \
224    tools/turn-defs/turndefinitions.py \
225    tools/xml/xml2csv.py \
226    tools/xml/xml2protobuf.py \
227    tools/xml/xsd.py \
228]
229
230set python_tutorials [list \
231    docs/tutorial/city_mobil/constants.py \
232    docs/tutorial/city_mobil/statistics.py \
233    docs/tutorial/hello/runner.py \
234    docs/tutorial/output_parsing/runner.py \
235    docs/tutorial/quickstart/runner.py \
236    docs/tutorial/san_pablo_dam/runner.py \
237    docs/tutorial/traci_tls/runner.py \
238]
239
240# required for the gui to be enabled
241configure.args-append \
242    --with-fox=${prefix}
243
244variant debug description {Enable SUMO debugging code} {
245    configure.args-append \
246        --enable-debug
247}
248
249variant double_precision description {Use "double" instead of "float" for calculations} {
250    configure.args-append \
251        --enable-double-precision
252}
253
254variant subseconds description {Enable subsecond timesteps} {
255    configure.args-append \
256        --enable-subsecond
257}
258
259variant messages description {Enable static and dynamic messages emitted by vehicles} {
260    configure.args-append \
261        --enable-messages
262}
263
264variant no_internal_lanes description {Disable junction internal lanes} {
265    configure.args-append \
266        --disable-internal-lanes
267}
268
269variant no_traci description {Disable Traffic Control Interface (TraCI) Server} {
270    configure.args-append \
271        --disable-traci
272}
273
274post-destroot {
275    xinstall -m 755 -d ${destroot}${python_lib}
276    file copy ${worksrcpath}/tools/sumolib ${destroot}${python_lib}/
277    if {![variant_isset no_traci]} {
278        file copy ${worksrcpath}/tools/traci ${destroot}${python_lib}/
279    }
280    file copy ${worksrcpath}/tools/assign ${destroot}${python_lib}/sumolib/
281    touch ${destroot}${python_lib}/sumolib/assign/__init__.py
282    file copy ${worksrcpath}/tools/turn-defs/connections.py ${destroot}${python_lib}/sumolib/
283    file copy ${worksrcpath}/tools/turn-defs/turndefinitions.py ${destroot}${python_lib}/sumolib/
284    xinstall -m 755 ${worksrcpath}/tools/detector/detector.py ${destroot}${python_lib}/sumolib/
285    xinstall -m 755 ${worksrcpath}/tools/route/sort_routes.py ${destroot}${python_lib}/sumolib/
286    xinstall -m 755 ${worksrcpath}/tools/turn-defs/collectinghandler.py ${destroot}${python_lib}/sumolib/
287    xinstall -m 755 ${worksrcpath}/tools/lib/rmsd.py ${destroot}${python_lib}/sumolib/
288    xinstall -m 755 ${worksrcpath}/tools/lib/play.png ${destroot}${python_lib}/sumolib/
289    xinstall -m 755 ${worksrcpath}/tools/lib/stop.png ${destroot}${python_lib}/sumolib/
290    xinstall -m 755 ${worksrcpath}/tools/lib/testUtil.py ${destroot}${python_lib}/sumolib/
291
292    foreach f $python_libs {
293        xinstall -m 755 ${worksrcpath}/${f} ${destroot}${python_lib}/sumolib/
294    }
295
296    foreach f [list {*}$python_scripts] {
297        # convert file names to use dash rather than underscore and remove trailing .py or .pl
298        set x [string map [list _ -] [file rootname [file tail ${f}]]]
299        xinstall -m 755 ${worksrcpath}/${f} ${destroot}${bindir}/sumo-${x}
300    }
301
302    xinstall -m 755 -d ${destroot}${sharedir}
303    foreach d [list emissions typemap xsd] {
304        file copy ${worksrcpath}/data/${d} ${destroot}${sharedir}/${d}/
305    }
306    # tests/ is not included in the source tarball
307    # file copy ${worksrcpath}/tests ${destroot}${sharedir}/
308
309    xinstall -m 755 -d ${destroot}${docdir}
310    file copy ${worksrcpath}/README ${destroot}${docdir}/
311    file copy ${worksrcpath}/README.macosx ${destroot}${docdir}/
312    file copy ${worksrcpath}/docs/examples ${destroot}${docdir}/
313    file copy ${worksrcpath}/docs/tutorial ${destroot}${docdir}/
314    file copy ${worksrcpath}/data ${destroot}${sharedir}/data/
315}
316
317notes "
318    *** Many program names are prefixed by sumo- for this port.
319    *** See ${docdir}/README.macosx for additional notes.
320"
321
322livecheck.regex     ${name}-src-(\[0-9.\]+)${extract.suffix}
Note: See TracBrowser for help on using the repository browser.