source: trunk/dports/devel/icu/Portfile @ 134323

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

icu: take over as maintainer; use {*} instead of eval; remove old pre-deactivate block

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.0 KB
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: Portfile 134323 2015-03-22 21:58:46Z ryandesign@macports.org $
3
4PortSystem      1.0
5
6name            icu
7set my_name     icu4c
8# Don't forget to increase the revision number of the dependents (e.g. boost)
9# whenever the library version number changes. Thanks.
10# To find dependencies, use:
11# port file all | sort -u | xargs grep -E ':icu( |$)' | cut -d / -f 12 | sort -u
12version         54.1
13categories      devel textproc
14platforms       darwin freebsd
15maintainers     ryandesign openmaintainer
16license         MIT
17
18description     International Components for Unicode
19
20long_description \
21    The International Components for Unicode (ICU) libraries provide robust \
22    and full-featured Unicode services on a wide variety of platforms. ICU \
23    supports the most current version of the Unicode standard, and they provide \
24    support for supplementary Unicode characters (needed for GB 18030 repertoire support).
25
26homepage        http://www.icu-project.org/
27master_sites    http://download.icu-project.org/files/${my_name}/${version}/
28
29distname        ${my_name}-[join [split ${version} .] _]
30
31worksrcdir      ${name}/source
32set docdir      ${prefix}/share/doc/${name}
33
34subport ${name}-docs {
35    conflicts           ${name}-doxygen-docs
36    supported_archs     noarch
37
38    description-append  (documentation)
39    long_description-append Documentation.
40   
41    distfiles           ${distname}-docs.zip
42    checksums           rmd160  30fa1ba3c579f65aa59bbf80854f6c302be42fa4 \
43                        sha256  879fbfc4f0609c1ed113496ebea7dc5e531b95f2d8507ec50b2262adbe96b2e8
44   
45    use_zip             yes
46    extract.suffix      .zip
47    extract.dir         ${worksrcpath}/doc/html
48
49    use_configure       no
50
51    build {}
52
53    destroot {
54        xinstall -m 755 -d ${destroot}${docdir}
55        copy ${worksrcpath}/doc/html ${destroot}${docdir}
56    }
57}
58
59subport ${name}-doxygen-docs {
60    conflicts           ${name}-docs
61    supported_archs     noarch
62   
63    depends_build       port:doxygen
64
65    description-append  (build documentation)
66    long_description-append Build documentation.
67   
68    build.target     doc
69    destroot.target  install-doc
70}
71
72if { ${subport} ne "${name}-docs" } {
73    if { ${supported_archs} ne "noarch" } {
74        PortGroup       muniversal 1.0
75    }
76   
77    extract.suffix  .tgz
78    distfiles       ${distname}-src${extract.suffix}
79   
80    checksums       rmd160  b1440e1a3330b12336742c881863a8de6a6d2235 \
81                    sha256  d42bc9a8ca6a91c55eb0925c279f49e5b508d51ef26ac9850d9be55de5bb8ab3
82   
83    patchfiles      patch-config-mh-darwin.diff
84   
85    # icu appends -O2 to the cflags and cxxflags
86    configure.optflags-delete -Os
87   
88    # ICU has three mechanisms to aid other projects in building properly
89    #     1) .pc files for pkg-config
90    #     2) shell script icu-config that can output compiler flags
91    #     3) Makefile include files Makefile.inc and pkgdata.inc
92    # For a time, all three assumed other projects would want to be
93    #     built as ICU had been built, regardless of whether it was appropriate.
94    # For the most part, the extraneous flags have been removed.
95    #     1) They have been removed completely from the .pc files.
96    #        pkg-config is the recommended way of building against ICU.
97    #     2) icu-config does not print them out, but they are still contained in the script itself.
98    #     3) They still exist in the Makefile include files.
99    #
100    # for descriptions of the problem, see
101    #     r101578
102    #     #40069
103    #     https://bugs.gentoo.org/show_bug.cgi?id=202059
104    #
105    # for upstream reports and discussion, see
106    #    http://bugs.icu-project.org/trac/ticket/10308
107    #    http://bugs.icu-project.org/trac/ticket/6102
108    if { [variant_exists universal] && [variant_isset universal]} {
109        merger-post-destroot {
110            set rebuilton ""
111            foreach arch ${universal_archs_to_use} {
112                set dir ${destroot}-${arch}
113               
114                # SIZEOF_VOID_P is no longer used in icu-config, so remove it to facilitate merging of the shell script
115                reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${dir}${prefix}/bin/icu-config
116               
117                # icu-config contains the exact time it was built, which makes merging difficult
118                # ensure that all versions of icu-config have the same build timestamp
119                if { ${rebuilton} eq "" } {
120                    set rebuilton [exec /usr/bin/tail -n 1 ${dir}${prefix}/bin/icu-config]
121                } else {
122                    reinplace "s|^# Rebuilt on .*|${rebuilton}|" ${dir}${prefix}/bin/icu-config
123                }
124               
125                # Removing architecture specific information from the Makefile include files is necessary to merge them correctly.
126                # It is conceivable that this could cause problems for certain projects.
127                # The developers of ICU suggest using pkg-config over both icu-config and the Makefile includes.
128                reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${dir}${prefix}/lib/icu/${version}/Makefile.inc
129                reinplace -E {s:-arch +[^ ]+::g} ${dir}${prefix}/lib/icu/${version}/pkgdata.inc
130            }
131        }
132    } else {
133        post-destroot {
134            # stay consistent with the universal build (see comments above)
135            if { [file exists ${destroot}${prefix}/bin/icu-config] } {
136                reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${destroot}${prefix}/bin/icu-config
137            }
138            if { [file exists ${destroot}${prefix}/lib/icu/${version}/Makefile.inc] } {
139                reinplace {s| -DSIZEOF_VOID_P=[48]||g} ${destroot}${prefix}/lib/icu/${version}/Makefile.inc
140            }
141            if { [file exists ${destroot}${prefix}/lib/icu/${version}/pkgdata.inc] } {
142                reinplace -E {s:-arch +[^ ]+::g} ${destroot}${prefix}/lib/icu/${version}/pkgdata.inc
143            }
144        }
145    }
146   
147    set platform [switch ${os.platform} {darwin {format MacOSX} freebsd {format FreeBSD}}]
148    configure.cmd   ./runConfigureICU ${platform}
149   
150    configure.args  --enable-static \
151                    --disable-samples
152   
153    configure.universal_args-delete --disable-dependency-tracking
154    if {[variant_isset universal]} {
155        # ICU detects cross compiling by trying to run binaries.
156        # r73849 and #29904 indicate that cross compiling is a problem.
157        # Of the solutions tried (r79660, r73865, and r73849), simply disallowing cross compiling is by far the simplest.
158        # Note that #29904 should not show up again because universal now better recognizes 32/64-bit cross compiling (r79658)
159        set merger_must_run_binaries "yes"
160    }
161   
162    # Fix bug #11981 that prevents ICU from building when upgrading.
163    # The default configure flags causes utilisation of outdated ICU
164    # headers/libs instead of the right ones.
165    configure.cppflags
166    configure.ldflags
167   
168    build.type      gnu
169    build.args      VERBOSE=1
170   
171    use_parallel_build  yes
172   
173    test.run        yes
174    test.target     check
175    test.args       VERBOSE=1
176   
177    if { ${name} eq ${subport} } {
178        post-destroot {
179            xinstall -d ${destroot}${docdir}
180            xinstall -m 0644 {*}[glob ${worksrcpath}/../*.{css,html,txt}] ${destroot}${docdir}
181        }
182       
183        if { [variant_isset doc] } {
184            ui_warn "You have requested an obsolete variant. Replaced by port ${name}-docs"
185            depends_build-append port:${name}-docs
186        }
187        if { [variant_isset doxygen] } {
188            ui_warn "You have requested an obsolete variant. Replaced by port ${name}-doxygen-docs"
189            depends_build-append port:${name}-doxygen-docs
190        }
191    }
192   
193    platform freebsd {
194        build.env       MAKE=/usr/local/bin/gmake
195        destroot.env    MAKE=/usr/local/bin/gmake
196    }
197   
198    platform darwin 8 {
199        patchfiles-append patch-common-putil.cpp.diff
200    }
201}
202
203livecheck.url   http://site.icu-project.org/download
204livecheck.regex {>ICU4C \((\d+(?:\.\d+)*)\)<}
Note: See TracBrowser for help on using the repository browser.