-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathpre-configure.sh
executable file
·151 lines (135 loc) · 5.22 KB
/
pre-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
#!/bin/bash
set -e
if [ "$(id -u)" != "0" ] ; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Installs dependencies for building AXR
UNAME=$(uname)
deps()
{
echo "- Qt 4"
echo "- CMake"
echo "- GTK+ 2 (optional on Windows and OS X - required on X11)"
echo "- SDL (optional)"
echo "- Doxygen (optional)"
}
doc()
{
echo "Please install the following dependencies manually, either through"
echo "your platform's native package manager or by building from source:"
deps
}
set_mp_target()
{
mp_target=$1
export MACOSX_DEPLOYMENT_TARGET=$mp_target
# Determine MacPorts installation path
mp="$(which port)"
mp_prefix="${mp%/bin/port}"
if [ -z "$mp_prefix" ] ; then
echo "Could not determine MacPorts installation prefix"
exit 1
fi
# Get MacPorts configuration file path
mp_conf="$mp_prefix/etc/macports/macports.conf"
# Check the MacPorts deployment target configuration and change it if necessary
mp_deployment_target=$(egrep "^macosx_deployment_target\s+([0-9.]+)\s*$" "$mp_conf" | cut -d ' ' -f 2- | tr -d ' \t')
if [ ! -z "$mp_deployment_target" ] ; then
echo "Building MacPorts dependencies for OS X $mp_deployment_target+"
if [ "$mp_deployment_target" != "$mp_target" ] ; then
echo "MacPorts macosx_deployment_target setting was found ($mp_deployment_target) - changing to $mp_target..."
sed -i '.bak' "s/macosx_deployment_target $mp_deployment_target/macosx_deployment_target $mp_target/g" "$mp_conf"
fi
else
echo "MacPorts macosx_deployment_target setting was not found - setting to $mp_target..."
echo "macosx_deployment_target $mp_target" | tee -a "$mp_conf" > /dev/null
fi
}
if [ "$UNAME" = "Darwin" ] ; then
osx_current=$(sw_vers -productVersion | cut -f 1-2 -d '.')
if [ -z "$osx_current" ] ; then
echo "Unable to determine current OS X version"
exit 1
fi
# TODO: Allow the user to prefer a particular package manager if they have multiple
if [ $(which port 2>/dev/null) ] ; then # MacPorts
# NOTE: At least for Qt, +debug builds debug AND release libraries
# depof:<port> does not allow to specify variants of the <port> itself,
# and since variants may install extra dependencies depof:<port> may not
# necessarily install all dependencies - however, comparing the output of
# `port deps <port>` and `port deps <port> +variant1 +variant2 +variant3`
# will allow you to tell whether additional dependencies that won't be picked
# up by depof:<port> will need to be installed
# Currently our selected variants of Qt don't require extra deps
# so depof:qt4-mac will be sufficient
set_mp_target 10.4
port install \
libsdl +universal \
depof:qt4-mac +universal \
depof:cmake +universal
set_mp_target $osx_current
port install doxygen gtk2 +universal
# earliest OS X that Qt 4.8.x Cocoa will build on
# NOTE: for some reason MacPorts' Qt won't work with
# the framework variant
set_mp_target 10.5
port install qt4-mac +debug +quartz +universal
# reset deployment target to 10.4 when finished
set_mp_target 10.4
elif [ $(which brew 2>/dev/null) ] ; then # Brew
# brew install ...
echo "ERROR: brew support is not yet implemented"
exit 1
elif [ $(which fink 2>/dev/null) ] ; then # Fink
# fink install ...
echo "ERROR: fink support is not yet implemented"
exit 1
else
echo "ERROR: Could not find any OS X package managers installed"
echo "Please install one (we support MacPorts, Homebrew and Fink) and install"
echo "the following dependencies, or build from source instead:"
deps
exit 1
fi
elif [ "$UNAME" = "Linux" ] ; then
if [ $(which apt-get 2>/dev/null) ] ; then
# Debian, Ubuntu
apt-get update
apt-get install build-essential lintian qt-sdk cmake libsdl1.2-dev libgtk2.0-dev doxygen pandoc
elif [ $(which yum 2>/dev/null) ] ; then
# Fedora, RHEL, Yellow Dog Linux
yum groupinstall 'Development Tools'
yum install rpm qt-devel cmake SDL-devel gtk2-devel doxygen pandoc
elif [ $(which zypper 2>/dev/null) ] ; then
# openSUSE
echo "ERROR: zypper support is not yet implemented"
exit 1
elif [ $(which slackpkg 2>/dev/null) ] ; then
# Slackware
echo "ERROR: slackpkg support is not yet implemented"
exit 1
elif [ $(which pacman 2>/dev/null) ] ; then
# Arch Linux
pacman -S qt cmake sdl gtk2 doxygen
elif [ $(which emerge 2>/dev/null) ] ; then
# Gentoo with portage
emerge -n qt-gui cmake sdl doxygen gtk+
elif [ $(which cave 2>/dev/null) ] ; then
# Exherbo or Gentoo with paludis
echo "ERROR: Paludis support is not yet implemented"
exit 1
else
echo "ERROR: Unknown package manager!"
doc
exit 1
fi
elif [ "$UNAME" = "FreeBSD" ] ; then
# pkg_add -r ...
echo "ERROR: FreeBSD support is not yet implemented"
exit 1
else
echo "ERROR: Unknown platform!"
doc
exit 1
fi