Ticket #25798: Portfile

File Portfile, 4.9 KB (added by mp.naq1@…, 14 years ago)

Portfile

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem      1.0
5
6name            poco
7version         1.3.6p2
8categories      devel
9maintainers     nox openmaintainer
10platforms       darwin
11description     POCO C++ Libraries
12
13long_description \
14    POCO aims to be for network-centric, cross-platform C++ software development \
15    what Apple's Cocoa is for Mac development, or Ruby on Rails is for Web \
16    development -- a powerful, yet easy to use platform to build your applications upon.
17
18homepage        http://pocoproject.org/
19master_sites    sourceforge
20distname        ${name}-${version}-all
21set docdistname ${name}-[strsed ${version} {s/[a-z].*$//}]-doc
22
23checksums       [suffix ${distname}] \
24                    md5     6adfe63f119f0d5bd07898881cf74713 \
25                    sha1    44f7e4f412eb7f425a4a88f264c03c257411aa18 \
26                    rmd160  4811b8704f1de15b18fd8924caa0e7eac956b202 \
27                ${docdistname}.zip \
28                    md5     e58b517c08661000581f732c24fd0a8f \
29                    sha1    8356abfb11fc2694fa46d2c93e9b7dce75bd9371 \
30                    rmd160  471ad082126dbe0d40494a7b2bce1dbeaac83b78
31
32set config      Darwin
33set omit        {NetSSL_OpenSSL Data/ODBC Data/MySQL Crypto}
34
35configure.args  --no-samples
36
37pre-configure {
38    configure.args-append   --omit=[join ${omit} ,]
39
40    reinplace -E "/^C(XX)?FLAGS +=/s|\$| ${configure.cppflags} ${configure.cflags}|" \
41        ${worksrcpath}/build/config/${config}
42    reinplace -E "/^((SH|DY)LIB|LINKFLAGS) +=/s|\$| -L\$(LIBPATH) ${configure.ldflags}|" \
43        ${worksrcpath}/build/config/${config}
44}
45
46use_parallel_build  yes
47
48build.target    poco
49
50test.run        yes
51
52test {
53    proc luniq {list} {
54        set x() {}; unset x
55        foreach {item} ${list} {
56            set x(${item}) ""
57        }
58        return [array names x]
59    }
60
61    set file [open ${worksrcpath}/components]
62
63    set components {}
64    while {[gets ${file} component] != -1} {
65        lappend components ${component}
66    }
67
68    close ${file}
69
70    foreach {component} [luniq ${components}] {
71        foreach {testrunner} [glob -nocomplain ${worksrcpath}/${component}/testsuite/bin/*/*/testrunner{,d}] {
72            catch {system "${testrunner} -all -print"}
73        }
74    }
75}
76
77set docdir      ${prefix}/share/doc/${name}-${version}
78
79post-destroot {
80    xinstall -d ${destroot}${docdir}
81    xinstall -m 0644 -W ${worksrcpath} CHANGELOG CONTRIBUTORS LICENSE NEWS README VERSION \
82        ${destroot}${docdir}
83
84    if {![variant_isset doc]} {
85        xinstall -d ${destroot}${docdir}/html
86        xinstall -m 0644 -W ${worksrcpath}/doc Acknowledgements.html ${destroot}${docdir}/html
87    }
88
89    set libdir ${prefix}/lib
90
91    foreach {dylib} [glob -types f -tails -directory ${destroot}${libdir} *.dylib] {
92        system "install_name_tool -id ${libdir}/${dylib} ${destroot}${libdir}/${dylib}"
93
94        set otool [lrange [split [exec otool -L ${destroot}${libdir}/${dylib}] \n] 2 end]
95
96        foreach {otoolentry} ${otool} {
97            set lib [lindex ${otoolentry} 0]
98
99            if {! [string match ${worksrcpath}/* ${lib}]} {
100                continue
101            }
102
103            system "install_name_tool -change ${lib} ${libdir}/[file tail ${lib}] \
104                ${destroot}${libdir}/${dylib}"
105        }
106    }
107}
108
109variant ssl description {Build NetSSL and Crypto library} {
110    depends_lib-append      port:openssl
111    set omit [ldelete [ldelete ${omit} NetSSL_OpenSSL] Crypto]
112}
113
114variant odbc description {Build ODBC backend for Data library} {
115    depends_lib-append      lib:libiodbc:unixODBC
116    set omit [ldelete ${omit} Data/ODBC]
117}
118
119variant mysql description {Build MySQL backend for Data library} {
120    depends_lib-append      path:bin/mysql_config5:mysql5
121
122    post-configure {
123        reinplace -E "/^C(XX)?FLAGS +=/s|\$| -I${prefix}/include/mysql5/mysql|" \
124            ${worksrcpath}/build/config/${config}
125        reinplace -E "/^((SH|DY)LIB|LINKFLAGS) +=/s|\$| -L${prefix}/lib/mysql5/mysql|" \
126            ${worksrcpath}/build/config/${config}
127    }
128
129    set omit [ldelete ${omit} Data/MySQL]
130}
131
132variant doc description {Install extra documentation} {
133    extract.only            ${distfiles}
134    distfiles-append        ${docdistname}.zip
135
136    post-extract {
137        system "unzip ${distpath}/${docdistname}.zip -d ${workpath}"
138    }
139
140    post-destroot {
141        set workdocpath ${workpath}/${docdistname}
142
143        xinstall -d ${destroot}${docdir}/html/CppUnit
144        eval xinstall -m 0644 [glob -directory ${workdocpath} *.html] ${destroot}${docdir}/html
145        eval xinstall -m 0644 [glob -directory ${worksrcpath}/CppUnit/doc *] ${destroot}${docdir}/html/CppUnit
146
147        foreach {dir} {images css} {
148            xinstall -d ${destroot}${docdir}/html/${dir}
149            eval xinstall -m 0644 [glob -directory ${workdocpath}/${dir} *] ${destroot}${docdir}/html/${dir}
150        }
151    }
152}
153
154livecheck.regex "<title>sources ${name}-(.*) released.*</title>"