Re: port breakage with recent make

From: Ruslan Ermilov <ru_at_FreeBSD.org>
Date: Mon, 23 Aug 2004 11:10:18 +0300
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
:         _at_cd hdf && ${MAKE} hdf-test
:         # testing in mfhdf
:         _at_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
_at__at_ -2,8 +2,8 _at__at_
 
 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_at_FreeBSD.org
FreeBSD committer

Received on Mon Aug 23 2004 - 06:10:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:07 UTC