A quick shell include for setting paths for programs installed in non-traditional locations

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"

Comments

Anonymous Visitor's picture

Oh and there’s also

Oh and there’s also LDFLAGS; like CPPFLAGS, it’s unnecessary with libs that use pkg-config though. export LDFLAGS="-L$PREFIX/lib $LDFLGAGS"

Samat Jain's picture

CPPFLAGS fixed

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.

Anonymous Visitor's picture

The CPPFLAGS seems bogus to

The CPPFLAGS seems bogus to me: should be

export        CPPFLAGS=-I$PREFIX/includes:$CPPFLAGS