Bug 203988 - lang/ruby21 - readline & libedit configure options spelled wrong
Summary: lang/ruby21 - readline & libedit configure options spelled wrong
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Michael Moll
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-23 19:31 UTC by John Hein
Modified: 2015-11-30 04:45 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (ruby)


Attachments
[patch] fix --with-libedit/readline* configuration arg spellings and enable them for libedit in the readline module's extconf.rb (5.11 KB, patch)
2015-10-23 19:31 UTC, John Hein
no flags Details | Diff
proposed patch (2.62 KB, patch)
2015-11-03 22:21 UTC, Michael Moll
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2015-10-23 19:31:07 UTC
Created attachment 162400 [details]
[patch] fix --with-libedit/readline* configuration arg spellings and enable them for libedit in the readline module's extconf.rb

The --with-readline-prefix and --with-libedit-prefix configure arguments are spelled wrong.  They should be --with-readline-dir and --with-libedit-dir.  See dir_config() inlib/mkmf.rb

It's just luck in the normal default case that the ports do the right thing now.  You could spell them --with-libedit-flibberjam=${LOCALBASE} and it would still work (in the default case).  Because -I/usr/local/include is added for other reasons and normally /usr/local (LOCALBASE) is where the readline and libedit ports are installed.

For instance, if you select the LIBEDIT option and have devel/libedit installed to a different prefix than LOCALBASE, then setting --with-libedit-prefix=<that_prefix> (you have to change the current port Makefile to test that since it's hard-coded to ${LOCALBASE} instead of the results from 'pkgconf --variable prefix libedit') will fail to find the right libedit and you'll get issues like this because the ruby build finds and uses the libedit from base:

compiling readline.c
readline.c: In function 'history_get_offset_history_base':
readline.c:1573: error: 'history_base' undeclared (first use in this function)
readline.c:1573: error: (Each undeclared identifier is reported only once
readline.c:1573: error: for each function it appears in.)
readline.c: In function 'hist_get':
readline.c:1585: error: 'HIST_ENTRY' undeclared (first use in this function)
readline.c:1585: error: 'entry' undeclared (first use in this function)
readline.c:1590: error: 'history_length' undeclared (first use in this function)
readline.c: In function 'hist_set':
readline.c:1605: error: 'HIST_ENTRY' undeclared (first use in this function)
 .
 .

Furthermore, I believe there's a bug in ext/readline/extconf.rb in the libedit case where the --with-libedit* feature is not turned on - it needs 'dir_config("libedit")'.  That part of the attached patch can be submitted upstream.  I'll try to do that if no one else beats me to it.

This bug is something of a nitpick since everything works in the default everything-in-/usr/local case now.  But the configure option is definitely spelled wrong.  And those --with-libedit* knobs need to be enabled in readline/extconf.rb for libedit.
Comment 1 commit-hook freebsd_committer 2015-10-25 00:21:46 UTC
A commit references this bug:

Author: mmoll
Date: Sun Oct 25 00:21:24 UTC 2015
New revision: 400142
URL: https://svnweb.freebsd.org/changeset/ports/400142

Log:
  lang/ruby2*: fix readline & libedit configure options

  The fixed error(s) were only visible with LOCALBASE not set to /usr/local.

  PR:		203988
  Submitted by:	John Hein <z7dr6ut7gs@snkmail.com>

Changes:
  head/lang/ruby20/Makefile
  head/lang/ruby20/files/patch-ext_readline_extconf.rb
  head/lang/ruby21/Makefile
  head/lang/ruby21/files/patch-ext_readline_extconf.rb
  head/lang/ruby22/Makefile
  head/lang/ruby22/files/patch-ext_readline_extconf.rb
Comment 2 Michael Moll freebsd_committer 2015-10-25 00:24:59 UTC
Commited, thank you very much!

If you could try to bring your fix into upstream, that would be great as all operating systems would benefit from it (although most will have the same situation covering the problem).
Comment 3 John Hein 2015-11-03 19:52:40 UTC
I will try to get the extconf.rb part upstreamed.

In the meantime, can you do a partial revert to use LOCALBASE rather than LIBEDITPREFIX and READLINEPREFIX?  Those second names I used when testing this problem - I didn't mean for them to sneak into the published version of the Makefile patch (it was just supposed to be the change to the right spelling --with-*-dir rather than --with-*-prefix).  The current freebsd ports tree isn't yet equipped to handle finding dependencies that aren't in LOCALBASE for the most part (unless the port's configure scripts uses pkg-config to find the alternate location).

Re-opening because of this.
Comment 4 Michael Moll freebsd_committer 2015-11-03 22:20:54 UTC
take
Comment 5 Michael Moll freebsd_committer 2015-11-03 22:21:56 UTC
Created attachment 162749 [details]
proposed patch
Comment 6 Michael Moll freebsd_committer 2015-11-03 22:22:25 UTC
like the patch I just attached?
Comment 7 John Hein 2015-11-05 02:24:05 UTC
Yep, attachment 162749 [details] is exactly it.  Thanks.
Comment 8 commit-hook freebsd_committer 2015-11-05 10:15:32 UTC
A commit references this bug:

Author: mmoll
Date: Thu Nov  5 10:14:49 UTC 2015
New revision: 400831
URL: https://svnweb.freebsd.org/changeset/ports/400831

Log:
  lang/ruby2*: correct configure options

  Fix readline & libedit configure options after a slight error slipped in
  with the patches done in r400142.

  PR:		203988
  Submitted by:	John Hein <z7dr6ut7gs@snkmail.com>

Changes:
  head/lang/ruby20/Makefile
  head/lang/ruby21/Makefile
  head/lang/ruby22/Makefile
Comment 9 Michael Moll freebsd_committer 2015-11-05 10:17:57 UTC
commited, thanks for following up!
Comment 10 John Hein 2015-11-30 04:45:14 UTC
upstream bug for the extconf.rb part is https://bugs.ruby-lang.org/issues/11751