Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Aug 2004 11:10:18 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Michael Nottebrock <michaelnottebrock@gmx.net>
Cc:        mi@aldan.algebra.com
Subject:   Re: port breakage with recent make
Message-ID:  <20040823081018.GJ59140@ip.net.ua>
In-Reply-To: <200408210545.46358.michaelnottebrock@gmx.net>
References:  <200408210545.46358.michaelnottebrock@gmx.net>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Sat, Aug 21, 2004 at 05:45:42AM +0200, Michael Nottebrock wrote:
> science/hdf breaks with the latest make(1). What it does seems innocent 
> enough: It passes PREFIX via MAKE_ARGS to the main Makefile (MAKE_ARGS=      
> PREFIX="${PREFIX}") and the main Makefile has:
> 
> LIBDIR  ?= ${PREFIX}/lib
> BINDIR  ?= ${PREFIX}/bin
> 
> .MAKEFLAGS: PREFIX=${PREFIX} LIBDIR=${LIBDIR} BINDIR=${BINDIR}
> 
> It does some more redefinitions of LIBDIR and BINDIR (with references to 
> PREFIX ...) in Makefiles further down (the ports seems to replace the 
> autotools Makefiles rather completely with custom-made ones), but there's 
> nothing that looks like it should undefine or change PREFIX. Is the port 
> wrong or make?
> 
Recent make(1) just exposed a bug in a port.  Here's what happens here.
bsd.port.mk passes LIBDIR=/usr/lib in environment:

: (cd /usr/ports/science/hdf/work/HDF4.1r5 && \
:     /usr/bin/env SHELL=/bin/sh PORTOBJFORMAT=elf \
:     PREFIX=/usr/local LOCALBASE=/usr/local X11BASE=/usr/X11R6 \
:     MOTIFLIB="-L/usr/X11R6/lib -lXm -lXp" \
:     LIBDIR="/usr/lib" \
:     CFLAGS="-O -pipe " \
:     CXXFLAGS=" -O -pipe " \
:     MANPREFIX="/usr/local" \
:     BSD_INSTALL_PROGRAM="install -c -s -o root -g wheel -m 555" \
:     BSD_INSTALL_SCRIPT="install -c -o root -g wheel -m 555" \
:     BSD_INSTALL_DATA="install -c -o root -g wheel -m 444" \
:     BSD_INSTALL_MAN="install -c -o root -g wheel -m 444" \
:     make -f Makefile PREFIX="/usr/local" -j 2 install)

Port's makefile does this:

: # cat /usr/ports/science/hdf/files/Makefile
: # $FreeBSD: ports/science/hdf/files/Makefile,v 1.1 1999/11/14 02:32:03 steve Exp $
: 
: SUBDIR   = hdf mfhdf man
: #PREFIX ?= /usr/local
: LIBDIR  ?= ${PREFIX}/lib
: BINDIR  ?= ${PREFIX}/bin
: 
: .MAKEFLAGS: PREFIX=${PREFIX} LIBDIR=${LIBDIR} BINDIR=${BINDIR}
: 
: test: all
:         # testing in hdf
:         @cd hdf && ${MAKE} hdf-test
:         # testing in mfhdf
:         @cd mfhdf && ${MAKE} test
: 
: .include <bsd.subdir.mk>

So, Makefile sees /usr/lib and passes it as a command-line variable
(using .MAKEFLAGS), as requested.  Old make(1) was buggy and did not
pass this variable as a command-line variable.  New make(1) does
the required thing, so LIBDIR ends up being set to /usr/lib.

The fix is trivial:

%%%
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/science/hdf/files/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- Makefile	14 Nov 1999 02:32:03 -0000	1.1
+++ Makefile	23 Aug 2004 08:08:00 -0000
@@ -2,8 +2,8 @@
 
 SUBDIR	 = hdf mfhdf man
 #PREFIX	?= /usr/local
-LIBDIR	?= ${PREFIX}/lib
-BINDIR	?= ${PREFIX}/bin
+LIBDIR	 = ${PREFIX}/lib
+BINDIR	 = ${PREFIX}/bin
 
 .MAKEFLAGS: PREFIX=${PREFIX} LIBDIR=${LIBDIR} BINDIR=${BINDIR}
 
%%%

Feel free to commit it.


Cheers,
-- 
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (FreeBSD)

iD8DBQFBKaZqqRfpzJluFF4RAvgBAJ9jaNfWUlMh6I0cbUujjZBlOytZ1wCfS+91
GQXoFecOoYB3zf3WCgSwcfk=
=mlSS
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040823081018.GJ59140>