Last active
August 29, 2015 13:57
-
-
Save RichardBarrell/9662785 to your computer and use it in GitHub Desktop.
Bourne shell function for adding things to linking, include, etc, paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "cpath_env $DIRECTORY" sets paths appropriately for making gcc+autoconf | |
# pick up C libraries installed with ./configure --prefix $DIRECTORY. | |
# example: | |
# cd /tmp | |
# tar xf ~/libfoo.tar.gz | |
# cd libfoo | |
# ./configure --prefix=$HOME/stuff | |
# make && make install | |
# cpath_env $HOME/stuff | |
# cd /tmp | |
# tar xf ~/thing-that-needs-libfoo.tar.gz | |
# cd thing-that-needs-libfoo | |
# make && make install | |
# thing-that-needs-libfoo | |
function cpath_env(){ | |
function extend_colon(){ | |
eval 'echo "${'$1':+:${'$1'}}"' | |
} | |
export PATH="$1/sbin:$1/bin$(extend_colon PATH)" | |
export MANPATH="$1/share/man$(extend_colon MANPATH)" | |
export LD_LIBRARY_PATH="$1/lib$(extend_colon LD_LIBRARY_PATH)" | |
export LIBRARY_PATH="$1/lib$(extend_colon LIBRARY_PATH)" | |
export CPATH="$1/include$(extend_colon CPATH)" | |
export C_INCLUDE_PATH="$1/include$(extend_colon C_INCLUDE_PATH)" | |
export PKG_CONFIG_PATH="$1/lib/pkgconfig$(extend_colon PKG_CONFIG_PATH)" | |
export INFOPATH="$1/share/info$(extend_colon INFOPATH)" | |
# Pity it isn't just locally scoped. | |
unset -f extend_colon | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment