Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 476336

Summary: dev-libs/mpfr: please review prefix changes
Product: Gentoo Linux Reporter: Christoph Junghans (RETIRED) <junghans>
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: prefix
Priority: Normal Keywords: Inclusion, PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 315803    
Attachments: patch against mpfr-3.1.1.ebuild
patch against mpfr-2.4.2_p3-r1.ebuild
mpfr-eroot.patch

Description Christoph Junghans (RETIRED) gentoo-dev 2013-07-10 00:36:34 UTC
Created attachment 352966 [details, diff]
patch against mpfr-3.1.1.ebuild

Changes:
- FreeMint needs elibtoolize
- prefix gmp-{lib,include}
- so.1 -> $(get_libname 1)

For SLOT=1
- FreeMint needs elibtoolize
- ${D} -> ${ED}
- rm dylib, too
Comment 1 Christoph Junghans (RETIRED) gentoo-dev 2013-07-10 00:37:07 UTC
Created attachment 352970 [details, diff]
patch against mpfr-2.4.2_p3-r1.ebuild
Comment 2 Ryan Hill (RETIRED) gentoo-dev 2013-07-19 16:08:52 UTC
Comment on attachment 352966 [details, diff]
patch against mpfr-3.1.1.ebuild

> 	econf \
> 		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
>+		--with-gmp-lib="${EPREFIX}"/usr/$(get_libdir) \
>+		--with-gmp-include="${EPREFIX}"/usr/include || die
> 		$(use_enable static-libs static)

Probably don't want that || die there.
Comment 3 Christoph Junghans (RETIRED) gentoo-dev 2013-07-19 16:13:01 UTC
(In reply to Ryan Hill from comment #2)
> Comment on attachment 352966 [details, diff] [details, diff]
> patch against mpfr-3.1.1.ebuild
> 
> > 	econf \
> > 		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
> >+		--with-gmp-lib="${EPREFIX}"/usr/$(get_libdir) \
> >+		--with-gmp-include="${EPREFIX}"/usr/include || die
> > 		$(use_enable static-libs static)
> 
> Probably don't want that || die there.
I don't know where this came from! Agreed, it should be "\"$

Is the rest ok to commit?
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2013-07-19 16:25:00 UTC
Looks fine to me.  Go ahead.
Comment 5 Christoph Junghans (RETIRED) gentoo-dev 2013-07-21 21:58:24 UTC
@@ -4,0 +5,4 @@
+  21 Jul 2013; Christoph Junghans <ottxor@gentoo.org> mpfr-2.4.2_p3-r1.ebuild,
+  mpfr-3.1.2.ebuild:
+  added prefix support (bug #476336)
+
Comment 6 Fabian Groffen gentoo-dev 2013-07-22 06:54:57 UTC
removed from prefix overlay
Comment 7 SpanKY gentoo-dev 2013-08-25 02:31:25 UTC
Comment on attachment 352966 [details, diff]
patch against mpfr-3.1.1.ebuild

i've fixed this in cvs, but keep this in mind with all other prefix patches you post

>+	# needed for FreeMiNT
>+	[[ ${CHOST} == *-mint* ]] && elibtoolize

never conditionalize elibtoolize

> 	econf \
> 		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
>+		--with-gmp-lib="${EPREFIX}"/usr/$(get_libdir) \
>+		--with-gmp-include="${EPREFIX}"/usr/include || die

never use `die` with econf
Comment 8 Benda Xu gentoo-dev 2013-10-18 07:07:08 UTC
Created attachment 361200 [details, diff]
mpfr-eroot.patch

Sorry to reopen. But I suppose the variable used in econf should be EROOT instead of EPREFIX. Because when we are cross compiling mpfr, there should be a way to pass ROOT into econf.
Comment 9 Christoph Junghans (RETIRED) gentoo-dev 2013-10-21 22:38:07 UTC
Comment on attachment 361200 [details, diff]
mpfr-eroot.patch

>Index: mpfr-3.1.2-r1.ebuild
>===================================================================
>RCS file: /var/cvsroot/gentoo-x86/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild,v
>retrieving revision 1.1
>diff -u -B -r1.1 mpfr-3.1.2-r1.ebuild
>--- mpfr-3.1.2-r1.ebuild	13 Sep 2013 18:32:04 -0000	1.1
>+++ mpfr-3.1.2-r1.ebuild	18 Oct 2013 07:04:24 -0000
>@@ -45,9 +45,9 @@
> 
> src_configure() {
> 	econf \
>-		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
>-		--with-gmp-lib="${EPREFIX}"/usr/$(get_libdir) \
>-		--with-gmp-include="${EPREFIX}"/usr/include \
>+		--docdir="${EROOT}"usr/share/doc/${PF} \
EROOT for docdir seems strange.
>+		--with-gmp-lib="${EROOT}"usr/$(get_libdir) \
>+		--with-gmp-include="${EROOT}"usr/include \
For these two it make sense!
> 		$(use_enable static-libs static)
> }
>
Comment 10 Benda Xu gentoo-dev 2013-10-22 09:21:02 UTC
(In reply to Christoph Junghans from comment #9)
> Comment on attachment 361200 [details, diff] [details, diff]
> mpfr-eroot.patch
> 
> >Index: mpfr-3.1.2-r1.ebuild
> >===================================================================
> >RCS file: /var/cvsroot/gentoo-x86/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild,v
> >retrieving revision 1.1
> >diff -u -B -r1.1 mpfr-3.1.2-r1.ebuild
> >--- mpfr-3.1.2-r1.ebuild	13 Sep 2013 18:32:04 -0000	1.1
> >+++ mpfr-3.1.2-r1.ebuild	18 Oct 2013 07:04:24 -0000
> >@@ -45,9 +45,9 @@
> > 
> > src_configure() {
> > 	econf \
> >-		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
> >-		--with-gmp-lib="${EPREFIX}"/usr/$(get_libdir) \
> >-		--with-gmp-include="${EPREFIX}"/usr/include \
> >+		--docdir="${EROOT}"usr/share/doc/${PF} \
> EROOT for docdir seems strange.

Why is it strange? There is docdir inside ROOT, too.
Comment 11 Benda Xu gentoo-dev 2013-11-01 08:47:46 UTC
If there if no further objections, I'll go ahead to commit this EPREFIX to EROOT in a week. Thanks.
Comment 12 Christoph Junghans (RETIRED) gentoo-dev 2013-11-01 14:54:10 UTC
(In reply to Benda Xu from comment #10)
> (In reply to Christoph Junghans from comment #9)
> > Comment on attachment 361200 [details, diff] [details, diff] [details, diff]
> > mpfr-eroot.patch
> > 
> > >Index: mpfr-3.1.2-r1.ebuild
> > >===================================================================
> > >RCS file: /var/cvsroot/gentoo-x86/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild,v
> > >retrieving revision 1.1
> > >diff -u -B -r1.1 mpfr-3.1.2-r1.ebuild
> > >--- mpfr-3.1.2-r1.ebuild	13 Sep 2013 18:32:04 -0000	1.1
> > >+++ mpfr-3.1.2-r1.ebuild	18 Oct 2013 07:04:24 -0000
> > >@@ -45,9 +45,9 @@
> > > 
> > > src_configure() {
> > > 	econf \
> > >-		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
> > >-		--with-gmp-lib="${EPREFIX}"/usr/$(get_libdir) \
> > >-		--with-gmp-include="${EPREFIX}"/usr/include \
> > >+		--docdir="${EROOT}"usr/share/doc/${PF} \
> > EROOT for docdir seems strange.
> 
> Why is it strange? There is docdir inside ROOT, too.
docdir is output, but with-gmp-* is input, it makes sense to search for gmp in ${EROOT}, but why should the documentation be written to ${EROOT}?
Comment 13 Benda Xu gentoo-dev 2013-11-03 07:17:33 UTC
(In reply to Christoph Junghans from comment #12)
> (In reply to Benda Xu from comment #10)
> > (In reply to Christoph Junghans from comment #9)
> > > Comment on attachment 361200 [details, diff] [details, diff] [details, diff] [details, diff]
> > > mpfr-eroot.patch
> > > 
> > > >Index: mpfr-3.1.2-r1.ebuild
> > > >===================================================================
> > > >RCS file: /var/cvsroot/gentoo-x86/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild,v
> > > >retrieving revision 1.1
> > > >diff -u -B -r1.1 mpfr-3.1.2-r1.ebuild
> > > >--- mpfr-3.1.2-r1.ebuild	13 Sep 2013 18:32:04 -0000	1.1
> > > >+++ mpfr-3.1.2-r1.ebuild	18 Oct 2013 07:04:24 -0000
> > > >@@ -45,9 +45,9 @@
> > > > 
> > > > src_configure() {
> > > > 	econf \
> > > >-		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
> > > >-		--with-gmp-lib="${EPREFIX}"/usr/$(get_libdir) \
> > > >-		--with-gmp-include="${EPREFIX}"/usr/include \
> > > >+		--docdir="${EROOT}"usr/share/doc/${PF} \
> > > EROOT for docdir seems strange.
> > 
> > Why is it strange? There is docdir inside ROOT, too.
> docdir is output, but with-gmp-* is input, it makes sense to search for gmp
> in ${EROOT}, but why should the documentation be written to ${EROOT}?

You are right Chris. I misunderstood the use of --docdir here.

committed with gmp-{lib,include}. Thanks.

--- ./ChangeLog
+++ ./ChangeLog
@@ -4,0 +5,3 @@
+  03 Nov 2013; Benda Xu <heroxbd@gentoo.org> mpfr-3.1.2-r1.ebuild:
+  EROOT for gmp locations to do cross compiling correctly. bug #476336
+
Comment 14 SpanKY gentoo-dev 2013-11-21 20:32:33 UTC
err, no, this is broken.  here's a simple rule of thumb: ROOT is never valid in a src_* function.  if you try to use it, you're doing something wrong.
Comment 15 Benda Xu gentoo-dev 2013-11-22 09:06:29 UTC
(In reply to SpanKY from comment #14)
> err, no, this is broken.  here's a simple rule of thumb: ROOT is never valid
> in a src_* function.  if you try to use it, you're doing something wrong.

Mike, would you elaborate the reason? If ROOT cannot be used in src_configure, how a native gcc (needs mpfr) could be cross-built?
Comment 16 SpanKY gentoo-dev 2013-11-22 13:02:49 UTC
(In reply to Benda Xu from comment #15)

--docdir is the path mpfr uses to store things.  it doesn't use it for input at build time at all.

the --with-gmp-{lib,include} configure flags should simply be deleted.  the toolchain itself knows how to find the right gmp paths.  if it doesn't, then your toolchain is broken and that should be fixed.
Comment 17 SpanKY gentoo-dev 2013-11-24 03:52:35 UTC
Commit message: Revert gmp lib/include flags as they are wrong & unnecessary.  Tweak the docdir flag to be a bit simpler.
http://sources.gentoo.org/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild?r1=1.6&r2=1.7
Comment 18 Benda Xu gentoo-dev 2013-11-24 04:20:50 UTC
(In reply to SpanKY from comment #17)
> Commit message: Revert gmp lib/include flags as they are wrong &
> unnecessary.  Tweak the docdir flag to be a bit simpler.
> http://sources.gentoo.org/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild?r1=1.6&r2=1.7

Test of this version on Prefix successful. Test of cross-triplet-prefix will follow.
Comment 19 Michael Haubenwallner (RETIRED) gentoo-dev 2013-11-25 12:34:23 UTC
(In reply to Benda Xu from comment #18)
> (In reply to SpanKY from comment #17)
> > Commit message: Revert gmp lib/include flags as they are wrong &
> > unnecessary.  Tweak the docdir flag to be a bit simpler.
> > http://sources.gentoo.org/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild?r1=1.6&r2=1.7
> 
> Test of this version on Prefix successful.

Erm, breaks on AIX here: When "$CC$CFLAGS" is empty, mpfr tries to extract them from "gmp.h" using ('/lib/cpp' 'gcc -E' 'cc -E') in that order. This did work --with-gmp-include, but without gmp-include /lib/cpp falls back to /usr/include/gmp.h, giving wrong compiler and CFLAGS.

This one causes configure to completely ignore preinstalled gmp.h - unsure if this is a problem as gmp.h may define ABI specific CFLAGS though:
 ...
 src_configure() {
+       tc-export CC
        econf \
 ...
Comment 20 SpanKY gentoo-dev 2013-11-25 18:33:41 UTC
(In reply to Michael Haubenwallner from comment #19)

yes, mpfr has some crazy logic in it:

  dnl ********************************************************************
  dnl Check for CC and CFLAGS in gmp.h

  if test -z "$user_redefine_cc" && test "$cross_compiling" != yes ; then

  dnl We need to guess the C preprocessor instead of using AC_PROG_CPP,
  dnl since AC_PROG_CPP implies AC_PROG_CC, which chooses a compiler  
  dnl (before we have the chance to get it from gmp.h) and does some
  dnl checking related to this compiler (such as dependency tracking
  dnl options); if the compiler changes due to __GMP_CC in gmp.h, one
  dnl would have incorrect settings.
  dnl FIXME: Move this in aclocal ?
  if test -z "$GMP_CC$GMP_CFLAGS" ; then
     AC_MSG_CHECKING(for CC and CFLAGS in gmp.h)
     GMP_CC=__GMP_CC
     GMP_CFLAGS=__GMP_CFLAGS
     for cpp in /lib/cpp gcc cc c99
     do

i wouldn't mind patching it out at the high level:

-if test -z "$user_redefine_cc" && test "$cross_compiling" != yes ; then
+if false ; then
Comment 21 SpanKY gentoo-dev 2013-11-26 07:27:12 UTC
Commit message: Disable logic to probe gmp.h using the wrong toolchain
http://sources.gentoo.org/dev-libs/mpfr/mpfr-3.1.2-r1.ebuild?r1=1.7&r2=1.8
Comment 22 Michael Haubenwallner (RETIRED) gentoo-dev 2013-11-26 07:58:16 UTC
(In reply to SpanKY from comment #21)

Yep, does work too, thanks!