1*58e6ee5fSAndroid Build Coastguard Worker#!/bin/bash 2*58e6ee5fSAndroid Build Coastguard Worker 3*58e6ee5fSAndroid Build Coastguard Workerif [ -z "$INSTALL_PATH" ]; then 4*58e6ee5fSAndroid Build Coastguard Worker echo 5*58e6ee5fSAndroid Build Coastguard Worker echo 'Error: No $INSTALL_PATH defined' 6*58e6ee5fSAndroid Build Coastguard Worker echo 7*58e6ee5fSAndroid Build Coastguard Worker echo " usage: [PREFIX=prefix][BUILD_PATH=/path/to/build] INSTALL_PATH=/path/to/install make-trace-cmd.sh install|install_libs|clean|uninstall" 8*58e6ee5fSAndroid Build Coastguard Worker echo 9*58e6ee5fSAndroid Build Coastguard Worker echo " Used to create a self contained directory to copy to other machines." 10*58e6ee5fSAndroid Build Coastguard Worker echo 11*58e6ee5fSAndroid Build Coastguard Worker echo " Please read PACKAGING for more information." 12*58e6ee5fSAndroid Build Coastguard Worker echo 13*58e6ee5fSAndroid Build Coastguard Worker exit 14*58e6ee5fSAndroid Build Coastguard Workerfi 15*58e6ee5fSAndroid Build Coastguard Worker 16*58e6ee5fSAndroid Build Coastguard Workerif [ ! -d $INSTALL_PATH ]; then 17*58e6ee5fSAndroid Build Coastguard Worker mkdir $INSTALL_PATH 18*58e6ee5fSAndroid Build Coastguard Workerfi 19*58e6ee5fSAndroid Build Coastguard Worker 20*58e6ee5fSAndroid Build Coastguard Workerif [ ! -z "$BUILD_PATH" ]; then 21*58e6ee5fSAndroid Build Coastguard Worker if [ ! -d $BUILD_PATH ]; then 22*58e6ee5fSAndroid Build Coastguard Worker mkdir $BUILD_PATH 23*58e6ee5fSAndroid Build Coastguard Worker fi 24*58e6ee5fSAndroid Build Coastguard Worker O_PATH="O=$BUILD_PATH" 25*58e6ee5fSAndroid Build Coastguard Workerfi 26*58e6ee5fSAndroid Build Coastguard Worker 27*58e6ee5fSAndroid Build Coastguard Workerif [ -z "$PREFIX" ]; then 28*58e6ee5fSAndroid Build Coastguard Worker PREFIX="/usr" 29*58e6ee5fSAndroid Build Coastguard Workerfi 30*58e6ee5fSAndroid Build Coastguard Worker 31*58e6ee5fSAndroid Build Coastguard WorkerPKG_PATH=`pkg-config --variable pc_path pkg-config | tr ":" " " | cut -d' ' -f1` 32*58e6ee5fSAndroid Build Coastguard Worker 33*58e6ee5fSAndroid Build Coastguard WorkerWITH_PATH="" 34*58e6ee5fSAndroid Build Coastguard Worker# If pkg-config supports --with-path, use that as well 35*58e6ee5fSAndroid Build Coastguard Workerif pkg-config --with-path=/tmp --variable pc_path pkg-config &> /dev/null ; then 36*58e6ee5fSAndroid Build Coastguard Worker WITH_PATH="--with-path=$INSTALL_PATH$PKG_PATH" 37*58e6ee5fSAndroid Build Coastguard Workerfi 38*58e6ee5fSAndroid Build Coastguard Worker 39*58e6ee5fSAndroid Build Coastguard WorkerPKG_CONFIG_PATH="$INSTALL_PATH/$PKG_PATH" PKG_CONFIG="pkg-config $WITH_PATH --define-variable=prefix=$INSTALL_PATH/$PREFIX" CFLAGS="-g -Wall -I$INSTALL_PATH/$PREFIX/include" make DESTDIR=$INSTALL_PATH $O_PATH prefix=$PREFIX $@ 40