Bug 91610 - DESTDIR used incorrectly in png's makefile.freebsd
DESTDIR used incorrectly in png's makefile.freebsd
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Andrey A. Chernov
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-10 19:50 UTC by jhein
Modified: 2006-01-12 17:53 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (1.69 KB, patch)
2006-01-10 19:50 UTC, jhein
no flags Details | Diff
file.diff (1.38 KB, patch)
2006-01-10 19:50 UTC, jhein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jhein 2006-01-10 19:50:02 UTC
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.

Fix: Don't use DESTDIR improperly.  Here's a modified patch-aa.

% cat files/patch-aa
... and in diff format ...

% cvs diff files/patch-aa
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
Comment 1 Edwin Groothuis freebsd_committer 2006-01-10 20:52:02 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ache

Over to maintainer
Comment 2 Andrey A. Chernov freebsd_committer 2006-01-12 17:53:04 UTC
State Changed
From-To: open->closed

Committed