[PROPOSAL] Ports using SCM repositories as source instead of distfiles

Dmitry Marakasov amdmi3 at amdmi3.ru
Wed Dec 10 14:35:46 PST 2008


* Ashish Shukla आशीष शुक्ल (wahjava.ml at gmail.com) wrote:

> > How do you expect all ports to respect DESTDIR in their Makefiles,
> > while many ports don't even use make? As I've said, that will require
> > tremendous amount of hacking and is not even possible sometimes.
> 
> How about adding a variable like REQUIRES_DYNAMIC_INSTALLATION=yes,
> which will then generate a plist on the basis of "/var/tmp/${PORTNAME}",
> so now it is the port's responsibility to install all contents to
> "/var/tmp/${PORTNAME}" either by "make install DESTDIR=..." or by some
> other way. Having that REQUIRES_DYNAMIC_INSTALLATION also includes a
> 'post-install' target which will copy all files from
> /var/tmp/${PORTNAME} to ${PREFIX}.

You do not understand the basic thing. The PROBLEM is to make all ports
install into one dir, but be runnable from another. As simple as that.

Imagine a software like that:

--- foo.c
#include <stdlib.h>

int main() {
	return system("cat "DATAFILE);
}
--- datafile.dat
Hello, world!
--- Makefile
PREFIX?=	/usr/local
DATADIR?=	${PREFIX}/share/foo

all: foo

foo: foo.c
	cc -DDATAFILE=\"${DATADIR}/datafile.dat\" foo.c -o foo

install: foo datafile.dat
	install -s foo ${PREFIX}/bin
	install -d ${DATADIR}
	install datafile.dat ${DATADIR}
---

As you can see, if this is installed with PREFIX=/var/tmp/foobar,
then moved to /usr and ran, it won't work, as it has DATAFILE
compiled in as "/var/tmp/foobar/share/foo/datafile.dat" instead of
"/usr/local/share/foo/datafile.dat".

To make it behave as we indend, you'll have to either hack Makefile
to distinguish DESTDIR and PREFIX, or do all installation in port's
Makefile by yourself.

We have around 20k ports, and it will be extremely hard task to
convert them all to such scheme (though afaik configure-based ones
should support this without modifications). The example above is
quite simple, the real life can be much more ugly, I assure. The
worst thing is that we won't be able to test ports automatically,
as the fact the port builds and installs successfully won't mean
that it will run without problems.

I wonder how debian and gentoo get around this problem...

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3 at amdmi3.ru  ..:  jabber: amdmi3 at jabber.ru    http://www.amdmi3.ru


More information about the freebsd-ports mailing list