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

Ashish Shukla आशीष शुक्ल wahjava.ml at gmail.com
Wed Dec 10 15:16:06 PST 2008


Dmitry Marakasov writes:

[snip]

> --- 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}

# Above statements should be changed to:
    install -s foo ${DESTDIR}${PREFIX}/bin
    install -d  ${DESTDIR}${DATADIR}
    install datafile.dat ${DESTDIR}${DATADIR}

> ---

In above case the package list can be created with:

$ find ${DESTDIR} -type f |sed -e "s[${DESTDIR}${PREFIX}/[[g"

> 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...

I understood what you're trying to say, but you're missing my point, so
I'm explaining it in the following example:

,---- Quoting from my earlier example
| % sudo make -C /usr/ports/editors/emacs-cvs install
| ...checkout from CVS...
| ...configuring...
| ./configure --prefix=${LOCALBASE} <...and other configure options ...>

That will compile Emacs with PREFIX=${LOCALBASE} (which is /usr/local
by default)

| ...configuration messages...
| ...compilation begins...
| make
| ...compiling the files...
| ...compilation over...
| make install DESTDIR=/var/tmp/emacs

This will install all files into DESTDIR=/var/tmp/emacs, with directory
structure similar to following:

/var/tmp/emacs
              /usr/local/bin/emacs
              /usr/local/share/emacs/23.0.60/...

etc.

| ...files being copied to /var/tmp/emacs directory...
| ...package list creation...
| ...package list finished... 
| ...copying files into ${LOCALBASE}...

And finally this will copy all files present in /var/tmp/emacs to
${LOCALBASE} for final installation with package we recorded earlier.

| ...end copying files...
| ...package installed successfully...
`----

This is what Debian and Gentoo does. Remember we don't have to pass
DESTDIR variable to 'make -C /usr/ports/editors/emacs-cvs' instead it
will be passed to the 'gmake' process invoked by port's Makefile. If we
pass DESTDIR to port's commandline, then it will install all
dependencies in that chroot which is not desired, we simply care about
the files installed by that port. Since there're already 20,000 ports we
can't do it by default, so we've to hack some knob (like
REQUIRES_DYNAMIC_INSTALLATION) which if defined will enable this
behaviour.

Following are some links:

Debian's New Maintainer's Guide
http://www.debian.org/doc/maint-guide/ch-modify.en.html#s-destdir

Gentoo's Ebuild Quickstart Guide
http://devmanual.gentoo.org/quickstart/index.html

I hope I'm clear now.

Thanks
-- 
Ashish Shukla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20081210/0d4989c0/attachment.pgp


More information about the freebsd-ports mailing list