adding osx application bundler scripts
[pspp] / utilities / osxbundler / macports-custom-packages / pspp / Portfile
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 147432 2016-04-03 16:28:15Z snc@macports.org $
3
4 PortSystem              1.0
5 PortGroup               app 1.0
6 PortGroup               active_variants 1.1
7
8 name                    pspp
9 version                 0.10.1
10 categories              math
11 license                 GPL-3+
12 maintainers             snc
13 conflicts               pspp-devel
14 description             Statistical analysis of sampled data (free \
15                         replacement for SPSS).
16 long_description        PSPP is a program for \
17                         statistical analysis of sampled data. It is a Free \
18                         replacement for the proprietary program SPSS, and \
19                         appears very similar to it with a few exceptions.
20
21 homepage                http://www.gnu.org/software/pspp/
22 platforms               darwin
23 master_sites            gnu
24
25 checksums           rmd160  5b5aea62137b5c98a7360a42b51c86385db22f37 \
26                     sha256  44cc08864de736880bc0d7e2b1f8c8493ac0e0c2164a4f9471077608f00c8677
27
28 depends_lib-append  path:lib/pkgconfig/cairo.pc:cairo \
29                     port:fontconfig \
30                     port:freetype \
31                     port:gettext \
32                     path:lib/pkgconfig/glib-2.0.pc:glib2 \
33                     port:gsl \
34                     port:libiconv \
35                     port:libxml2 \
36                     port:ncurses \
37                     path:lib/pkgconfig/pango.pc:pango \
38                     port:readline \
39                     port:zlib
40
41 depends_build-append    port:pkgconfig \
42                         port:texinfo
43
44 post-extract {
45     if {[variant_isset gui]} {
46         copy ${filespath}/PSPP ${worksrcpath}
47         file attributes ${worksrcpath}/PSPP -permissions ugo+rx
48     }
49 }
50
51 post-patch {
52     if {[variant_isset gui]} {
53         reinplace s|@@PREFIX@@|${prefix}|g ${worksrcpath}/PSPP
54     }
55 }
56
57 configure.args-append   --disable-rpath \
58                     --without-libpq \
59                     --without-gui \
60                     --without-perl-module \
61                     --with-packager=snc \
62                     --with-packager-version=${version} \
63                     --with-packager-bug-reports=${maintainers}
64
65 set nif_compilers {macports-llvm-gcc-4.2 llvm-gcc-4.2}
66 if {[lsearch -exact ${nif_compilers} ${configure.compiler}] > -1} {
67     configure.optflags-append -fno-inline-functions
68 }
69
70 test.run                yes
71 test.target             check
72
73 variant help requires gui description {Provide in-application help via yelp} {
74     depends_run-append  port:yelp
75 }
76
77 variant doc description {Build documentation} {
78     build.target-append  html
79 }
80
81 variant reloc requires quartz description {Enable relocation build for app bundle} {
82     configure.args-append --enable-relocatable
83 }
84
85 variant postgres description {Enables reading of postgresql databases} {
86     depends_lib-append  port:postgresql92
87     configure.args-delete   --without-libpq
88     configure.ldflags-append -L${prefix}/lib/postgresql92
89     configure.env-append    PG_CONFIG=${prefix}/lib/postgresql92/bin/pg_config
90 }
91
92 variant gui description {Build PSPPIRE, the graphical interface} {
93     depends_lib-append      port:atk \
94                             port:gdk-pixbuf2 \
95                             port:gtksourceview3
96     depends_run-append      port:adwaita-icon-theme
97
98     configure.args-delete   --without-gui
99 }
100
101 variant quartz requires gui {
102     require_active_variants gtk3 quartz
103     require_active_variants gtksourceview3 quartz
104 }
105
106 variant x11 requires gui {
107     require_active_variants gtk3 x11
108     depends_lib-append  port:xorg-libX11 \
109                         port:xorg-libXau \
110                         port:xorg-libXcomposite \
111                         port:xorg-libXcursor \
112                         port:xorg-libXdamage \
113                         port:xorg-libXdmcp \
114                         port:xorg-libXext \
115                         port:xorg-libXfixes \
116                         port:xorg-libXi \
117                         port:xorg-libXinerama \
118                         port:xorg-libXrandr \
119                         port:xorg-libxcb \
120                         port:xrender
121 }
122
123 if {![variant_isset x11] && ![variant_isset quartz] && ![variant_isset gui]} {
124     default_variants +x11
125 }
126
127 # check for x11-poisoned dependencies
128 set x11 no
129 set depspecs {gtk3}
130 foreach depspec depspecs {
131     if {![catch {set result [active_variants $depspec x11]}]} {
132         if {$result} {
133             $x11 yes
134             break
135         }
136     }
137 }
138
139 # if x11 poison, depend on x11
140 if {[string is true -strict $x11]} {
141     default_variants +x11
142 }
143
144 post-destroot {
145     if {[variant_isset doc]} {
146         xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
147         foreach fl [glob -nocomplain -directory ${worksrcpath}/doc *.pdf *.html] {
148             copy ${fl} ${destroot}${prefix}/share/doc/${name}
149         }
150     }
151 }
152
153 post-activate {
154     system "${prefix}/bin/gtk-update-icon-cache-3.0 --ignore-theme-index ${prefix}/share/icons/hicolor"
155
156 }
157
158 post-deactivate {
159     system "${prefix}/bin/gtk-update-icon-cache-3.0 --ignore-theme-index ${prefix}/share/icons/hicolor"
160 }
161
162 if {![variant_isset gui]} {
163     app.create      no
164 }
165 app.name            PSPP
166 app.executable      ${worksrcpath}/PSPP
167 app.icon            ${filespath}/logo.png