Bug 170916 - Mk/bsd.ruby.mk: setting RUBY variable fails to set RUBY_* variables
Summary: Mk/bsd.ruby.mk: setting RUBY variable fails to set RUBY_* variables
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Steve Wills
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-23 14:20 UTC by hiroto.kagotani
Modified: 2014-04-13 03:50 UTC (History)
0 users

See Also:


Attachments
ruby_170916_patch.txt (1.05 KB, text/plain; charset=us-ascii)
2014-03-30 03:02 UTC, Steve Wills
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description hiroto.kagotani 2012-08-23 14:20:01 UTC
Mk/bsd.ruby.mk says RUBY variable can be set by a port.
But when I set it for my own port, make shows some errors
and some RUBY_* variables such as RUBY_VERSION are not properly set.

How-To-Repeat: Install lang/ruby19.
In any rubygem port directory, for example, in textproc/rubygem-htmlentities:

# make RUBY=/usr/local/bin/ruby19
-e:1: Use RbConfig instead of obsolete and deprecated Config.
-e:2:in `<main>': uninitialized constant VERSION (NameError)
"/usr/ports/Mk/bsd.ruby.mk", line 151: warning: "/usr/local/bin/ruby19 -r rbconfig -e 'C = Config::CONFIG' -e 'puts VERSION'" returned non-zero status
-e:1: Use RbConfig instead of obsolete and deprecated Config.
-e:1: Use RbConfig instead of obsolete and deprecated Config.
-e:1: Use RbConfig instead of obsolete and deprecated Config.
-e:1: Use RbConfig instead of obsolete and deprecated Config.
-e:1: Use RbConfig instead of obsolete and deprecated Config.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-08-23 14:20:22 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ruby

bsd.ruby.mk is ruby territory (via the GNATS Auto Assign Tool)
Comment 2 Steve Wills freebsd_committer freebsd_triage 2013-07-19 14:04:37 UTC
Responsible Changed
From-To: ruby->swills

I'll take it.
Comment 3 Steve Wills freebsd_committer freebsd_triage 2014-03-30 03:02:03 UTC
Hi,

Sorry for the super late reply on this, but it does seem to still be an issue.
If you are still interested, I've attached a proposed patch. Let me know if
this solves it for you.

Thanks,
Steve
Comment 4 hiroto.kagotani 2014-03-31 12:30:07 UTC
Hi,

> Sorry for the super late reply on this, but it does seem to still be an issue.
> If you are still interested, I've attached a proposed patch. Let me know if
> this solves it for you.

Thanks a lot.
Your patch works well for me.

Regards.
-- 
Hiroto Kagotani
<hiroto.kagotani@gmail.com>
Comment 5 dfilter service freebsd_committer freebsd_triage 2014-04-13 03:44:49 UTC
Author: swills
Date: Sun Apr 13 02:44:45 2014
New Revision: 351179
URL: http://svnweb.freebsd.org/changeset/ports/351179
QAT: https://qat.redports.org/buildarchive/r351179/

Log:
  - Fix issues with specifying ${RUBY} variable
  
  PR:		ports/170916
  Reported by:	Hiroto Kagotani <hiroto.kagotani@gmail.com>

Modified:
  head/Mk/bsd.ruby.mk

Modified: head/Mk/bsd.ruby.mk
==============================================================================
--- head/Mk/bsd.ruby.mk	Sun Apr 13 02:41:30 2014	(r351178)
+++ head/Mk/bsd.ruby.mk	Sun Apr 13 02:44:45 2014	(r351179)
@@ -152,14 +152,14 @@ RUBY_VER?=		${RUBY_DEFAULT_VER}
 IGNORE=	cannot install: you set the variable RUBY to "${RUBY}", but it does not seem to exist.  Please specify an already installed ruby executable.
 .endif
 
-_RUBY_TEST!=		${RUBY} -e 'begin; require "rbconfig"; rescue LoadError; puts "error"; end'
-.if !empty(_RUBY_TEST)
+_RUBY_TEST!=		${RUBY} -e 'begin; require "rbconfig"; puts "ok" ; rescue LoadError; puts "error"; end'
+.if !empty(_RUBY_TEST) && ${_RUBY_TEST} != "ok"
 IGNORE=	cannot install: you set the variable RUBY to "${RUBY}", but it failed to include rbconfig.  Please specify a properly installed ruby executable.
 .endif
 
-_RUBY_CONFIG=		${RUBY} -r rbconfig -e 'C = Config::CONFIG' -e
+_RUBY_CONFIG=		${RUBY} -r rbconfig -e 'C = RbConfig::CONFIG' -e
 
-RUBY_VERSION!=		${_RUBY_CONFIG} 'puts VERSION'
+RUBY_VERSION!=		${_RUBY_CONFIG} 'puts C["ruby_version"]'
 RUBY_SUFFIX?=		# empty
 
 RUBY_ARCH!=		${_RUBY_CONFIG} 'puts C["target"]'
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 6 Steve Wills freebsd_committer freebsd_triage 2014-04-13 03:45:03 UTC
State Changed
From-To: open->closed

Patch committed! Thanks!