forked from nightingale-media-player/nightingale-hacking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·173 lines (147 loc) · 5.38 KB
/
build.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
#!/bin/bash
# break on any error
set -e
# do a debug or a release build? YOU WANT RELEASE!
# if you do a debug build, add the appropriate options
# to your nightingale.config file!
build="release"
buildir="$(pwd)"
version=xul9.0.1
download() {
if which wget &>/dev/null ; then
wget "$1"
elif which curl &>/dev/null ; then
curl --location -o "${1##*/}" "$1"
else
echo "Failed to find downloader to fetch $1" >&2
exit 1
fi
}
md5_verify() {
md5_fail() {
echo "-------------------------------------------------------------------------------"
echo "WARNING: MD5 checksum verification failed: $1"
echo "It is a safety risk to continue unless you know exactly what you're doing."
echo "Answer no to delete it and retry the build process, or yes to continue anyway."
read -p "Continue? (y/n) [n]" ans
case $ans in
"y" | "Y")
echo "Checksum ignored."
;;
"n" | "N" | "")
rm "$1"
exit 1
;;
*)
echo "Invalid input."
md5_fail $1
;;
esac
}
if [ $depdirn = "macosx-i686" ] ; then
md5 -r "$1"|grep -q -f "$1.md5" || md5_fail "$1"
else
md5sum -c --status "$1.md5" || md5_fail "$1"
fi
}
# Check for the build deps for the system's architecture and OS
case $OSTYPE in
linux*)
case "$(uname -m)" in
*64*) arch=x86_64 ;;
*86) arch=i686 ;;
*) echo "Unknown arch" >&2 ; exit 1 ;;
esac
depdirn="linux-$arch"
#if you have a dep built on a differing date for either arch, just use a conditional to set this
if [ "$arch" = "i686" ] ; then
depdate=20140302
else
depdate=20140214
fi
#export CXXFLAGS="-O2 -fomit-frame-pointer -pipe -fpermissive"
echo "linux $arch"
( cd dependencies && {
if [ ! -d "$depdirn" ] ; then
if [ ! -f "$depdirn-$version-$depdate.tar.bz2" ] ; then
download "http://downloads.sourceforge.net/project/ngale/$version-Build-Deps/$depdirn/$depdirn-$version-$depdate.tar.bz2"
download "http://downloads.sourceforge.net/project/ngale/$version-Build-Deps/$depdirn/$depdirn-$version-$depdate.tar.bz2.md5"
md5_verify "$depdirn-$version-$depdate.tar.bz2"
fi
tar xvf "$depdirn-$version-$depdate.tar.bz2"
fi
} ; )
# the below needs to be nested...in my testing it won't work otherwise
if [[ $(egrep -i 'Ubuntu|Debian' /etc/issue) ]]; then
grep -q -E 'gstreamer' nightingale.config || echo -e 'ac_add_options --with-media-core=gstreamer\n' >> nightingale.config
grep -q -E 'taglib' nightingale.config || echo -e 'ac_add_options --with-taglib-source=packaged\n' >> nightingale.config
fi
;;
msys*)
depdirn="windows-i686"
depdate=20140404
msvcver="msvc10"
# Ensure line endings, as git might have converted them
tr -d '\r' < ./components/library/localdatabase/content/schema.sql > tmp.sql
rm ./components/library/localdatabase/content/schema.sql
mv tmp.sql ./components/library/localdatabase/content/schema.sql
cd dependencies
if [ ! -f "$depdirn-$version-$msvcver-$depdate.tar.bz2" ] ; then
$DOWNLOADER "http://downloads.sourceforge.net/project/ngale/$version-Build-Deps/$depdirn/$depdirn-$version-$msvcver-$depdate.tar.bz2"
$DOWNLOADER "http://downloads.sourceforge.net/project/ngale/$version-Build-Deps/$depdirn/$depdirn-$version-$msvcver-$depdate.tar.bz2.md5"
md5_verify "$depdirn-$version-$msvcver-$depdate.tar.bz2"
fi
if [ ! -d "$depdirn" ] ; then
mkdir "$depdirn"
tar -jxvf "$depdirn-$version-$msvcver-$depdate.tar.bz2" -C "$depdirn"
fi
cd ../
;;
darwin*)
# no wget on OSX, use curl
DOWNLOADER="curl -L -O"
depdirn="macosx-i686"
depdate=20140324
arch_flags="-m32 -arch i386"
export CFLAGS="$arch_flags"
export CXXFLAGS="$arch_flags"
export CPPFLAGS="$arch_flags"
export LDFLAGS="$arch_flags"
export OBJCFLAGS="$arch_flags"
echo 'ac_add_options --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk' > nightingale.config
echo 'ac_add_options --enable-installer' >> nightingale.config
echo 'ac_add_options --enable-official' >> nightingale.config
echo 'ac_add_options --enable-compiler-environment-checks=no' >> nightingale.config
cd dependencies
if [ ! -f "$depdirn-$version-$depdate.tar.bz2" ] ; then
$DOWNLOADER "http://downloads.sourceforge.net/project/ngale/$version-Build-Deps/$depdirn/$depdirn-$version-$depdate.tar.bz2"
$DOWNLOADER "http://downloads.sourceforge.net/project/ngale/$version-Build-Deps/$depdirn/$depdirn-$version-$depdate.tar.bz2.md5"
md5_verify "$depdirn-$version-$depdate.tar.bz2"
fi
if [ ! -d "$depdirn" ] ; then
mkdir "$depdirn"
tar -jxvf "$depdirn-$version-$depdate.tar.bz2" -C "$depdirn"
fi
cd ../
;;
*)
echo "Can't find deps for $OSTYPE. You may need to build them yourself. Doublecheck the SVN's for \n
Nightingale trunk to be sure."
;;
esac
# # get the vendor build deps...
# cd dependencies
# if [ ! -f "vendor-$version.zip" ] ; then
# download "http://downloads.sourceforge.net/project/ngale/$version-Build-Deps/vendor-$version.zip"
# md5_verify "vendor-$version.zip"
# fi
# if [ ! -d "vendor" ] ; then
# rm -rf vendor &> /dev/null
# unzip "vendor-$version.zip"
# fi
cd ../
cd $buildir
make clobber
rm -rf compiled &> /dev/null #sometimes clobber doesn't nuke it all
make
echo "Build finished!"