Ticket #19834: Portfile

File Portfile, 6.7 KB (added by arsptr@…, 15 years ago)

First attempt. I've tested this with +docs +graphml +icu and +python25. I specifically haven't tried with +openmpi or the other variants (yet).

Line 
1# $Id: Portfile 49577 2009-04-12 13:36:57Z jmr@macports.org $
2
3PortSystem 1.0
4
5name                    boost
6version                 1.39.0
7categories              devel
8maintainers             gmail.com:sanchom
9description             Collection of portable C++ source libraries
10long_description        Boost provides free portable peer-reviewed C++ \
11                        libraries. The emphasis is on portable libraries \
12                        which work well with the C++ Standard Library.
13homepage                http://www.boost.org
14master_sites            sourceforge
15distname                ${name}_[strsed ${version} {g/[.]/_/}]
16use_bzip2               yes
17checksums       md5     a17281fd88c48e0d866e1a12deecbcc0 \
18                sha1    6af42f74ab24ccc51589a025593bad298c8adde8 \
19                rmd160  4962256b48fa8563bf373b8bed97cc8655206a51
20platforms               darwin
21use_parallel_build      yes
22
23# not autoconf
24universal_variant       no
25
26#patchfiles             patch-configure.diff
27
28depends_build           path:bin/bjam:boost-jam
29depends_lib             port:zlib port:bzip2
30
31
32configure {}
33#configure.args          --with-bjam=${prefix}/bin/bjam
34
35# --layout=system
36#     (don't put compiler name or version number in the libraries;
37#      don't put version number in the include directory)
38#     [default: off]
39#
40# link=shared,static (build static and dynamic libraries)
41#     [default: link=shared,static]
42#
43# runtime-link=shared,static
44#     (link to static and shared C and C++ runtime (e.g. use -lstdc++-static))
45#     static runtime-link libraries are of the form *-s.a or -sd.a
46#     [default: runtime-link=shared]
47#
48# threading=single,multi
49#     (build single- and multi-threaded libraries)
50#     multi-threaded libraries are of the form of *-mt.dylib, -mt-d.dylib, *-mt.a, *-mt-s.a, *-mt-d.a, or *-mt-ds.a
51#     [default: threading=multi]
52#
53# debug release
54#     (buil debug and release versions of libraries)
55#     debug libraries are of the form *-d.dylib, *-d.a, or *-ds.a
56#     [default: release]
57#
58set bjam_args {--layout=system --without-mpi}
59build.cmd bjam
60build.args ${bjam_args}
61build.target stage
62build.env-append        BZIP2_INCLUDE=${prefix}/include BZIP2_LIBPATH=${prefix}/lib \
63                        ZLIB_INCLUDE=${prefix}/include ZLIB_LIBPATH=${prefix}/lib
64
65destroot.cmd bjam
66destroot.args ${bjam_args}
67destroot.destdir --prefix=${destroot}${prefix}
68destroot.target install
69destroot.env-append     BZIP2_INCLUDE=${prefix}/include BZIP2_LIBPATH=${prefix}/lib \
70                        ZLIB_INCLUDE=${prefix}/include ZLIB_LIBPATH=${prefix}/lib
71
72pre-build {
73    # Write out the user-config.jam file which contains the build options...
74    set uc [open ${worksrcpath}/tools/build/v2/user-config.jam w]
75    puts $uc "using darwin : : ${configure.cxx} ;"
76    if { [variant_isset mpi] } {
77        puts ${uc} "\nusing mpi : ${prefix}/bin/openmpicxx ;"
78    }
79    if { [variant_isset python24] } {
80        set pyversion 2.4
81    } elseif { [variant_isset python25] } {
82        set pyversion 2.5
83    } elseif { [variant_isset python26] } {
84        set pyversion 2.6
85    }
86    if { ${pyversion} } {
87        puts ${uc} "\nusing python : ${pyversion} : ${prefix}/bin/python${pyversion} ;"
88    }
89    close $uc
90}
91
92platform darwin {
93        post-destroot {
94                # ensure the identification name of the dynamic libraries agree
95                # with their final destination path (not the destroot path that
96                # they've just been installed to)
97                foreach lib [glob -directory ${destroot}${prefix}/lib/ *.dylib] {
98                        set libtail [file tail ${lib}]
99                        system "install_name_tool -id ${prefix}/lib/${libtail} ${lib}"
100                }
101
102                # set the install_name for every library referenced by another library
103                # to include the final destination path as well
104                foreach lib [glob -tails -directory ${destroot}${prefix}/lib/ *.dylib] {
105                        set installed_name ${prefix}/lib/${lib}
106                        foreach lib2 [glob -directory ${destroot}${prefix}/lib/ *.dylib *.so] {
107                                system "install_name_tool -change ${lib} ${installed_name} ${lib2}"
108                        }
109                }
110
111                # mpi.so needs to be in a specific directory for Python to find it
112                if { [file exists ${destroot}${prefix}/lib/mpi.so] } {
113                        if { [variant_isset python24] } {
114                                set spkg ${prefix}/lib/python2.4/site-packages
115                        } elseif { [variant_isset python25] } {
116                                set spkg ${prefix}/lib/python2.5/site-packages
117                        } elseif { [variant_isset python26] } {
118                                set spkg ${frameworks_dir}/Python.framework/Versions/2.6/lib/python2.6/site-packages
119                        }
120
121                        set sodir ${spkg}/boost
122                        xinstall -m 755 -d ${destroot}${sodir}
123                        touch ${destroot}${sodir}/__init__.py
124                        system "install_name_tool -id ${sodir}/mpi.so ${destroot}${prefix}/lib/mpi.so"
125                        move ${destroot}${prefix}/lib/mpi.so ${destroot}${sodir}/mpi.so
126                }
127        }
128}
129
130variant python24 description {build python 2.4 support} conflicts python25 python26 {
131        set pyversion           2.4
132        depends_lib-append      port:python[strsed ${pyversion} {g/[.]//}]
133
134#     set bjam_args [concat ${bjam_args} --with-python]
135#     build.args ${bjam_args}
136}
137
138variant python25 description {build python 2.5 support} conflicts python24 python26 {
139        set pyversion           2.5
140        depends_lib-append      port:python[strsed ${pyversion} {g/[.]//}]
141
142#     set bjam_args [concat ${bjam_args} --with-python]
143#     build.args ${bjam_args}
144}
145
146variant python26 description {build python 2.6 support} conflicts python24 python25 {
147        set pyversion           2.6
148        depends_lib-append      port:python[strsed ${pyversion} {g/[.]//}]
149
150#     set bjam_args [concat ${bjam_args} --with-python]
151#     build.args ${bjam_args}
152}
153
154variant icu description {enable Unicode/ICU support in Regex} {
155        depends_lib-append      port:icu
156
157    build.env-append        ICU_PATH=${prefix}
158    destroot.env-append     ICU_PATH=${prefix}
159}
160
161variant graphml description {enable GraphML support} {
162        depends_lib-append      port:expat
163
164        build.env-append            EXPAT_INCLUDE=${prefix}/include EXPAT_LIBPATH=${prefix}/lib
165        destroot.env-append         EXPAT_INCLUDE=${prefix}/include EXPAT_LIBPATH=${prefix}/lib
166}
167
168variant openmpi description {build mpi support} {
169        depends_lib-append      port:openmpi
170
171    set bjam_args [ldelete ${bjam_args} --without-mpi]
172    build.args ${bjam_args}
173    destroot.args ${bjam_args}
174}
175
176variant docs description {install documentation} {
177    post-destroot {
178        # Install HTML documentation
179        xinstall -d ${destroot}${prefix}/share/doc/${name}
180        xinstall -W ${worksrcpath} index.htm index.html boost.css rst.css boost.png \
181            ${destroot}${prefix}/share/doc/${name}
182        file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${name}
183        file copy ${worksrcpath}/more ${destroot}${prefix}/share/doc/${name}
184        file copy ${worksrcpath}/tools ${destroot}${prefix}/share/doc/${name}
185        file copy ${worksrcpath}/libs ${destroot}${prefix}/share/doc/${name}
186        file copy ${worksrcpath}/wiki ${destroot}${prefix}/share/doc/${name}
187    }
188}
189
190# Doesn't work just yet, not sure why...
191# variant debug description {build debug libraries} {
192#     build.target-append " debug release"
193# }
194
195variant st description {build single-threaded libraries} {
196    build.target-append " threading=single,multi"
197}