linux question....

When built for Mac OS X, lldb builds as a “framework” which means it has a directory tree in which
various necessary additional resources can be put. In order to get the embedded Python scripting
stuff working, we have been putting the .py and .so files that in needs into a Resources subdirectory of
the lldb.framework.

I’m trying to rewrite the build scripts to be OS-agnostic (or at least to work ok on Linux). I am pretty sure
a Linux-built lldb will not be a “framework”, and I now have no idea where I should put the associated .py
and .so files for lldb. I would appreciate suggestions/help from someone more familiar with how this kind
of stuff should work on Linux.

– Caroline Tice
ctice@apple.com

<snip>

I'm trying to rewrite the build scripts to be OS-agnostic (or at least
to work ok on Linux). I am pretty sure
a Linux-built lldb will not be a "framework", and I now have no idea
where I should put the associated .py
and .so files for lldb. I would appreciate suggestions/help from
someone more familiar with how this kind
of stuff should work on Linux.

Well, the best way if you can manage it is to ask Python to install it
for you; no one will know better where it belongs.

That said, I have a project to hand which installs some Python bindings;
here follow some bits of its makefile from which you should be able to
infer what it does. Disclaimer: This project is not widely distributed
or tested, and I've tweaked the rules slightly to make them easier to
understand, so no guarantee it really does the right thing. Also, I
suspect it would be polite to install things in a subdirectory of
site-packages, rather than dumping them at the top level like this.

PYLIBDIR := $(PREFIX)/lib/python$(PYTHON_VERSION)/site-packages

install: $(LIBRARIES)
  install -d $(PYLIBDIR)
  install $(PY_FILES) $(PYLIBDIR)
  libtool --mode=install --tag=disable-static \
    install -m644 $(LIBRARIES) $(PYLIBDIR)

There are of course lots of other projects in the same boat; you might
well be able to find a more appropriate one to mimic.

John Bytheway

The final installed version of something like this would normally put
the .so files into $PREFIX/lib/, and the .py files into either
$PREFIX/lib/lldb (if the user wouldn't normally run them directly) or
into $PREFIX/bin (if they should be in the $PATH). If your just
wondering where to put output files, though, it would be most
convenient to just compute the paths in the build system and pass them
as arguments to the scripts.

-Eli

When built for Mac OS X, lldb builds as a “framework” which means it has a
directory tree in which
various necessary additional resources can be put. In order to get the
embedded Python scripting
stuff working, we have been putting the .py and .so files that in needs into
a Resources subdirectory of
the lldb.framework.

I’m trying to rewrite the build scripts to be OS-agnostic (or at least to
work ok on Linux). I am pretty sure
a Linux-built lldb will not be a “framework”, and I now have no idea where I
should put the associated .py
and .so files for lldb. I would appreciate suggestions/help from someone
more familiar with how this kind
of stuff should work on Linux.

I’m a little rusty, but I think you want something like the following for the python files (.py and .so):

export MODULE_NAME=lldb

target a specific version

export PY_VERSION=2.6

-or-

#export PY_VERSION=python -c "import platform; print platform.python_version().rsplit('.', 1)[0]"

install into:

mkdir -p $(python$PY_VERSION-config --prefix)/lib/python$PY_VERSION/site-packages/$MODULE_NAME

I know autotools has macros for this, and it may be different for Fedora/Red Hat machines. But, this should most likely be passed in from the build system (as Eli says)

yours,
Bobby