Why hasn’t the fact that the “expat” install is broken, been discovered before this

I’m porting the Blogmatrix platform to Solaris and of course all kinds of little things are popping up, like expat’s install is broken for include files, and I’m assuming it’s a Murphey’s law sorta thing that it hasn’t been discovered before, at least I haven’t found the problem Googling for it.

Here’s the gist, the installer drops a number of files into assorted places, for instance a library, a man page and two header files. Looking at the Makefile.in we have the following, in particular the last line.

APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h

installlib: $(LIBRARY) $(APIHEADER)
        $(mkinstalldirs) $(libdir) $(includedir)
        $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(libdir)/$(LIBRARY)
        $(INSTALL_DATA) $(APIHEADER) $(includedir)

The last line translates to the following on Solaris:

conftools/install-sh -c -m 644 ./lib/expat.h ./lib/expat_external.h  /your/install/dir/include

Which seems reasonable enough, except for the fact that install-sh ignores anything between the first file and the last directory directive on the command line, nice. On other platforms configure uses a different install script provided by the system instead of install-sh included in the package, bummer, it would make sense to fix install-sh but it won’t be pretty. So I’ve patched the Makefile instead, ugly but much smaller and it should work every where.

80c80
< installlib: $(LIBRARY) $(APIHEADER)
---
> installlib: $(LIBRARY) installinc
83c83
<       $(INSTALL_DATA) $(APIHEADER) $(includedir)
---
>       #$(INSTALL_DATA) $(APIHEADER) $(includedir)
84a85,89
> installinc: $(APIHEADER)
>       for exHeader in $(APIHEADER); do\
>               $(INSTALL_DATA) $${exHeader} $(includedir);\
>       done
>

Leave a Reply