By Samat Jain
June 28, 2006 - 9:34am
A page in the Beyond Linux from Scratch manual describes environment variables that should be set when installing software in a non-traditional location (e.g. your home directory).
I've written a sh/bash include that can be included from .bashrc to set these variables, as well as PYTHON_PATH for separately installed Python libraries:
#!/bin/bash
PREFIX=$HOME/usr
export PATH="$PREFIX/bin:$PATH"
export PYTHONPATH="$PREFIX/lib/python2.4/site-packages:$PYTHON_PATH"
export MANPATH="$PREFIX/man:$MANPATH"
export INFOPATH="$PREFIX/info:$INFOPATH"
export LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export CPPFLAGS="-I$PREFIX/includes $CPPFLAGS"
export LDFLAGS="-L$PREFIX/lib $LDFLAGS"
Like this article? Please support my writing! Flattr my blog (see my thoughts on Flattr), tip me via PayPal, or send me an item from my Amazon wish list.
Want to see more of my writing? Subscribe to
Samat Says' RSS feed







Comments
Permalink Anonymous on October 25, 2006 - 3:12pm wrote…
The CPPFLAGS seems bogus to me: should be
export CPPFLAGS=-I$PREFIX/includes:$CPPFLAGSPermalink Anonymous on October 25, 2006 - 3:16pm wrote…
Oh and there’s also LDFLAGS; like CPPFLAGS, it’s unnecessary with libs that use pkg-config though.
export LDFLAGS="-L$PREFIX/lib $LDFLGAGS"Permalink Samat Jain on October 26, 2006 - 1:36pm wrote…
Thanks for noticing the error with CPPFLAGS!
I’ve also added LDFLAGS. I usually put non-system libraries I’m linking to in CPPFLAGS, but after a quick web search LDFLAGS seems more appropriate.