Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 330235 - net-misc/whois-5.0.6: compilation issue on macos (lcrypt issue)
Summary: net-misc/whois-5.0.6: compilation issue on macos (lcrypt issue)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All OS X
: High normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-28 15:49 UTC by Florian CROUZAT (SuperFlo)
Modified: 2011-12-15 20:28 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Avoid *-macos to link against -lcrypt (whois-5.0.6-macos-lcrypt.patch,511 bytes, patch)
2010-07-28 15:50 UTC, Florian CROUZAT (SuperFlo)
Details | Diff
Use chost instead of a long list of use *-macos (whois-5.0.6-macos-lcrypt.patch,489 bytes, patch)
2010-07-28 17:33 UTC, Florian CROUZAT (SuperFlo)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian CROUZAT (SuperFlo) 2010-07-28 15:49:52 UTC
Apparently, *-macos cannot link against -lcrypt because "it is in the system's C library". I made a tested and working patch for x64-macos, but it should also work for any *-macos. I tried to add every other *-macos arch, but I might have missed some, please review.

(see also: bug 330229 for the 5.0.6 ebuild request)
Comment 1 Florian CROUZAT (SuperFlo) 2010-07-28 15:50:47 UTC
Created attachment 240457 [details, diff]
Avoid *-macos to link against -lcrypt
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-07-28 15:58:51 UTC
I guess in this case it is better to match CHOST=*darwin* or so.
Comment 3 Florian CROUZAT (SuperFlo) 2010-07-28 17:33:24 UTC
Created attachment 240475 [details, diff]
Use chost instead of a long list of use *-macos

Also note that every sed in this ebuild haven't || die clause, I'm not sure if it's a good thing or not.
Comment 4 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-07-29 16:22:57 UTC
@base-system: This patch cannot go upstream because upstream says "You should fix the Makefile for your platform" or so.
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-07-29 16:31:14 UTC
And isn't it possible to, well, fix the makefile for that platform in a way that does not require patching?

I could try to talk with Md about this but it's somewhat unlikely I can get anything done regarding that. Mike?
Comment 6 SpanKY gentoo-dev 2010-07-29 17:18:55 UTC
dont bind to a CHOST.  simply test if -lcrypt is available and if it isnt, sed it out from the makefile.

the whois maintainer is known to be a pita to work with.
Comment 7 Florian CROUZAT (SuperFlo) 2010-07-29 20:43:46 UTC
(In reply to comment #5)
> I could try to talk with Md about this but it's somewhat unlikely I can get
> anything done regarding that. Mike?

Looks vain, indeed. See http://trac.macports.org/attachment/ticket/14951/whois-4.7.26.txt for a two years old email discussion between a guy from darwinport and Md.

Comment 8 Fabian Groffen gentoo-dev 2010-08-11 18:23:40 UTC
Hmmm, any suggestions on what to use, Mike?  test-flag-CC doesn't work, since it doesn't perform the linking step.  Can't use ld directly IMO, since it is guaranteed to be different (non-GNU) in this case.

Should we write a test function to perform a link step through the compiler?  (Usually autoconf is so good at this :( )
Comment 9 Fabian Groffen gentoo-dev 2011-12-15 19:51:22 UTC
This patch works for me on Darwin:

diff -u -r1.7 whois-5.0.8.ebuild
--- whois-5.0.8.ebuild  1 Mar 2011 00:33:08 -0000       1.7
+++ whois-5.0.8.ebuild  15 Dec 2011 19:50:28 -0000
@@ -28,6 +28,9 @@
        else
                sed -i -e '/ENABLE_NLS/s:define:undef:' config.h
        fi
+
+       echo "int main() {}" | gcc -xc -o /dev/null - -lcrypt >& /dev/null \
+               || sed -i -e 's/-lcrypt//' Makefile
 }
 
 src_configure() { :;} # expected no-op
@@ -41,7 +44,7 @@
 }
 
 src_install() {
-       emake BASEDIR="${ED}" prefix=/usr install || die
+       emake BASEDIR="${D}" prefix="${EPREFIX}"/usr install || die
        insinto /etc
        doins whois.conf
        dodoc README debian/changelog
Comment 10 SpanKY gentoo-dev 2011-12-15 20:09:54 UTC
s/gcc/$(tc-getCC) ${CFLAGS} ${LDFLAGS}/

i've been toying around with making some toolchain funcs for probing headers/libraries, but haven't produced anything i'm happy with yet.
Comment 11 Fabian Groffen gentoo-dev 2011-12-15 20:28:53 UTC
Ok, fix added like that, keyworded, so all done now.