Bug 200408 - [PATCH] lang/gawk: use USES=readline:port
Summary: [PATCH] lang/gawk: use USES=readline:port
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Johan van Selst
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-05-23 06:57 UTC by Po-Chuan Hsieh
Modified: 2015-06-15 13:46 UTC (History)
0 users

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


Attachments
gawk diff (729 bytes, patch)
2015-05-23 06:57 UTC, Po-Chuan Hsieh
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-05-23 06:57:25 UTC
Created attachment 157071 [details]
gawk diff

- Use USES=readline:port

Without this, gawk may pick libreadline.so from base.
Comment 1 Johan van Selst freebsd_committer freebsd_triage 2015-05-23 07:54:31 UTC
I would be interested in a build log for this.
The --with-readline=${LOCALBASE} really should prevent this.
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-05-23 12:53:33 UTC
Since I do not have devel/readline installed, configure failed with --with-readline=${LOCALBASE}.
Then it checked -lreadline and found it from base.

% make
===>   gawk-4.1.3 depends on package: libiconv>=1.14_8 - found
===>   gawk-4.1.3 depends on shared library: libsigsegv.so - found (/usr/local/lib/libsigsegv.so)
===>   gawk-4.1.3 depends on shared library: libreadline.so - found (/usr/lib/libreadline.so)
===>  Configuring for gawk-4.1.3
...

% make package
===>  Building package for gawk-4.1.3
actual-package-depends: dependency on /usr/lib/libreadline.so not registered (normal if it belongs to base)

* cited from config.log:

configure:10750: checking whether readline via "-lreadline" is present and sane
configure:10811: clang -o conftest -O2 -pipe -march=core2  -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -DNDEBUG -DLIBICONV_PLUG -I/usr/local/include -I/usr/local/include  -fstack-protector -Wl,-export-dynamic -L/usr/local/lib conftest.c -lm  -lreadline >&5
conftest.c:120:2: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
        close(0);
        ^
conftest.c:122:7: warning: implicit declaration of function 'open' is invalid in C99 [-Wimplicit-function-declaration]
        fd = open("/dev/null", 2);      /* should get fd 0 */
             ^
conftest.c:123:2: warning: implicit declaration of function 'dup' is invalid in C99 [-Wimplicit-function-declaration]
        dup(fd);
        ^
3 warnings generated.
configure:10811: $? = 0
configure:10811: ./conftest
configure:10811: $? = 0
configure:10821: result: yes
configure:10837: checking for history_list in -lreadline
configure:10862: clang -o conftest -O2 -pipe -march=core2  -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -DNDEBUG -DLIBICONV_PLUG -I/usr/local/include -I/usr/local/include  -fstack-protector -Wl,-export-dynamic -L/usr/local/lib conftest.c -lreadline -lreadline -ltermcap -lm  >&5
configure:10862: $? = 0
configure:10871: result: yes
Comment 3 Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-05-23 12:58:28 UTC
I missed some words.

Since I do not have devel/readline installed, configure SHOULD failed with --with-readline=${LOCALBASE} but it didn't.
It seems that configure only checked -lreadline and found it from base.
Comment 4 Johan van Selst freebsd_committer freebsd_triage 2015-05-23 14:14:44 UTC
Ah, I get it now. The issue is with the LIB_DEPENDS line that adds readline.
This uses readline.so rather than readline.so.6 (as is used by Mk/Uses/readline.mk). So I should either add the .6 here, or use your patch.

I'll go with your patch, as it is shorter and avoid having the version number listed in many files.

Thank you
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-05-23 14:53:10 UTC
A commit references this bug:

Author: johans
Date: Sat May 23 14:52:36 UTC 2015
New revision: 387131
URL: https://svnweb.freebsd.org/changeset/ports/387131

Log:
  - Force linking with readline from ports
    Note that gawk works fine with readline from base,
    but it would break dependency tracking if we get this wrong

  PR:		200408
  Submitted by:	sunpoet

Changes:
  head/lang/gawk/Makefile
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-05-23 15:13:41 UTC
I guess the dependency tracking issue in the commit log means that gawk depends on readline from port but did not register the dependency to pkg db.

Since gawk works fine with readline from base, USES=readline should be enough.

I made a simple test as follows:
- Change lang/gawk/Makefile from USES=readline:port to USES=readline
- Install devel/readline
- Install lang/gawk

% pkg info -x readline
p5-ReadLine-Gnu-1.26
p5-ReadLine-Perl-1.0303_3
php56-readline-5.6.8
readline-6.3.8

% ldd /usr/local/bin/gawk
/usr/local/bin/gawk:
        libsigsegv.so.2 => /usr/local/lib/libsigsegv.so.2 (0x8008af000)
        libreadline.so.8 => /lib/libreadline.so.8 (0x800ab2000)
        libncurses.so.8 => /lib/libncurses.so.8 (0x800cf5000)
        libm.so.5 => /lib/libm.so.5 (0x800f42000)
        libc.so.7 => /lib/libc.so.7 (0x80116a000)

% pkg info -dx gawk
gawk-4.1.3:
        indexinfo-0.2.3
        libsigsegv-2.10_1

It seems the dependency is correct.
Comment 7 Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-06-14 06:03:56 UTC
May I change lang/gawk/Makefile from USES=readline:port to USES=readline since the dependency looks correct?
Comment 8 commit-hook freebsd_committer freebsd_triage 2015-06-15 13:41:02 UTC
A commit references this bug:

Author: sunpoet
Date: Mon Jun 15 13:40:56 UTC 2015
New revision: 389707
URL: https://svnweb.freebsd.org/changeset/ports/389707

Log:
  - Use USES=readline instead of USES=readline:port

  gawk works fine with readline from base and readline.mk handles readline
  dependency (from base or ports) correctly.

  PR:		200408
  Submitted by:	sunpoet (myself)
  Approved by:	johans (maintainer, via email)

Changes:
  head/lang/gawk/Makefile
Comment 9 Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-06-15 13:46:46 UTC
Committed. Thanks!