-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup-music
executable file
·170 lines (135 loc) · 4.45 KB
/
setup-music
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
#!/usr/bin/env bash
set -e
get_latest_reposiotry() {
local repo_uri="${1}"
local repo_dir="${2}"
echo "Repository URI: ${repo_uri}"
if [[ ! -d "${repo_dir}" ]]; then
echo "Cloning repository..."
mkdir -p `dirname ${repo_dir}`
git clone --quiet --depth 10 "${repo_uri}" "${repo_dir}"
pushd "${repo_dir}" >/dev/null
else
echo "Pulling latest commits..."
pushd "${repo_dir}" >/dev/null
git pull
fi
popd >/dev/null
}
link_binary() {
local -r name="${1}"
echo "Setting up binary: ${name}"
sudo ln -nsf "${HOME}/.local/bin/${name}" "/usr/local/bin/${name}"
}
prepare_directories() {
local -r name="${1}"
local -r data_dir="${HOME}/.local/share/${name}"
echo "Preparing directories..."
mkdir -p "${data_dir}"
}
setup_python_package() {
local package_name="${1}"
if test "$(pyenv version-name | cut -d'.' -f1)" != "3"; then
echo "Python 3 is required!"
exit 1
fi
echo "Installing Python package: ${package_name}"
pip install --quiet ${package_name}
}
setup_mpd() {
echo
echo "=================="
echo "= MPD ="
echo "=================="
echo
get_latest_reposiotry "https://github.com/MusicPlayerDaemon/MPD" "${HOME}/Dev/github/MusicPlayerDaemon/MPD"
pushd "${HOME}/Dev/github/MusicPlayerDaemon/MPD" >/dev/null
echo "Installing dependencies..."
setup_python_package meson
sudo apt install --quiet --yes build-essential cmake libadplug-dev libao-dev libaudiofile-dev libavahi-client-dev libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libboost-dev libbz2-dev libcdio-paranoia-dev libchromaprint-dev libcurl4-gnutls-dev libexpat1-dev libfaad-dev libflac-dev libfluidsynth-dev libgme-dev libicu-dev libid3tag0-dev libiso9660-dev libjack-dev libmad0-dev libmikmod-dev libmms-dev libmodplug-dev libmp3lame-dev libmpcdec-dev libmpdclient-dev libmpg123-dev libnfs-dev libogg-dev libopenal-dev libopus-dev libpulse-dev libsamplerate0-dev libshine-dev libshout3-dev libsidplayfp-dev libsmbclient-dev libsndfile1-dev libsndio-dev libsoxr-dev libsqlite3-dev libtwolame-dev libupnp-dev libvorbis-dev libwavpack-dev libwildmidi-dev libyajl-dev libzzip-dev ninja-build pkg-config
echo "Running build..."
meson ./ ./output --buildtype=release
meson configure --prefix="${HOME}/.local" ./output
ninja -C ./output
echo "Installing..."
ninja -C ./output install
prepare_directories "mpd"
link_binary "mpd"
}
setup_mpc() {
echo
echo "=================="
echo "= MPC ="
echo "=================="
echo
get_latest_reposiotry "https://github.com/MusicPlayerDaemon/mpc" "${HOME}/Dev/github/MusicPlayerDaemon/mpc"
pushd "${HOME}/Dev/github/MusicPlayerDaemon/mpc" >/dev/null
echo "Installing dependencies..."
setup_python_package meson
setup_python_package sphinx
sudo apt install --quiet --yes build-essential
echo "Running build..."
meson ./ ./output --buildtype=release
meson configure --prefix="${HOME}/.local" ./output
ninja -C ./output
echo "Installing..."
ninja -C ./output install
link_binary "mpc"
}
setup_mpdscribble() {
echo
echo "=================="
echo "= MPDScribble ="
echo "=================="
echo
get_latest_reposiotry "https://github.com/MusicPlayerDaemon/mpdscribble" "${HOME}/Dev/github/MusicPlayerDaemon/mpdscribble"
pushd "${HOME}/Dev/github/MusicPlayerDaemon/mpdscribble" >/dev/null
echo "Installing dependencies..."
setup_python_package meson
sudo apt install --quiet --yes build-essential libgcrypt20-dev libmpdclient-dev pkg-config
echo "Running build..."
meson ./ ./output --buildtype=release
meson configure --prefix="${HOME}/.local" ./output
ninja -C ./output
echo "Installing..."
ninja -C ./output install
prepare_directories "mpdscribble"
link_binary "mpdscribble"
}
setup_ncmpcpp() {
echo
echo "=================="
echo "= NCMPCPP ="
echo "=================="
echo
echo "Installing system package..."
sudo apt install --quiet --yes ncmpcpp
prepare_directories "ncmpcpp"
}
setup_music_binary() {
echo
echo "=================="
echo "= music-terminal ="
echo "=================="
echo
local music_binary_path="${HOME}/.local/bin/music-terminal"
link_binary "music-terminal"
}
if [[ $OSTYPE = darwin* ]]; then
brew_bundle() {
echo "$brewfile" | brew bundle --no-lock --file=-
}
brewfile='
brew "mpd"
brew "mpc"
brew "mpdscribble"
brew "ncmpcpp"
'
brew_bundle
else
setup_mpd
setup_mpc
setup_mpdscribble
setup_ncmpcpp
setup_music_binary
fi