Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: a311dab877
Fetching contributors…

Cannot retrieve contributors at this time

executable file 209 lines (175 sloc) 5.107 kB
#!/bin/sh
if [[ "$#" != "0" ]];
then
echo "usage: $0\n"
echo "Running this script does the following:"
echo " 1. Determine reasonable install locations, based on your OS."
echo " 2. Check that build dependencies are installed and available."
echo " 3. Check if any media backends are available. At least one"
echo " is required to run vitunes."
echo " 4. Builds a 'config.mk' file (used by Makefile) with the"
echo " above information."
exit 1
fi
###
### Determine install locations, based on the OS. The *BSD ones are OK, but
### I'm not certain what's best for Linux or OSX.
###
echo "DETERMINING INSTALL LOCATIONS..."
# default defaults
PREFIX="/usr/local"
# break based on OS
/bin/echo -n " Detecting OS... "
os=`uname`
case ${os} in
"FreeBSD"|"NetBSD"|"OpenBSD")
# no need to change prefix here
echo "Found ${os}."
echo " Setting install prefix to '${PREFIX}'."
;;
"Darwin")
# Should we set PREFIX to /usr here?
echo "Found Mac OS X (Darwin)."
echo " Setting install prefix to '${PREFIX}'."
;;
"Linux")
PREFIX="/usr"
echo "Found Linux."
echo " Setting install prefix to '${PREFIX}'."
;;
*)
echo "Unknown."
echo " Will set install prefix to '${PREFIX}'."
;;
esac
BINDIR="${PREFIX}/bin"
MANDIR="${PREFIX}/man/man1"
echo " When you run 'make install', parts of vitunes will be installed to"
echo " the following locations:"
echo " executable: ${BINDIR}"
echo " man-page: ${MANDIR}"
echo " If you wish to change these, edit the relevant variables in config.mk"
echo
###
### Detect build dependency: TagLib
###
/bin/echo -n "CHECKING BUILD DEPENDENCY: TagLib... "
HaveTaglib=0
# Prefer taglib-config, try that first
if [[ 0 -eq ${HaveTaglib} ]];
then
result=`which taglib-config > /dev/null 2>&1`
if [[ 0 -eq $? ]];
then
echo "FOUND (via taglib-config)"
HaveTaglib=1
TAGLIB_BLOCK="
# taglib library detected by taglib-config
TAGLIB_CFLAGS=\`taglib-config --cflags\`
TAGLIB_LDFLAGS=\`taglib-config --libs\` -ltag_c
"
fi
fi
# Try pkg-config
if [[ 0 -eq ${HaveTaglib} ]];
then
result=`which pkg-config > /dev/null 2>&1`
if [[ 0 -eq $? ]];
then
result=`pkg-config --exists taglib`
if [[ "$?" == "0" ]];
then
echo "FOUND (via pkg-config)"
HaveTaglib=1
TAGLIB_BLOCK="
# taglib library detected by pkg-config
TAGLIB_CFLAGS=\`pkg-config taglib --cflags\`
TAGLIB_LDFLAGS=\`pkg-config taglib --libs\` -ltag_c
"
fi
fi
fi
# No taglib. Alert but continue.
if [[ 0 -eq ${HaveTaglib} ]];
then
echo "NOT FOUND!"
echo " ERROR: TagLib must be installed to build vitunes."
echo " See TagLib website at http://taglib.github.com/ for source."
echo " Will continue with configuratio anyway..."
fi
echo
###
### Detect media backends (at least one should be available)
###
echo "CHECKING FOR MEDIA BACKENDS... "
HaveMediaBackend=0
# Check for mplayer
result=`which mplayer > /dev/null 2>&1`
if [[ 0 -eq $? ]];
then
HaveMediaBackend=1
echo " Found mplayer"
fi
# Check for gstreamer
gstreamer=gstreamer-0.10
result=`pkg-config --exists ${gstreamer} > /dev/null 2>&1`
if [[ 0 -eq $? ]];
then
HaveMediaBackend=1
echo " Found gstreamer"
GSTREAMER_BLOCK="
# gstreamer library (${gstreamer}) detected by pkg-config
GSTREAMER_CFLAGS =\`pkg-config ${gstreamer} --cflags\` -DENABLE_GSTREAMER
GSTREAMER_LDFLAGS =\`pkg-config ${gstreamer} --libs\`
GSTREAMER_OBJS = gstplayer.o
"
fi
# None found. Alert but continue.
if [[ 0 -eq ${HaveMediaBackend} ]];
then
echo " ERROR: No media backound found."
echo " In order for vitunes to play music, either mplayer or gstreamer"
echo " must be installed. You can install mplayer at any time and"
echo " vitunes will detect and use that. But to enable gstreamer support,"
echo " you must first install gstreamer, and then re-run this script."
fi
echo
###
### Begin building config.mk
###
echo "BUILDING config.mk..."
# backup any existing config
if [[ -f config.mk ]];
then
backup=config.mk.bak
echo " Backing up existing config.mk to ${backup}"
cp config.mk ${backup}
fi
# start writing
now=`date "+%Y-%m-%d at %H:%M:%S" 2> /dev/null`
cat > config.mk <<EOF
# This file was generated by the 'configure.sh' script on ${now}.
# Its contents should probably not be modified directly (if they should,
# please contact the vitunes developers and let them know why).
#
# Generated on: ${now}
# Run on OS: `uname -a`
# Install Locations
PREFIX?=${PREFIX}
BINDIR?=${BINDIR}
MANDIR?=${MANDIR}
# TagLib - These MUST be filled in for vitunes to compile!
${TAGLIB_BLOCK}
# gstreamer - Fill these in only if you want gstreamer support
${GSTREAMER_BLOCK}
# configure.sh output ending
EOF
# completed. provide some instructions.
echo
echo "COMPLETED: config.mk generated."
echo
echo "If there were no errors above, and you are satisfied with the install"
echo "locations listed above, then you should now be able to install vitunes"
echo "with:"
echo " $ make install"
echo "G'luck!"
Jump to Line
Something went wrong with that request. Please try again.