forked from ryanflannery/vitunes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·189 lines (157 loc) · 4.53 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/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
# Check for taglib
result=`which pkg-config > /dev/null 2>&1`
if [[ 0 -eq $? ]];
then
result=`pkg-config --exists taglib`
if [[ "$?" == "0" ]];
then
echo "FOUND"
HaveTaglib=1
TAGLIB_BLOCK="
# taglib library detected by pkg-config
TAGLIB_CFLAGS=\`pkg-config taglib --cflags\`
TAGLIB_LIBS=\`pkg-config taglib --libs\` -ltag_c
"
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_LIBS =\`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!"