Date: Tue, 10 Jan 2006 12:45:48 -0700 (MST) From: "John E. Hein" <jhein@timing.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: ache@FreeBSD.org Subject: ports/91610: DESTDIR used incorrectly in png's makefile.freebsd Message-ID: <200601101945.k0AJjmTv015722@gromit.timing.com> Resent-Message-ID: <200601101950.k0AJo3A3021961@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 91610 >Category: ports >Synopsis: DESTDIR used incorrectly in png's makefile.freebsd >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jan 10 19:50:02 GMT 2006 >Closed-Date: >Last-Modified: >Originator: John E. Hein >Release: FreeBSD 6.0-STABLE i386 >Organization: Timing Solutions >Environment: >Description: At some point after 4.x, make was changed to pass down make arguments in MAKEFLAGS. Because of this, if you try to invoke the 'make install' of png from a parent make where DESTDIR was specified, png installs to the wrong place. >How-To-Repeat: In the following example, I show how trying to install with DESTDIR= screws up (and another install without DESTDIR= does the right thing). Annotations for the example below... [1] Here it tries to install libs into /lib. It succeeds since /lib is a dir. But that's not what we want. We want it to go to ${DESTDIR}/usr/local/lib [2] Here it tries to install headers into /include/libpng. It fails, of course, since /include does not exist. % pwd /usr/ports/graphics/png % cat Makefile.1 x: make DESTDIR= sudo pkg_delete png-1.2.8_2 sudo make DESTDIR= install || \ { echo ; echo "********* Error: install with DESTDIR failed" ; echo ; \ sudo make install; } % uname -a FreeBSD gromit.timing.com 6.0-STABLE FreeBSD 6.0-STABLE #0: Tue Jan 3 12:47:11 MST 2006 jhein@Speedy.timing.com:/usr/obj/usr/src/sys/GROMIT i386 % make -f Makefile.1 make DESTDIR= ===> Extracting for png-1.2.8_2 => MD5 Checksum OK for libpng-1.2.8.tar.bz2. ===> Patching for png-1.2.8_2 ===> Applying FreeBSD patches for png-1.2.8_2 ===> Configuring for png-1.2.8_2 ===> Building for png-1.2.8_2 cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c png.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngset.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngget.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngrutil.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngtrans.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwutil.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngread.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngrio.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwio.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwrite.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngrtran.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwtran.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngmem.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngerror.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngpread.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pnggccrd.c building static png library ranlib libpng.a cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c png.c -o png.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngset.c -o pngset.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngget.c -o pngget.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngrutil.c -o pngrutil.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngtrans.c -o pngtrans.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwutil.c -o pngwutil.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngread.c -o pngread.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngrio.c -o pngrio.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwio.c -o pngwio.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwrite.c -o pngwrite.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngrtran.c -o pngrtran.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngwtran.c -o pngwtran.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngmem.c -o pngmem.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngerror.c -o pngerror.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngpread.c -o pngpread.So cc -fpic -DPIC -O -pipe -I. -DPNG_USE_PNGGCCRD -c pnggccrd.c -o pnggccrd.So building shared library libpng.so.5 gzip -cn libpng.3 > libpng.3.gz gzip -cn libpngpf.3 > libpngpf.3.gz gzip -cn png.5 > png.5.gz ( cat scripts/libpng-config-head.in; echo prefix=\"/usr/local\"; echo libdir=\"/usr/local/lib\"; echo ccopts=\"-O -pipe \"; echo cppflags=\"-DPNG_USE_PNGGCCRD\"; echo I_opts=\"-I/usr/local/include/libpng\"; echo L_opts=\"-L/usr/local/lib\"; echo libs=\"-lpng -lz -lm\"; echo ldopts=\"\"; cat scripts/libpng-config-body.in ) > libpng-config chmod +x libpng-config cc -O -pipe -I. -DPNG_USE_PNGGCCRD -c pngtest.c cc -O -pipe -I. -DPNG_USE_PNGGCCRD -L. -static -o pngtest pngtest.o -lpng -lz -lm ./pngtest Testing libpng version 1.2.8 with zlib version 1.2.1 libpng version 1.2.8 - December 3, 2004 Copyright (c) 1998-2004 Glenn Randers-Pehrson Copyright (c) 1996-1997 Andreas Dilger Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. library (10208): libpng version 1.2.8 - December 3, 2004 (header) pngtest (10208): libpng version 1.2.8 - December 3, 2004 (header) png_sizeof(png_struct)=604, png_sizeof(png_info)=288 Testing pngtest.png: Pass 0: rwrwrwrwrwrwrwrwrw Pass 1: rwrwrwrwrwrwrwrwrw Pass 2: rwrwrwrwrwrwrwrw Pass 3: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw Pass 4: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw Pass 5: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw rwrwrwrw Pass 6: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw rwrwrwrwrw PASS (9782 zero samples) Filter 0 was used 21 times Filter 1 was used 15 times Filter 2 was used 52 times Filter 3 was used 10 times Filter 4 was used 33 times tIME = 7 Jun 1996 17:58:08 +0000 libpng passes test find work -type d -exec chmod a+rwx {} \; sudo pkg_delete png-1.2.8_2 sudo make DESTDIR= install || { echo ; echo "********* Error: install with DESTDIR failed" ; echo ; sudo make install; } ===> Installing for png-1.2.8_2 ===> Generating temporary packing list ===> Checking if graphics/png already installed install -o root -g wheel -m 555 libpng-config /usr/local/bin ln -sf libpng-config /usr/local/bin/libpng12-config install -C -o root -g wheel -m 444 libpng.a /lib [1] install -s -o root -g wheel -m 444 libpng.so.5 /lib ln -fs libpng.so.5 /lib/libpng.so install -C -o root -g wheel -m 444 png.h pngconf.h /include/libpng [2] install: wrong number or types of arguments usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 file2 install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 ... fileN directory install -d [-v] [-g group] [-m mode] [-o owner] directory ... *** Error code 64 Stop in /usr/ports/graphics/png/work/libpng-1.2.8. *** Error code 1 Stop in /usr/ports/graphics/png. ********* Error: install with DESTDIR failed ===> Installing for png-1.2.8_2 ===> Generating temporary packing list ===> Checking if graphics/png already installed install -o root -g wheel -m 555 libpng-config /usr/local/bin ln -sf libpng-config /usr/local/bin/libpng12-config install -C -o root -g wheel -m 444 libpng.a /usr/local/lib install -s -o root -g wheel -m 444 libpng.so.5 /usr/local/lib ln -fs libpng.so.5 /usr/local/lib/libpng.so install -C -o root -g wheel -m 444 png.h pngconf.h /usr/local/include/libpng install -o root -g wheel -m 444 libpng.3.gz /usr/local/man/man3 install -o root -g wheel -m 444 libpngpf.3.gz /usr/local/man/man3 install -o root -g wheel -m 444 png.5.gz /usr/local/man/man5 /usr/local/include/libpng/../png.h -> libpng/png.h /usr/local/include/libpng/../pngconf.h -> libpng/pngconf.h /usr/bin/sed -e 's|@PREFIX@|/usr/local|' /usr/ports/graphics/png/work/libpng-1.2.8/scripts/libpng.pc.in > /usr/ports/graphics/png/work/libpng-1.2.8/scripts/libpng.pc install -o root -g wheel -m 444 /usr/ports/graphics/png/work/libpng-1.2.8/scripts/libpng.pc /usr/local/libdata/pkgconfig/libpng12.pc ===> Running ldconfig /sbin/ldconfig -m /usr/local/lib ===> Registering installation for png-1.2.8_2 >Fix: Don't use DESTDIR improperly. Here's a modified patch-aa. % cat files/patch-aa --- scripts/makefile.freebsd.orig Sat May 18 08:46:45 2002 +++ scripts/makefile.freebsd Tue Jan 10 12:05:18 2006 @@ -12,22 +12,22 @@ NOOBJ= YES # where make install puts libpng.a and png.h -DESTDIR= ${PREFIX} -LIBDIR= /lib +LIBDIR= ${PREFIX}/lib INCS= png.h pngconf.h -INCSDIR= /include/libpng +INCSDIR= ${PREFIX}/include/libpng INCDIR= ${INCSDIR} # for 4.x bsd.lib.mk MAN= libpng.3 libpngpf.3 png.5 -MANDIR= /man/man +MANDIR= ${PREFIX}/man/man SYMLINKS= libpng/png.h ${INCSDIR}/../png.h \ libpng/pngconf.h ${INCSDIR}/../pngconf.h LDADD+= -lm -lz DPADD+= ${LIBM} ${LIBZ} -CFLAGS+= -I. -DPNG_USE_PNGGCCRD -.if (${MACHINE_ARCH} != "i386") -CFLAGS+= -DPNG_NO_ASSEMBLER_CODE +cppflags=-DPNG_USE_PNGGCCRD +.if (${ARCH} != "i386") +cppflags+=-DPNG_NO_ASSEMBLER_CODE .endif +CFLAGS+=-I. ${cppflags} SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ @@ -44,5 +44,23 @@ DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO writelock: chmod a-w *.[ch35] $(DOCS) scripts/* + +libpng-config: + ( cat scripts/libpng-config-head.in; \ + echo prefix=\"${PREFIX}\"; \ + echo libdir=\"${PREFIX}${LIBDIR}\"; \ + echo ccopts=\"${ccopts}\"; \ + echo cppflags=\"${cppflags}\"; \ + echo I_opts=\"-I${PREFIX}${INCSDIR}\"; \ + echo L_opts=\"-L${PREFIX}${LIBDIR}\"; \ + echo libs=\"-lpng -lz -lm\"; \ + echo ldopts=\"${ldopts}\"; \ + cat scripts/libpng-config-body.in ) > libpng-config + chmod +x libpng-config + +beforeinstall: libpng-config + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + libpng-config ${PREFIX}/bin + ln -sf libpng-config ${PREFIX}/bin/libpng12-config .include <bsd.lib.mk> ... and in diff format ... % cvs diff files/patch-aa Index: files/patch-aa =================================================================== RCS file: /base/FreeBSD-CVS/ports/graphics/png/files/patch-aa,v retrieving revision 1.23 diff -u -p -r1.23 patch-aa --- files/patch-aa 30 Jan 2005 14:41:31 -0000 1.23 +++ files/patch-aa 10 Jan 2006 19:05:37 -0000 @@ -1,6 +1,21 @@ ---- scripts/makefile.freebsd.orig Sat May 18 18:46:45 2002 -+++ scripts/makefile.freebsd Sun Jan 30 17:33:45 2005 -@@ -24,10 +24,11 @@ +--- scripts/makefile.freebsd.orig Sat May 18 08:46:45 2002 ++++ scripts/makefile.freebsd Tue Jan 10 12:05:18 2006 +@@ -12,22 +12,22 @@ + NOOBJ= YES + + # where make install puts libpng.a and png.h +-DESTDIR= ${PREFIX} +-LIBDIR= /lib ++LIBDIR= ${PREFIX}/lib + INCS= png.h pngconf.h +-INCSDIR= /include/libpng ++INCSDIR= ${PREFIX}/include/libpng + INCDIR= ${INCSDIR} # for 4.x bsd.lib.mk + MAN= libpng.3 libpngpf.3 png.5 +-MANDIR= /man/man ++MANDIR= ${PREFIX}/man/man + SYMLINKS= libpng/png.h ${INCSDIR}/../png.h \ + libpng/pngconf.h ${INCSDIR}/../pngconf.h LDADD+= -lm -lz DPADD+= ${LIBM} ${LIBZ} @@ -15,7 +30,7 @@ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ -@@ -44,5 +45,23 @@ +@@ -44,5 +44,23 @@ DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO writelock: chmod a-w *.[ch35] $(DOCS) scripts/* >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601101945.k0AJjmTv015722>