installdeps: minor refactoring/cleanup
Break command line argument processing and OS detection off into functions called from `main()`. Remove all references to cairo. For fink, install the SFML package I made instead of turning off link.
This commit is contained in:
parent
2ad204619b
commit
4b1c9b4e86
57
installdeps
57
installdeps
|
@ -1,10 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
cmake=cmake
|
||||
CMAKE=cmake
|
||||
|
||||
main() {
|
||||
cd "$(dirname $0)"
|
||||
|
||||
check_command_line_args "$@"
|
||||
|
||||
target=$1
|
||||
|
||||
mktmp
|
||||
|
||||
check_os
|
||||
|
||||
${os}_installdeps
|
||||
|
||||
quit 0
|
||||
}
|
||||
|
||||
check_command_line_args() {
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help|--usage)
|
||||
|
@ -21,30 +35,23 @@ main() {
|
|||
usage
|
||||
quit 1
|
||||
fi
|
||||
}
|
||||
|
||||
target=$1
|
||||
|
||||
mktmp
|
||||
|
||||
check_os() {
|
||||
case "$(uname -s)" in
|
||||
Linux)
|
||||
os=linux
|
||||
linux_installdeps
|
||||
;;
|
||||
Darwin)
|
||||
os=mac
|
||||
osx_installdeps
|
||||
;;
|
||||
MINGW*|MSYS*)
|
||||
os=windows
|
||||
msys2_installdeps
|
||||
;;
|
||||
*)
|
||||
error "Don't know how to install deps on your OS"
|
||||
;;
|
||||
esac
|
||||
|
||||
quit 0
|
||||
}
|
||||
|
||||
mktmp() {
|
||||
|
@ -265,7 +272,7 @@ debian_installdeps() {
|
|||
|
||||
if [ -z "$target" ]; then
|
||||
check sudo apt-get -qq update
|
||||
check sudo apt-get -qy install build-essential g++ nasm cmake gettext zlib1g-dev libgl1-mesa-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libgettextpo-dev libpng-dev libsdl2-dev libsfml-dev libopenal-dev libwxgtk3.0-dev libgtk2.0-dev libgtk-3-dev libcairo2-dev
|
||||
check sudo apt-get -qy install build-essential g++ nasm cmake gettext zlib1g-dev libgl1-mesa-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libgettextpo-dev libpng-dev libsdl2-dev libsfml-dev libopenal-dev libwxgtk3.0-dev libgtk2.0-dev libgtk-3-dev
|
||||
else
|
||||
case "$target" in
|
||||
mingw-w64-i686)
|
||||
|
@ -279,7 +286,7 @@ debian_installdeps() {
|
|||
;;
|
||||
esac
|
||||
|
||||
cmake="/usr/lib/mxe/usr/bin/${target}-cmake"
|
||||
CMAKE="/usr/lib/mxe/usr/bin/${target}-cmake"
|
||||
|
||||
mxe_apt_sources='/etc/apt/sources.list.d/mxeapt.list'
|
||||
|
||||
|
@ -294,7 +301,7 @@ debian_installdeps() {
|
|||
fi
|
||||
|
||||
set --
|
||||
for dep in gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets cairo; do
|
||||
for dep in gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets; do
|
||||
set -- "$@" "mxe-${target}-$dep"
|
||||
done
|
||||
check sudo apt-get -qy install build-essential cmake "$@"
|
||||
|
@ -369,7 +376,7 @@ fedora_installdeps() {
|
|||
# this is sometimes necessary for rawhide
|
||||
set -- --exclude='glibc32*'
|
||||
fi
|
||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel libpng-devel SDL2-devel SFML-devel openal-soft-devel wxGTK3-devel cairo-devel gtk2-devel gtk3-devel; do
|
||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel libpng-devel SDL2-devel SFML-devel openal-soft-devel wxGTK3-devel gtk2-devel gtk3-devel; do
|
||||
case $pkg in
|
||||
*ffmpeg*)
|
||||
[ -n $no_ffmpeg ] && continue
|
||||
|
@ -415,7 +422,7 @@ fedora_installdeps() {
|
|||
;;
|
||||
esac
|
||||
# install static deps
|
||||
for pkg in zlib gettext libpng SDL2 wxWidgets cairo; do
|
||||
for pkg in zlib gettext libpng SDL2 wxWidgets; do
|
||||
set -- "$@" "${target}-${pkg}-static"
|
||||
done
|
||||
# install deps that are not available as static
|
||||
|
@ -481,7 +488,7 @@ archlinux_installdeps() {
|
|||
# not using the base-devel group because it can break gcc-multilib
|
||||
check $pacman --noconfirm --needed -S binutils file grep gawk gzip libtool make patch sed util-linux nasm cmake pkg-config git
|
||||
|
||||
libs="zlib mesa cairo gettext libpng sdl2 openal wxgtk gtk2 gtk3 sfml ffmpeg"
|
||||
libs="zlib mesa gettext libpng sdl2 openal wxgtk gtk2 gtk3 sfml ffmpeg"
|
||||
|
||||
if [ -z "$target" -o "$target" = m32 ]; then
|
||||
if [ -z "$target" -o -z "$amd64" ]; then
|
||||
|
@ -657,7 +664,7 @@ solus_installdeps() {
|
|||
build_instructions
|
||||
}
|
||||
|
||||
msys2_installdeps() {
|
||||
windows_installdeps() {
|
||||
msys2=1
|
||||
|
||||
check_cross
|
||||
|
@ -667,7 +674,7 @@ msys2_installdeps() {
|
|||
check pacman -Sy
|
||||
|
||||
set --
|
||||
for p in SDL2 cairo ffmpeg openal sfml wxWidgets zlib binutils cmake crt-git extra-cmake-modules gcc gcc-libs gdb headers-git make pkg-config tools-git windows-default-manifest libmangle-git nasm; do
|
||||
for p in SDL2 ffmpeg openal sfml wxWidgets zlib binutils cmake crt-git extra-cmake-modules gcc gcc-libs gdb headers-git make pkg-config tools-git windows-default-manifest libmangle-git nasm; do
|
||||
set -- "$@" "${target}-${p}"
|
||||
done
|
||||
|
||||
|
@ -695,7 +702,7 @@ cd $(pwd)"
|
|||
build_instructions
|
||||
}
|
||||
|
||||
osx_installdeps() {
|
||||
mac_installdeps() {
|
||||
if ! xcode-select -p >/dev/null 2>&1 && \
|
||||
! pkgutil --pkg-info=com.apple.pkg.CLTools_Executables >/dev/null 2>&1 && \
|
||||
! pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI >/dev/null 2>&1; then
|
||||
|
@ -721,7 +728,7 @@ brew_installdeps() {
|
|||
check brew -v update
|
||||
|
||||
set --
|
||||
for f in cairo nasm cmake ffmpeg gettext libpng pkg-config sdl2 sfml wxmac; do
|
||||
for f in nasm cmake ffmpeg gettext libpng pkg-config sdl2 sfml wxmac; do
|
||||
if brew info "$f" | grep -Eq '^Not installed$'; then
|
||||
set -- "$@" "$f"
|
||||
fi
|
||||
|
@ -738,7 +745,7 @@ macports_installdeps() {
|
|||
installing
|
||||
|
||||
check sudo port -v selfupdate
|
||||
check sudo port -v install cairo cmake nasm ffmpeg gettext libpng pkgconfig libsdl2 sfml wxWidgets-3.0 libiconv
|
||||
check sudo port -v install cmake nasm ffmpeg gettext libpng pkgconfig libsdl2 sfml wxWidgets-3.0 libiconv
|
||||
check sudo port select wxWidgets wxWidgets-3.0
|
||||
|
||||
build_instructions
|
||||
|
@ -749,11 +756,7 @@ fink_installdeps() {
|
|||
installing
|
||||
|
||||
check sudo fink -vy selfupdate
|
||||
check sudo fink -vy install cairo cmake nasm ffmpeg libgettext8-dev gettext-tools libpng16 pkgconfig sdl2 wxwidgets300-osxcocoa libiconv-dev
|
||||
|
||||
warning 'SFML is required for LINK support, there is currently no SFML package for Fink, if you want LINK support you will need to install it manually'
|
||||
|
||||
cmake_flags="$cmake_flags -DENABLE_LINK=NO"
|
||||
check sudo fink -vy install cmake nasm ffmpeg libgettext8-dev gettext-tools libpng16 pkgconfig sdl2 wxwidgets300-osxcocoa libiconv-dev sfml24-dev
|
||||
|
||||
build_instructions
|
||||
}
|
||||
|
@ -765,7 +768,7 @@ build_instructions() {
|
|||
|
||||
$pre_build
|
||||
mkdir -p build && cd build
|
||||
$cmake .. $cmake_flags
|
||||
$CMAKE .. $cmake_flags
|
||||
make $(jobs_flag)
|
||||
$post_build
|
||||
|
||||
|
|
Loading…
Reference in New Issue