Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 2008 04:47:48 +0530
From:      wahjava.ml@gmail.com (Ashish Shukla =?utf-8?B?4KSG4KS24KWA4KS3IA==?= =?utf-8?B?4KS24KWB4KSV4KWN4KSy?=)
To:        Dmitry Marakasov <amdmi3@amdmi3.ru>
Cc:        FreeBSD Ports Mailing List <freebsd-ports@freebsd.org>
Subject:   Re: [PROPOSAL] Ports using SCM repositories as source instead of distfiles
Message-ID:  <87vdtrhb6r.fsf@chateau.d.lf>
In-Reply-To: <20081210223522.GA6367@hades.panopticon> (Dmitry Marakasov's message of "Thu, 11 Dec 2008 01:35:22 %2B0300")
References:  <87fxkxjywk.fsf@chateau.d.lf> <20081209143052.GA29817@hades.panopticon> <873agxjn1x.fsf@chateau.d.lf> <20081209181354.GB29817@hades.panopticon> <87tz9di38u.fsf@chateau.d.lf> <20081209222042.GC29817@hades.panopticon> <8763lsi10m.fsf@chateau.d.lf> <20081210181125.GA86341@hades.panopticon> <87zlj3heor.fsf@chateau.d.lf> <20081210223522.GA6367@hades.panopticon>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Transfer-Encoding: quoted-printable

Dmitry Marakasov writes:

[snip]

> --- Makefile
> PREFIX?=3D	/usr/local
> DATADIR?=3D	${PREFIX}/share/foo

> all: foo

> foo: foo.c
> 	cc -DDATAFILE=3D\"${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=3D/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=3D${LOCALBASE} <...and other configure options ...>

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

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

This will install all files into DESTDIR=3D/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...=20
| ...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
=2D-=20
Ashish Shukla

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAklATiEACgkQHy+EEHYuXnThEQCg0j5xVgU1unZTypWrQBTiai4/
JnIAoPI4nBnlB33Ybe/LnKDGSi6XgDC+
=C5pS
-----END PGP SIGNATURE-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87vdtrhb6r.fsf>