Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Dec 2001 23:37:35 -0500
From:      Alan Eldridge <alane@geeksrus.net>
To:        "."@babolo.ru
Cc:        ports@FreeBSD.ORG
Subject:   Re: building as non-root
Message-ID:  <20011201233735.A26026@wwweasel.geeksrus.net>
In-Reply-To: <200112020344.GAA10704@aaz.links.ru>; from "."@babolo.ru on Sun, Dec 02, 2001 at 06:44:25AM %2B0300
References:  <20011201203004.A24482@wwweasel.geeksrus.net> <200112020344.GAA10704@aaz.links.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Overall, thanks for the input. It's appreciated.

On Sun, Dec 02, 2001 at 06:44:25AM +0300, "."@babolo.ru wrote:
>> The basic idea is this:
>> 
>> PREFIX=/usr/local
>> BUILDROOT=/usr/tmp/$PKGNAME-root
>IMHO better
>PREFIX=/usr/local
>TMPDIR?=<something[3]>
>BUILDROOT=${TMPDIR}/$PKGNAME-root
>and name BUILDROOT is not exact
>Why different BUILDROOT for each package
>by default?

Ports do collide on file names. Also, ability to generate file list
by find DESTDIR.

BUILDROOT is Redhat's name. After 2-3 years, it's stuck for me. And it
makes sense: it is "logical ROOT" for the build/install. INSTALLROOT might
be more accurate, but ... names don't matter at this point.

You'd use TMPDIR or whatever else the user chose. RPM has a var called
_tmppath. Again, it's just an example. :)

>> or (2):
>> make PREFIX=$BUILDROOT$PREFIX install
>Not this way

Well, packages that don't support DESTDIR will still often let you
lie to them this way.

>> We can get an install tarball by:
>> cd $BUILDROOT
>> tar zcvf $PACKAGEDIR/$PKGNAME.tar.gz .
>> 
>> Yes, this occasionally backfires. Libtool can be most uncooperative in this
>> respect, as it may insist on relinking things (and worse, on some platforms,
>> putting in a runpath with -rpath) during that install step when you're lying
>> about your true destination. Interpackage dependencies can be a PITA when
>> building like this[2].
>> 
>> For a lot of packages, though, this works quite well. In fact, for *most*
>> packages, this general procedure works. Redhat's RPM is based on this
>> installation method, for example.
>> 
>> What I don't see, and maybe I just haven't looked in the right places, is a
>> framework in the BSD makefiles that support this kind of build and install.
>> 
>> If there's something in there that supports this kind of "fake root" build
>> and install, I'd like to know what variables and make targets to look for.
>There no need for "fake root" build
>(do you want to use "fake root" built package with a real root?)

Implied precedence => (fake-root)(build-and-install) where it's understood
that in the (build-and-install) only the 'install' part cares about the
fake-root.

>but there is some support for "fake root" install:
>grep DESTDIR *
>bsd.port.mk:LOCALBASE?=         ${DESTDIR}/usr/local
>bsd.port.mk:X11BASE?=           ${DESTDIR}/usr/X11R6
>bsd.port.mk:LINUXBASE?=         ${DESTDIR}/compat/linux

Hmm. That may be a damn good start.


>
>but it is not right.
>Example (TMPDIR=/tmp/babolo):
>
>1cicuta/usr/ports/sysutils/pib(4)>make DESTDIR=$TMPDIR install FORCE_PKG_REGISTER=yes
>===>  Installing for pib-1.2
>===>   pib-1.2 depends on executable: wish8.2 - found
>Warning: not superuser, you may get some errors during installation.
>Warning: not superuser, can't run mtree.
>You may want to become root and try again to ensure correct permissions.
>/bin/mkdir -p /tmp/babolo/usr/local/lib/pib
>install -c -o root -g wheel -m 555 /tmp/babolo/usr/ports/sysutils/pib/work/pib-1.2/*.tcl /tmp/babolo/usr/local/lib/pib
>install: /tmp/babolo/usr/local/lib/pib/pib.tcl: chown/chgrp: Operation not permitted

Urrrgh. I really don't like installs that do that. That's metadata that can
be applied at the "real" install just as well. 

What's more problematic is installs that want to make device nodes. 

>/bin/ln -fs /tmp/babolo/usr/local/lib/pib/pib.tcl /tmp/babolo/usr/local/bin/pib
>------------^^^^^^^^^^^^
>===>   Generating temporary packing list
>===>   Registering installation for pib-1.2
>-------^^^^^^^^^^^
>0cicuta/usr/ports/sysutils/pib(2)#l /tmp/babolo/usr/local/bin/pib
>0 lrwxr-xr-x  1 root  wheel  37  2 dek 06:02 /tmp/babolo/usr/local/bin/pib@ -> /tmp/babolo/usr/local/lib/pib/pib.tcl
>0cicuta/usr/ports/sysutils/pib(3)#
>
>I do not know, what to do with "Operation not permitted" with
>install whithout root privileges

Debian's got a program called fakeroot that allows the install to think
these sorts of things have gone ok. Should make a port if there isn't one
already.

That 'registering' bit is really problematic though. I think there's a flag
to turn it off, which you'd want if your only objective is to make a package.

There's a target to make a package w/o installing, but I haven't had much 
success on that front.

>I'd like this functionality.
>For another aims.
>I do a lot of build/install for jails.

Ahh, so you can do a 'make install' right into the jail. 

>I use original /usr/ports, nfs mount read only from /usr/ports server.
>With strings
>PACKAGES=${TMPDIR}
>WRKDIRPREFIX=${TMPDIR}
>MAKEOBJDIRPREFIX=${TMPDIR}
>in my /etc/make.conf it works as need for me
>exept about 2 broken ports puts Makefile.inc
>in ports source tree instead of build tree.
>and about 4 ports need
>
>TMPDIR?=       ${WRKDIR}/tmp
>
>change for
>
>TMPDIR=       ${WRKDIR}/tmp
>
>or similar

Thanks. That's a good bit of info.

-- 
Alan Eldridge
#include <cstdlib>
free(sklyarov);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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