PREFIX "cleverness"

Brandon D. Valentine brandon at dvalentine.com
Thu Sep 2 17:34:43 PDT 2004


On Thu, Sep 02, 2004 at 11:17:30AM -0700, Brooks Davis wrote:
> Due to the hardcoding of LOCALBASE in dependencies, I think you will
> have a hard time getting this sort of thing to work with ports unless
> you also create a symlink farm and point LOCALBASE to it.  You might
> actually consider using NetBSD's pkgsrc.  It has a lot less packages,
> but is supports installations of many current packages in a more xhier
> compatable fasion using the pkgviews concept.

Mike,

Brooks is right, NetBSD pkgsrc is far better suited to this than FreeBSD
ports at present.  But, pkgsrc has far fewer packages than ports, so
there's a definite advantage to using ports if you can.  There are ways
to do this using ports, but it will require a fair bit of "cleverness"
on your part.

If you want to use the ports system an approach to consider is a port
building wrapper that does something along the lines of the following
quick hack (in csh because I'm quicker at prototyping in csh than sh):

  ### quick and dirty porthier script...
  ### usage: porthier portpath
  ### i.e. porthier /usr/ports/multimedia/xmms
  ###
  ### uses the full path because I'm lazy and don't want to muck about
  ### with finding the pkgorigin to recursively call this script

  # check for installed run-deps under /software
  # we'll let ports take care of the build-deps in LOCALBASE
  set deplist = `make -C $1 run-depends-list`
  foreach dep ($deplist)
    set depname = `make -C $dep -V UNIQUENAME`
    if (! -e /software/$depname) exec $0 $dep
  end

  # make symlink farm
  # we put this into a seperate loop as we don't want the symlink
  # cleanup from a dependency install to wipe out symlinks we may need
  cd /usr/local
  foreach dep ($deplist)
    set depname = `make -C $dep -V UNIQUENAME`
    /usr/src/contrib/binutils/symlink-tree /software/$depname
  end

  # let's get our install on
  set pname = `make -C $1 -V UNIQUENAME`
  make -C $1 PREFIX=/software/$pname install clean

  # clean up them links
  foreach dep ($deplist)
    set depname = `make -C $dep -V UNIQUENAME`
    cd /software/$depname && find -d . f -exec rm -d "/usr/local/{}" \;
  end

Consider that under the BSD license, particularly the giant all caps
disclaimer that says I'm not responsible for any of it, because it's
probably crap and I've not tested it.  It *should*, maybe _mostly_ work,
kinda.  Feel free to shit all over it if you think it's horribly broken.

You'd obviously want to add a ton more error checking, perhaps some
argument list processing so it'll accept more than one argument, etc.
but that should be enough for you to get the idea.  The key is to
automate management (both creation and deletion) of the symlink farm
you're going to need under /usr/local.  I also don't know enough about
xhier to know how much automagic is involved in setting up the user
shell environment, but I would assume you're doing the appropriate ld
hackery to make sure shared libraries work under this /software scheme.
Also, beware the duplicate LATEST_LINK/UNIQUENAMEs still in the tree.

Alternately, just use NetBSD pkgsrc and pkgviews.  It works quite well
on FreeBSD.

HTH,

Brandon D. Valentine
-- 
brandon at dvalentine.com                           http://www.geekpunk.net
Pseudo-Random Googlism:  presidency is ending in triumph after
                         successfully negotiating the terms of entry for
                         10 candidate members


More information about the freebsd-ports mailing list