[MacPorts] #58975: vim: ruby variants
MacPorts
noreply at macports.org
Sun Sep 8 11:04:23 UTC 2019
#58975: vim: ruby variants
-------------------------+----------------------
Reporter: iEFdev | Owner: raimue
Type: enhancement | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.5.4
Keywords: | Port: vim
-------------------------+----------------------
I just wanted to bounce a couple of ideas before going further (PR), or if
you want to add it in yourself.
All the ruby variants… They keep growing, so I thought maybe it could be
automated some way - and easier to update later.
So, could this be a good idea?
// (see the attached diff/patch)
{{{#!tcl
# Set latest version of ruby
set rb_latest 26
variant ruby requires ruby18 description {Compatibility variant, requires
+ruby18} {}
set rb_versions {}
for {set v 18} {$v <= ${rb_latest}} {incr v} {
lappend rb_versions ruby${v}
}
foreach rb_version ${rb_versions} {
set rbi [lsearch ${rb_versions} ${rb_version}]
set rb_conflict_versions [lreplace ${rb_versions} ${rbi} ${rbi}]
set rb_bin_version [regsub {(\d{1})(\d){1}} ${rb_version} {\1.\2}]
variant ${rb_version} conflicts $rb_conflict_versions description
{Enable Ruby scripting} {
configure.args-append --enable-rubyinterp
configure.args-append --with-ruby-
command=${prefix}/bin/${rb_bin_version}
}
if {[variant_isset ${rb_version}]} {
depends_lib-append port:[expr {${rb_version} eq {ruby18} ?
{ruby} : ${rb_version}}]
}
}
}}}
That's all of them. It's about half the code of all variants written out.
Had to put the `depends_lib-append` outside, or it chose the wrong
port:rubyXX when specifying a variant.
---
The other idea was about the default/compatibility variant.
{{{#!tcl
variant ruby requires ruby18 description {Compatibility variant, requires
+ruby18} {}
}}}
Instead of using the very old ruby18… I'm thinking something like:
{{{#!tcl
variant ruby description {Defaults to `ruby', and can be used with
`ruby_select'} {
configure.args-append --enable-rubyinterp
configure.args-append --with-ruby-command=${prefix}/bin/ruby
depends_lib-append port:ruby
}
}}}
And it will use whatever version responds to `ruby`. If users don't have
ruby installed, it will still pull the 1.8 version, to start with.
//Just an idea…
--
Ticket URL: <https://trac.macports.org/ticket/58975>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list