Ignore:
Timestamp:
Sep 23, 2013, 2:16:53 PM (6 years ago)
Author:
kimuraw@…
Message:

port1.0/group/ruby-1.0.tcl: support ruby-1.8 universal extentions with setup.rb (#39096)

write "Portgroup muniversal 1.0" to Portfile, then rb-* ports with
setup.rb contains C-extention become to support universal.

examples:

[port:rb-xslt]

  • add "Portgroup muniversal 1.0"

Index: ruby/rb-xslt/Portfile
===================================================================
--- ruby/rb-xslt/Portfile (revision 111446)
+++ ruby/rb-xslt/Portfile (working copy)
@@ -2,6 +2,7 @@


PortSystem 1.0
PortGroup ruby 1.0

+PortGroup muniversal 1.0


ruby.setup ruby-xslt 0.9.6 setup.rb {AUTHORS COPYING ChangeLog README} rubyforge:35058
extract.suffix .tgz

[port:rb-sqlite3]

  • add "Portgroup muniversal 1.0"
  • add ruby.config_rubyprog_name

Index: ruby/rb-sqlite3/Portfile
===================================================================
--- ruby/rb-sqlite3/Portfile (revision 111446)
+++ ruby/rb-sqlite3/Portfile (working copy)
@@ -2,7 +2,9 @@


PortSystem 1.0
PortGroup ruby 1.0

+PortGroup muniversal 1.0


+ruby.config_rubyprog_name --ruby-prog

ruby.setup {sqlite3 sqlite3-ruby} 1.2.4 setup.rb \

{README.rdoc LICENSE CHANGELOG.rdoc api doc} \
rubyforge:42055

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/ruby-1.0.tcl

    r111453 r111463  
    127127default ruby.link_binaries yes
    128128
     129# detect setup.rb config option name of --rubyprog.
     130# some setup.rb accepts this option by other name, such as --ruby-prog.
     131# NOTE: set the value *before ruby.setup* to use ohter name.
     132options ruby.config_rubyprog_name
     133default ruby.config_rubyprog_name --rubyprog
     134
    129135default ruby.branch         ${ruby.default_branch}
    130136
     
    140146    global ruby.prog_suffix
    141147    # from muniversal
    142     global universal_archs_supported merger_configure_env
     148    global universal_archs_supported
     149    global merger_configure_env merger_build_env merger_destroot_env
     150    # for setup.rb +universal
     151    global ruby.config_rubyprog_name
    143152
    144153    if {${implementation} eq "ruby19"} {
     
    329338
    330339            pre-destroot {
    331                 if {[file isfile ${worksrcpath}/config.save]} {
    332                     reinplace "s|${prefix}|${destroot}${prefix}|g" \
    333                         ${worksrcpath}/config.save
    334                 }
    335                 if {[file isfile ${worksrcpath}/.config]} {
    336                     reinplace "s|${prefix}|${destroot}${prefix}|g" \
    337                         ${worksrcpath}/.config
     340                foreach conf {config.save .config} {
     341                    if {[file isfile ${worksrcpath}/${conf}]} {
     342                        reinplace "s|${prefix}|${destroot}${prefix}|g" \
     343                            ${worksrcpath}/${conf}
     344                    }
     345                    if {[variant_isset universal]  && [info exists universal_archs_supported]} {
     346                        foreach arch ${universal_archs_supported} {
     347                            if {[file isfile ${worksrcpath}-${arch}/${conf}]} {
     348                                reinplace "s|${prefix}|${destroot}-${arch}${prefix}|g" \
     349                                    ${worksrcpath}-${arch}/${conf}
     350                            }
     351                        }
     352                    }
    338353                }
    339354            }
     
    341356            destroot.target     install
    342357            destroot.destdir
     358            # extconf.rb|mkmf.rb of ruby-1.8 does not support universal binary.
     359            # to build universal extentions, write "Portgrourp muniversal 1.0" in the Portfile.
     360            if {[variant_isset universal] && (${ruby.branch} eq "1.8") && [info exists universal_archs_supported]} {
     361                # generate wrapper for --rubyprog option
     362                pre-configure {
     363                    set fo [open ${worksrcpath}/_mp_arch_ruby w]
     364                    puts $fo "#!/bin/sh"
     365                    puts $fo "/usr/bin/arch ${ruby.bin} \$@"
     366                    close $fo
     367                    system "chmod +x ${worksrcpath}/_mp_arch_ruby"
     368                }
     369                configure.args-append \
     370                    ${ruby.config_rubyprog_name}=${worksrcpath}/_mp_arch_ruby
     371                foreach arch ${universal_archs_supported} {
     372                    lappend merger_configure_env(${arch}) \
     373                        ARCHPREFERENCE=ruby${ruby.branch}:${arch}
     374                    lappend merger_build_env(${arch}) \
     375                        ARCHPREFERENCE=ruby${ruby.branch}:${arch}
     376                    lappend merger_destroot_env(${arch}) \
     377                        ARCHPREFERENCE=ruby${ruby.branch}:${arch}
     378                }
     379                configure.cmd   /usr/bin/arch ${ruby.bin} -rvendor-specific setup.rb
     380                build.cmd       /usr/bin/arch ${ruby.bin} -rvendor-specific setup.rb
     381                destroot.cmd    /usr/bin/arch ${ruby.bin} -rvendor-specific setup.rb
     382            }
    343383            post-destroot {
    344384                foreach file [readdir ${destroot}${prefix}/bin] {
Note: See TracChangeset for help on using the changeset viewer.