setup.py: Add LIBGIT2_LIB to override the library search path

I build libgit2 in a `build/` subdirectory of a Git checkout, and
never bother installing it.  I'd like to link pygit2 against it there,
but LIBGIT2 assumes libgit2.so will be in the default library search
path or $LIBGIT/lib.  This patch adds LIBGIT2_LIB, a new environment
variable for overriding the additional library search paths.

An alternative to this patch is to set LDFLAGS="-L..." explicitly
before building pygit2.  I've avoided that approach here minimize the
difference between configuring this library path explicitly, and
configuring implicitly via LIBGIT2.
This commit is contained in:
W. Trevor King 2012-12-13 08:18:36 -05:00
parent ca2c0d75c5
commit 0acb7df564

@ -56,7 +56,7 @@ if libgit2_path is None:
libgit2_bin = os.path.join(libgit2_path, 'bin')
libgit2_include = os.path.join(libgit2_path, 'include')
libgit2_lib = os.path.join(libgit2_path, 'lib')
libgit2_lib = os.getenv('LIBGIT2_LIB', os.path.join(libgit2_path, 'lib'))
pygit2_exts = [os.path.join('src', 'pygit2.c')] + [
os.path.join('src', 'pygit2', entry)
for entry in os.listdir('src/pygit2')