-
Notifications
You must be signed in to change notification settings - Fork 64
/
configure_build.sh
executable file
·93 lines (80 loc) · 2.24 KB
/
configure_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
#!/bin/bash
# configure_build.sh
#
# Attempt to auto-detect the underlying Linux distribution and configure
# the build accordingly.
#
# (C) Copyright 2002-2023 Fred Gleason <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
function CheckDistroType () {
if [[ "$ID" == *"$1"* ]]; then
return 0
fi
if [[ "$ID_LIKE" == *"$1"* ]]; then
return 0
fi
return 1
}
function GetDistroType () {
CheckDistroType "rhel"
if [[ $? -eq 0 ]]; then
DISTRO_TYPE="rhel"
return 0
fi
CheckDistroType "ubuntu"
if [[ $? -eq 0 ]]; then
DISTRO_TYPE="ubuntu"
return 0
fi
CheckDistroType "debian"
if [[ $? -eq 0 ]]; then
DISTRO_TYPE="debian"
return 0
fi
}
function GetDistroId () {
local VERSION_ARRAY
IFS='.' read -ra VERSION_ARRAY <<< $VERSION_ID
DISTRO_ID=${VERSION_ARRAY[0]}
}
#
# Attempt to detect the distribution
#
. /etc/os-release
GetDistroType
GetDistroId
if [ -z $DISTRO_TYPE ]; then
echo "unrecognized distro"
exit 1
fi
case $DISTRO_TYPE in
debian)
export MUSICBRAINZ_LIBS="-ldiscid -lmusicbrainz5cc -lcoverartcc"
CONFIGURE="./configure --prefix=/usr --libdir=/usr/lib --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-enabled $@"
;;
rhel)
CONFIGURE="./configure --prefix=/usr --libdir=/usr/lib64 --libexecdir=/var/www/rd-bin --sysconfdir=/etc/httpd/conf.d $@"
;;
ubuntu)
export MUSICBRAINZ_LIBS="-ldiscid -lmusicbrainz5cc -lcoverartcc"
CONFIGURE="./configure --prefix=/usr --libdir=/usr/lib --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-enabled $@"
;;
esac
#
# Configure the build
#
./autogen.sh
$CONFIGURE