source: trunk/dports/lang/ruby/Portfile @ 102174

Last change on this file since 102174 was 102174, checked in by jeremyhu@…, 7 years ago

misc: Update compiler dependency workaround for #32542, see #37817

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.4 KB
Line 
1# $Id: Portfile 102174 2013-01-29 07:53:39Z jeremyhu@macports.org $
2
3PortSystem              1.0
4PortGroup               muniversal 1.0
5PortGroup               compiler_blacklist_versions 1.0
6
7name                    ruby
8version                 1.8.7-p371
9revision                0
10
11categories              lang ruby
12maintainers             kimuraw
13
14description             Powerful and clean object-oriented scripting language
15long_description        Ruby is the interpreted scripting language for quick \
16                                        and easy object-oriented programming. It has many \
17                                        features to process text files and to do system \
18                                        management tasks (as in Perl). It is simple, \
19                                        straight-forward, extensible, and portable.
20homepage                http://www.ruby-lang.org/
21license                 {Ruby GPL-2}
22master_sites    ruby:1.8
23                               
24dist_subdir             ruby
25checksums       md5 c27526b298659a186bdb5107fcec2341 \
26                                rmd160 ad1da5b8b8e818d6a77b70ab81586a37099cbac0 \
27                                sha1 2a709358417330cfacba6b9f8206eab577640b2b \
28                                sha256 2dd0e463cd82039beb75c9b9f4ee20bef5f5b5ff68527008e5aee61cfb3b55e1
29
30use_bzip2               yes
31
32platforms               darwin
33
34depends_lib             port:libiconv \
35                                port:readline \
36                                port:openssl \
37                                port:zlib \
38                                port:ncurses \
39                                port:gdbm
40
41# vendordir: enable vendor-specific.rb
42# #3604: gcc4 fails to detect linking at configure
43# #19050: use $(CC) not cc, this change has been merged at ruby-1.8 trunk
44# #15528: on some Mac, TCPServer.open("localhost", 0) raises SocketError
45#         like "getaddrinfo: nodename nor servname provided, or not
46#         known (SocketError)"
47# c99: gperf generates code that doesn't work with clang (https://trac.macports.org/ticket/29974)
48# lib-drb-ssl.rb: 512bits rsa key is too small for openssl-1.0.1.
49#                 (http://bugs.ruby-lang.org/issues/6221)
50# --- clang support ----
51# numeric.c: fix wrong optimizaton of Numeric/Bignum build with clang.
52# configure: correct frame_address and stack_direction for +universal with clang.
53patchfiles              patch-vendordir.diff \
54                                patch-bug3604.diff \
55                                patch-bug19050.diff \
56                                patch-bug15528.diff \
57                                patch-c99.diff \
58                                patch-lib-drb-ssl.rb.diff \
59                                patch-numeric.c.diff \
60                                patch-configure.diff
61
62# ignore getcontext() and setcontext()
63# on 10.5 or later, these functions have some problems (SEGV on ppc, slower than 1.8.6)
64# http://chopine.be/lrz/ruby-osx-patches/ignore-gsetcontext.diff
65patchfiles-append patch-node.h.diff
66
67use_parallel_build              no
68
69# [OK] apple-gcc-4.2
70#      clang (Xcode 4.2 or later) with -O[0s]
71# [NG] llvm-gcc-4.2
72#      clang (Xcode 4.1 or earlier)
73#      clang (Xcode 4.2 or later) with -O[12]
74# TODO: When was this last verified?  Is there a ticket open? Radar?
75compiler.blacklist-append llvm-gcc-4.2 macports-llvm-gcc-4.2 {clang  < 211}
76
77# TODO: base should do this: http://trac.macports.org/ticket/32542
78if {[info exists portconfigure::compiler_name_map(${configure.compiler})]} {
79    depends_build-append port:$portconfigure::compiler_name_map(${configure.compiler})
80
81    # base 2.1.x ignores the argument and just use ${configure.compiler}
82    if {[portconfigure::arch_flag_supported ${configure.compiler}]} {
83        depends_skip_archcheck-append $portconfigure::compiler_name_map(${configure.compiler})
84    }
85
86    if {[string match macports-gcc* ${configure.compiler}]} {
87        depends_lib-append port:$portconfigure::compiler_name_map(${configure.compiler})
88    }
89}
90
91if {[string match *clang* ${configure.compiler}]} {
92        configure.optflags -Os
93}
94
95configure.args  --enable-shared \
96                                --mandir="${prefix}/share/man" \
97                                --enable-pthread \
98                                --without-tk \
99                                --with-vendordir=${prefix}/lib/ruby/vendor_ruby \
100                                --with-opt-dir=${prefix}
101# ignore minor version for archdir, like i686-darwin9
102configure.env   UNAME_RELEASE=${os.major}
103
104if {[variant_isset universal]} {
105        # NOTE: directory layout of port:ruby +universal
106        #   universal binary
107        #     - bin/
108        #     - lib/libruby*.dylib, libruby-static.a
109        #   single architecture modules and headers, such as ruby.h or config.h
110        #     - lib/ruby/[1.8|site_ruby/1.8|vendor_ruby/1.8]/x86_64-apple-darwin*/
111        #     -                                             /i386-apple-darwin*/
112        #     -                                             /ppc-apple-darwin*/
113        #   pure ruby libraries
114        #     - lib/ruby/[1.8|site_ruby/1.8|vendor_ruby/1.8]/
115        foreach arch ${universal_archs} {
116                append merger_configure_env(${arch}) "ARCH_FLAG=\"-arch ${arch}\" "
117                # force environment "ac_cv_build" to specify locations of extension
118                # modules(*.bundle), headers(ruby.h, config.h, ..) and rbconfig.rb.
119                # like this:
120                #   i386   -> ${prefix}/lib/ruby/1.8/i386-apple-darwin10/
121                #   x86_64 ->                       /x86_64-apple-darwin10/
122                set cpu_type ${arch}
123                append merger_configure_env(${arch}) \
124                        "ac_cv_build=\"${cpu_type}-apple-darwin${os.major}\" "
125        }
126} elseif {[info exists build_arch] && ${build_arch} != ""} {
127        configure.env-append ARCH_FLAG="-arch ${build_arch}"
128}
129
130destroot.target install install-doc
131post-destroot {
132        foreach type {site vendor} {
133                set libdir ${destroot}${prefix}/lib/ruby/${type}_ruby/1.8
134                xinstall -m 0755 -d ${libdir}
135               
136                # special file for installation control of modules
137                xinstall -m 0644 ${filespath}/${type}-specific.rb ${libdir}
138               
139                # prevent empty site/vendor directories from being pruned
140                foreach subdir [exec find ${libdir} -type d -empty] {
141                        destroot.keepdirs-append ${subdir}
142                }
143        }
144    # error at activate, for these case sensitive files
145        foreach rdoc {Exception2MessageMapper/fail-i.yaml \
146                                  REXML/Parsers/XPathParser/predicate-i.yaml} {
147                if {[file exists ${destroot}${prefix}/share/ri/1.8/system/${rdoc}]} {
148                        delete ${destroot}${prefix}/share/ri/1.8/system/${rdoc}
149                }
150        }
151}
152
153platform darwin {
154        # for proper rdoc/ri creation, make sure to link to destroot libruby.dylib
155        destroot.env    DYLD_LIBRARY_PATH=${destroot}${prefix}/lib
156}
157
158variant tk conflicts mactk description "enable tk support" {
159        configure.args-delete   --without-tk
160        configure.args-append   --with-tk
161        depends_lib-append              port:tcl port:tk
162}
163
164variant mactk conflicts tk description "enable MacTk (Tk.framework without X11) support" {
165        configure.args-delete   --without-tk
166        configure.args-append   --enable-tcltk-framework
167}
168
169variant no_doc description "do not install rdoc documents" {
170        destroot.target-delete  install-doc
171}
172
173variant dtrace description "enable dtrace support" {
174        # from http://www.opensource.apple.com/source/ruby/ruby-79/
175        patchfiles-append               patch-apple-dtrace.diff
176        configure.cflags-append -DENABLE_DTRACE
177        post-patch {
178                system "cd ${worksrcpath} && dtrace -h -s ${filespath}/dtrace.d -o dtrace.h"
179        }
180}
181
182livecheck.type  regex
183livecheck.url   http://ftp.ruby-lang.org/pub/ruby/1.8/
184livecheck.regex {ruby-(\d+(?:\.\d+)*(?:-p\d+))}
185
186test.run        yes
Note: See TracBrowser for help on using the repository browser.