Ticket #15912: add_parameter_implementation_to_ruby_group_setup.patch

File add_parameter_implementation_to_ruby_group_setup.patch, 3.7 KB (added by febeling@…, 16 years ago)

patch to change ruby port group as described; fix a regression with gem type rbports

  • ruby-1.0.tcl

     
    3131# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    3232# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    3333# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    34 #
    35 # Set some variables.
    36 set ruby.bin    ${prefix}/bin/ruby
    37 set ruby.rdoc   ${prefix}/bin/rdoc
    3834
     35# Define these variables assuming ruby1.8, they are possibly adjusted
     36# by ruby.setup arguments, and also accessible in the portfile after
     37# the call to ruby.setup
     38set ruby.bin            ${prefix}/bin/ruby
     39set ruby.rdoc           ${prefix}/bin/rdoc
     40set ruby.gem            ${prefix}/bin/gem
     41
    3942proc ruby.extract_config {var {default ""}} {
    4043        global ruby.bin
    4144        if {[catch {set val [exec ${ruby.bin} -e "require 'rbconfig';puts Config::CONFIG\[\"${var}\"\]"]}]} {
     
    5154set ruby.lib            [ruby.extract_config vendorlibdir ${prefix}/lib/ruby/vendor_ruby/${ruby.version}]
    5255set ruby.archlib        [ruby.extract_config vendorarchdir ${ruby.lib}/${ruby.arch}]
    5356
    54 # define these empty initially, they are set by ruby.setup arguments
    5557set ruby.module         ""
    5658set ruby.filename       ""
    5759set ruby.project        ""
    5860set ruby.docs           {}
    5961set ruby.srcdir         ""
    6062
    61 # ruby group setup procedure
    62 proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
    63         global destroot prefix worksrcpath
    64         global ruby.bin ruby.lib
    65         global ruby.module ruby.project ruby.filename ruby.docs ruby.srcdir
     63# ruby group setup procedure (optionally to call for ruby 1.8)
     64proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"} {implementation "ruby"}} {
     65        global destroot prefix worksrcpath os.platform
     66        global ruby.bin ruby.rdoc ruby.gem
     67        global ruby.version
     68        global ruby.lib ruby.archlib
     69        global ruby.module ruby.filename ruby.project ruby.docs ruby.srcdir
    6670
     71        if {${implementation} eq "ruby19"} {
     72                set ruby.bin    ${prefix}/bin/ruby1.9
     73                set ruby.rdoc   ${prefix}/bin/rdoc1.9
     74                set ruby.gem    ${prefix}/bin/gem1.9
     75                set ruby.port_prefix rb19
     76        } elseif {${implementation} eq "ruby"} {
     77                # ruby.bin, ruby.rdoc, and ruby.gem set to 1.8 by default
     78                set ruby.port_prefix rb
     79        } else {
     80                ui_error "ruby.setup: unknown implementation '${implementation}' specified (ruby, ruby19 possible)"
     81                return -code error "ruby.setup failed"
     82        }
     83
     84        # re-define variables to pick up possible implemantation change
     85        set ruby.version        [ruby.extract_config ruby_version]
     86        set ruby.arch           [ruby.extract_config arch ${os.platform}]
     87        set ruby.lib            [ruby.extract_config vendorlibdir ${prefix}/lib/ruby/vendor_ruby/${ruby.version}]
     88        set ruby.archlib        [ruby.extract_config vendorarchdir ${ruby.lib}/${ruby.arch}]
     89
    6790        # define ruby global names and lists
    6891        # check if module is a list or string
    6992        if {[llength ${module}] > 1} {
     
    80103        }
    81104        set ruby.docs   ${docs}
    82105
    83         name                    rb-[string tolower ${ruby.module}]
     106        name                    ${ruby.port_prefix}-[string tolower ${ruby.module}]
    84107        version                 ${vers}
    85108        categories              ruby
    86109
     
    131154        distname                ${ruby.filename}-${vers}
    132155        dist_subdir             ruby
    133156
    134         depends_lib             path:${ruby.bin}:ruby
     157        depends_lib             port:${implementation}
    135158
    136159        post-extract {
    137160                # Create the work directory for gem-based ruby ports.
     
    275298                        }
    276299                       
    277300                        destroot {
    278                           system "cd ${worksrcpath} && ${prefix}/bin/gem install --local --force --install-dir ${destroot}${prefix}/lib/ruby/gems/${ruby.version} ${distpath}/${distname}"
     301                          system "cd ${worksrcpath} && ${ruby.gem} install --local --force --install-dir ${destroot}${prefix}/lib/ruby/gems/${ruby.version} ${distpath}/${distname}"
    279302                       
    280303                                set binDir ${destroot}${prefix}/lib/ruby/gems/${ruby.version}/bin
    281304                                if {[file isdirectory $binDir]} {