Ticket #50288: Portfile

File Portfile, 7.9 KB (added by fhgwright (Fred Wright), 9 years ago)

Complete Portfile for 3.16_0

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 141871 2015-10-30 12:57:05Z mojca@macports.org $
3
4PortSystem              1.0
5
6name                    gpsd
7version                 3.16
8license                 BSD
9categories              net
10maintainers             ryandesign openmaintainer
11platforms               darwin
12
13# The GPSD build procedure does not curently support universal binaries.
14universal_variant       no
15
16description             GPS service daemon
17
18long_description        GPSD is a service daemon that handles GPSes and other \
19                        navigation-related sensors reporting over USB, serial, \
20                        TCP/IP, or UDP connections and presents reports in \
21                        a well-documented JSON format.  The package also \
22                        includes a number of clients which can be run against \
23                        a local GPSD or a GPSD on another machine.
24
25homepage                http://www.catb.org/${name}/
26master_sites            savannah
27
28checksums               rmd160  f61444826db6175f27cb41535c3d62d2536a35d4 \
29                        sha256  03579af13a4d3fe0c5b79fa44b5f75c9f3cac6749357f1d99ce5d38c09bc2029
30
31depends_lib-append      port:ncurses
32
33depends_build           port:scons
34
35# The Python executables now specify "python2" in the shebang line; hence
36# the dependency on python2_select.
37#
38# GPSD requires Python 2.6 or 2.7, but since the scons port requires 2.7,
39# we don't bother with a 2.6 variant.
40#
41depends_run             port:python2_select port:python27
42
43patchfiles              patch-SConstruct.diff \
44                        patch-driver_rtcm2.c.diff \
45                        leopard-IPV6_TCLASS.patch
46
47post-patch {
48    # Fix the bad permissions on gpsprof (in the 3.16 tarball)
49    system "chmod 755 ${worksrcpath}/gpsprof"
50}
51
52use_configure           no
53
54set cxx_stdlibflags {}
55if {[string match *clang* ${configure.cxx}]} {
56    set cxx_stdlibflags -stdlib=${configure.cxx_stdlib}
57}
58
59build.cmd               ${prefix}/bin/scons
60build.target
61build.args              prefix=${prefix} \
62                        qt=no \
63                        usb=no \
64                        strip=no \
65                        dbus_export=no \
66                        xgps=no
67build.env-append        CC="${configure.cc} [get_canonical_archflags cc]" \
68                        CFLAGS="${configure.cflags}" \
69                        CXX="${configure.cxx} [get_canonical_archflags cxx] ${cxx_stdlibflags}" \
70                        CXXFLAGS="${configure.cxxflags}" \
71                        LDFLAGS="${configure.ldflags}"
72
73# Allow the regression tests to be run via "port test gpsd".
74#
75# The speed of the daemon tests is highly dependent on the WRITE_PAD value.
76# In particular, the "ais-nmea-sample" test (with >85000 lines of test data)
77# takes over 44 minutes to run with the standard (for OSX) 30ms WRITE_PAD.
78# Empirically, 200us seems to be adequate on a MacPro, and 500us seems to be
79# adequate on a PowerBook G4, so we use 1ms here.  If needed, this value can
80# be overridden with WRITE_PAD=XXX on the command line, but only if WRITE_PAD
81# is included in extra_env in macports.conf.  In all cases, the WRITE_PAD
82# value in use is reported by the test framework and is visible with -v.
83#
84# Note also that the MacPorts sandbox doesn't allow ptys, so the daemon tests
85# report "gpsfake: ptys not available, falling back to UDP.", but still work.
86# This can be worked around by running "scons testregress" directly in
87# ${worksrcpath}, rather than running it via "port test".
88#
89# The test phase duplicates the arguments and environment (except WRITE_PAD)
90# from the build phase, mainly to avoid gratuitous rebuilds between the phases.
91#
92test.run                yes
93test.target             testregress
94set test.args           ${build.args}
95set test.env            ${build.env}
96if { [info exists ::env(WRITE_PAD)] } {
97    test.env-append     WRITE_PAD=$::env(WRITE_PAD)
98} else {
99    test.env-append     WRITE_PAD=0.001
100}
101
102destroot.args           {*}${build.args}
103destroot.env-append     {*}${destroot.destdir} {*}${build.env}
104
105pre-test {
106    if {[catch {exec which -s python2}]} {
107        ui_error "Running tests requires the python2 command."
108        ui_error "This can be set up by, e.g.:"
109        ui_error ""
110        ui_error "    sudo port select --set python2 python27"
111        ui_error ""
112        return -code error "tests not runnable"
113    }
114}
115
116post-destroot {
117    xinstall -m 644 -W ${worksrcpath} libgps.dylib ${destroot}${prefix}/lib
118}
119
120if {[catch {exec which -s python2}]} {
121    notes "
122        #####################################################################
123        # Running any of the Python utilities requires the python2 command. #
124        # This can be set up via python2_select, e.g.:                      #
125        #                                                                   #
126        #     sudo port select --set python2 python27                       #
127        #                                                                   #
128        #####################################################################"
129}
130
131if {${os.platform} == "darwin"} {
132    # Qt5 isn't officially supported for OSX < 10.8
133    if {${os.major} < 12} {
134        set qt_default 4
135        variant qt conflicts qt5 description {Build Qt4 bindings} {}
136        variant qt4 conflicts qt5 description {Build Qt4 bindings} {}
137        variant qt5 conflicts qt qt4 description {Build Qt5 bindings} {}
138    } else {
139        set qt_default 5
140        variant qt conflicts qt4 description {Build Qt5 bindings} {}
141        variant qt4 conflicts qt qt5 description {Build Qt4 bindings} {}
142        variant qt5 conflicts qt4 description {Build Qt5 bindings} {}
143    }
144} else {
145    set qt_default 0
146    variant qt4 conflicts qt5 description {Build Qt4 bindings} {}
147    variant qt5 conflicts qt4 description {Build Qt5 bindings} {}
148}
149
150if {[variant_isset qt4] || [variant_isset qt] && $qt_default == 4} {
151    PortGroup               qt4 1.0
152    # The following lines are a workaround for #50347
153    build.env-append        PKG_CONFIG_PATH=${qt_pkg_config_dir}
154    test.env-append         PKG_CONFIG_PATH=${qt_pkg_config_dir}
155}
156
157if {[variant_isset qt5] || [variant_isset qt] && $qt_default == 5} {
158    PortGroup               qt5 1.0
159    build.args-append       qt_versioned=5
160    test.args-append        qt_versioned=5
161}
162
163if {[variant_isset qt] || [variant_isset qt4] || [variant_isset qt5]} {
164    build.args-delete       qt=no
165    build.args-append       qt=yes
166    test.args-delete        qt=no
167    test.args-append        qt=yes
168    destroot.args-delete    qt=no
169    destroot.args-append    qt=yes
170}
171
172variant libusb \
173description {Include support for better USB device discovery} {
174    depends_build-append    port:pkgconfig
175    depends_lib-append      port:libusb
176    build.args-delete       usb=no
177    build.args-append       usb=yes
178    test.args-delete        usb=no
179    test.args-append        usb=yes
180    destroot.args-delete    usb=no
181    destroot.args-append    usb=yes
182}
183
184variant dbus description {Include support for DBUS} {
185    depends_lib-append      port:dbus-glib
186    build.args-delete       dbus_export=no
187    build.args-append       dbus_export=yes
188    test.args-delete        dbus_export=no
189    test.args-append        dbus_export=yes
190    destroot.args-delete    dbus_export=no
191    destroot.args-append    dbus_export=yes
192}
193
194variant xgps \
195description {Include xgps/xgpsspeed X11 clients (dependency-intensive)} {
196    depends_run-append      port:py-gobject port:py-pygtk
197    build.args-delete       xgps=no
198    build.args-append       xgps=yes
199    test.args-delete        xgps=no
200    test.args-append        xgps=yes
201    destroot.args-delete    xgps=no
202    destroot.args-append    xgps=yes
203}
204
205livecheck.type          regex
206livecheck.url           http://download.savannah.gnu.org/releases-noredirect/gpsd
207livecheck.regex         "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"