Subject: Re: DESTDIR vs. beforeinstall - Battle of the Titans
To: None <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
From: Greg Earle <earle@isolar.Tujunga.CA.US>
List: current-users
Date: 05/23/1996 16:21:47
Chris writes:
> header installs are done this way (i.e. cmp then install if different)
> for all 'generated' headers (at least, that i'm aware of).
> 
> you have to do this for generated headers: otherwise, when you 'make
> clean' and then 'make includes' you'll end up _always_ installing a
> header with a new mod time.  For static headers, you don't need to do this.

So why is lib/libcurses/curses.h installed that way?

netbsd4me:1:40 % pwd
/usr/src/lib/libcurses
netbsd4me:1:41 % sed -n "13,19p" Makefile

includes:
	-cd ${.CURDIR}; cmp -s curses.h ${DESTDIR}/usr/include/curses.h > \
	  /dev/null 2>&1 || \
	  install -c -o ${BINOWN} -g ${BINGRP} -m 444 curses.h \
	  ${DESTDIR}/usr/include

> I'm not sure which headers in particular are being talked about
> here, however ...

(I guess my postings are getting dropped by Chris' "filter out idiots" (-: )

I'm talking about libkadm/kadm_err.h, libkrb/krb_err.h and libss/ss_err.h
under /usr/src/domestic/lib.  Building into $DESTDIR fails in .../libkadm
because kadm_cli_wrap.c expects kerberosIV/krb_err.h to exist, and it doesn't:

cc -O -I/usr/src/domestic/lib/libkadm \
-I/usr/src/domestic/lib/libkadm/../libkrb/obj \
-I/usr/src/domestic/lib/libkadm/obj \
-I/usr/src/domestic/lib/libkadm/../../include \
-I/usr/src/domestic/lib/libkadm/../../include/kerberosIV \
-I/usr/src/domestic/lib/libkadm/../../include/ss -Werror -nostdinc -idirafter \
/usr/local/.build/usr/include  -c /usr/src/domestic/lib/libkadm/kadm_cli_wrap.c
/usr/src/domestic/lib/libkadm/kadm_cli_wrap.c:37: kerberosIV/krb_err.h: No 
such file or directory
*** Error code 1

This could either be fixed by Mike Long's suggestion regarding using "includes"
as the target instead of "beforeinstall" (see below; albeit it needs a change)
or by figuring out what rule generated the

	-I/usr/src/domestic/lib/libkadm/../libkrb/obj
instead of
	-I/usr/src/domestic/lib/libkadm/../libkrb

which would have worked.

Look at

netbsd4me:1:53 % pwd
/usr/src/domestic/lib
netbsd4me:1:54 % sed -n "31,37p" libkadm/Makefile

beforeinstall:
        -cd ${.OBJDIR}; cmp -s kadm_err.h \
            ${DESTDIR}/usr/include/kerberosIV/kadm_err.h || \
            install -c -o ${BINOWN} -g ${BINGRP} -m 444 kadm_err.h \
            ${DESTDIR}/usr/include/kerberosIV

netbsd4me:1:55 % sed -n "69,75p" libkrb/Makefile

beforeinstall:
        -cd ${.OBJDIR}; cmp -s krb_err.h \
        ${DESTDIR}/usr/include/kerberosIV/krb_err.h || \
        install -c -o ${BINOWN} -g ${BINGRP} -m 444 krb_err.h \
        ${DESTDIR}/usr/include/kerberosIV

netbsd4me:1:56 % sed -n "40,50p" libss/Makefile

beforeinstall:
        -cd ${.OBJDIR}; \
            if [ -f ss_err.h ]; then \
                cmp -s ss_err.h ${DESTDIR}/usr/include/kerberosIV/ss_err.h || \
                install -c -o ${BINOWN} -g ${BINGRP} -m 444 ss_err.h \
                ${DESTDIR}/usr/include/kerberosIV; \
            else \
                true; \
            fi

for the gory details.

	- Greg