2016-12-11 07:28:28 +00:00
#!/bin/sh
2017-09-02 10:59:31 +00:00
CMAKE=cmake
2019-11-13 01:34:46 +00:00
ENABLE_OPENAL=1
ENABLE_FFMPEG=1
2016-12-21 21:02:55 +00:00
2016-12-11 07:28:28 +00:00
main() {
cd "$(dirname $0)"
2017-09-02 10:59:31 +00:00
check_command_line_args "$@"
mktmp
check_os
${os}_installdeps
quit 0
}
check_command_line_args() {
2016-12-13 00:46:14 +00:00
while [ $# -gt 0 ]; do
case "$1" in
-h|--help|--usage)
usage
quit 0
;;
2019-11-13 01:34:46 +00:00
--no-openal)
ENABLE_OPENAL=
shift
;;
--no-ffmpeg)
ENABLE_FFMPEG=
shift
;;
2016-12-13 00:46:14 +00:00
*)
2019-11-13 01:34:46 +00:00
target=$1
2016-12-13 00:46:14 +00:00
break
;;
esac
done
if [ $# -gt 1 ]; then
usage
quit 1
fi
2017-09-02 10:59:31 +00:00
}
2016-12-13 00:46:14 +00:00
2017-09-02 10:59:31 +00:00
check_os() {
2016-12-11 07:28:28 +00:00
case "$(uname -s)" in
Linux)
2017-08-31 23:56:06 +00:00
os=linux
2016-12-11 07:28:28 +00:00
;;
Darwin)
2017-08-31 23:56:06 +00:00
os=mac
2016-12-11 07:28:28 +00:00
;;
2019-04-25 16:22:07 +00:00
FreeBSD)
os=freebsd
;;
2017-03-23 21:09:17 +00:00
MINGW*|MSYS*)
2017-08-31 23:56:06 +00:00
os=windows
2016-12-11 07:28:28 +00:00
;;
*)
2016-12-13 00:46:14 +00:00
error "Don't know how to install deps on your OS"
2016-12-11 07:28:28 +00:00
;;
esac
2016-12-13 00:46:14 +00:00
}
mktmp() {
tmp="/tmp/installdeps_$$"
mkdir "$tmp" || quit 1
chmod 700 "$tmp" 2>/dev/null
trap "quit 1" PIPE HUP INT QUIT ILL TRAP KILL BUS TERM
}
quit() {
[ -n "$tmp" ] && rm -rf "$tmp" 2>/dev/null
exit ${1:-0}
}
usage() {
cat <<'EOF'
Usage: [32m./installdeps [1;35m[TARGET] [0m
Try to install the dependencies needed for this project appropriately on the
host OS.
This program may require [1;35msudo [0m.
A cross-compile target may be specified as the only parameter, of either
2017-03-23 21:09:17 +00:00
[1;35mm32 [0m which targets the host in 32 bit mode (e.g. x86 on an amd64
host) or [1;35mwin32 [0m, [1;35mMinGW-w64-i686 [0m or
[1;35mMinGW-w64-x86_64 [0m. [1;35mwin32 [0m is an alias for
[1;35mMinGW-w64-i686 [0m to target Windows via MinGW. Cross compiling for
Windows is only supported on Debian/Ubuntu, Fedora, Arch Linux and MSYS2.
2016-12-13 00:46:14 +00:00
2016-12-22 15:04:27 +00:00
On MSYS2 dependencies are installed for 32 or 64 bit native Windows targets
based on which shell you started (the value of $MSYSTEM) unless you specify one
2017-03-23 21:09:17 +00:00
or the other. You can specify a cross target of [1;35mm32 [0m or
[1;35mm64 [0m as aliases for the 32 bit or 64 bit targets respectively.
MSYS2 POSIX layer builds are not supported.
2016-12-13 00:46:14 +00:00
[1m-h, --help, --usage [0m Show this help screen and exit.
2019-11-13 01:34:46 +00:00
[1m--no-openal [0m Do not install OpenAL dependencies.
[1m--no-ffmpeg [0m Do not install ffmpeg dependencies.
2016-12-13 00:46:14 +00:00
Examples:
[32m./installdeps [0m # install dependencies for a host build
2017-03-23 21:09:17 +00:00
[32m./installdeps [1;35mm32 [0m # make a 32 bit binary for the host OS
2016-12-21 21:02:55 +00:00
[32m./installdeps [1;35mwin32 [0m # cross-compile for 32 bit windows (Debian/Ubuntu, Arch Linux or MSYS2)
[32m./installdeps [1;35mMinGW-w64-i686 [0m # likewise
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
[32m./installdeps [1;35mwin64 [0m # cross-compile for 64 bit windows (Debian/Ubuntu, Arch Linux or MSYS2)
[32m./installdeps [1;35mMinGW-w64-x86_64 [0m # likewise
2016-12-13 00:46:14 +00:00
EOF
}
error() {
printf '\n [31mERROR [0m: %s.\n\n' "$1" >&2
[ -z "$2" ] && quit 1
}
warning() {
2017-01-25 18:53:05 +00:00
[ -z "$1" ] && return 0
2016-12-13 00:46:14 +00:00
printf '\n [35mWARNING [0m: %s.\n\n' "$1" >&2
}
info_msg() {
2017-01-25 18:53:05 +00:00
[ -z "$1" ] && return 0
2016-12-13 00:46:14 +00:00
printf '\n [32mINFO [0m: %s.\n\n' "$1" >&2
}
installing() {
2017-03-23 21:09:17 +00:00
echo ' [32mInstalling deps... [0m'
2016-12-13 00:46:14 +00:00
echo
}
check() {
"$@"
if [ $? -ne 0 ]; then
error 'command failed' NOQUIT
2017-02-16 11:39:51 +00:00
echo 'The failing command was:'
2016-12-13 00:46:14 +00:00
echo "$@"
quit 1
fi
}
countdown() {
secs=$1
echo
while [ "$secs" -ne 0 ]; do
printf '%s\r' "Starting in $secs seconds..."
sleep 1
secs=$((secs-1))
done
printf '\n\n'
2016-12-11 07:28:28 +00:00
}
linux_installdeps() {
2016-12-28 16:48:30 +00:00
# detect host architecture
case "$(uname -a)" in
*x86_64*)
amd64=1
;;
*i686*)
i686=1
;;
esac
2016-12-11 07:28:28 +00:00
if [ -f /etc/debian_version ]; then
debian_installdeps
2016-12-28 16:48:30 +00:00
elif [ -f /etc/fedora-release ]; then
fedora_installdeps
2019-03-28 21:45:06 +00:00
elif [ -f /etc/redhat-release ] || [ -f /etc/centos-release ]; then
rhel_installdeps
2016-12-11 07:28:28 +00:00
elif [ -f /etc/arch-release ]; then
archlinux_installdeps
2017-03-20 02:09:33 +00:00
elif [ -f /etc/solus-release ]; then
solus_installdeps
2018-08-04 11:41:42 +00:00
elif [ -f /etc/gentoo-release ]; then
gentoo_installdeps
2018-06-06 10:47:56 +00:00
elif [ -f /etc/os-release ]; then
case "$(. /etc/os-release; echo "$ID_LIKE")" in
*suse*)
suse_installdeps
;;
esac
2016-12-11 07:28:28 +00:00
else
2016-12-13 00:46:14 +00:00
error "Don't know how to install deps on your version of Linux"
2016-12-11 07:28:28 +00:00
fi
}
2019-04-25 16:22:07 +00:00
freebsd_installdeps() {
installing
check sudo pkg update
2019-11-13 01:34:46 +00:00
pkgs="llvm-devel cmake ccache nasm ffmpeg gettext-tools gettext png pkgconf sdl2 sfml wx31-gtk3 iconv zip ninja"
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
2019-04-25 16:22:07 +00:00
# currently the wx30 and wx31 packages produce GTK errors on CURRENT (as of 04/2019)
2019-11-13 01:34:46 +00:00
check sudo pkg install -y $pkgs
2019-04-25 16:22:07 +00:00
build_instructions
}
2017-08-31 23:56:06 +00:00
# the -j flag for make parameter, empty if 1
jobs_flag() {
if [ $(num_cpus) -gt 1 ]; then
echo "-j$(num_cpus)"
fi
}
# number of CPUs to use for jobs, 1 less than total to not overload resources
num_cpus() {
if [ -n "$_num_cpus" ]; then
if [ $((_num_cpus - 1)) -lt 1 ]; then
echo 1
else
echo $((_num_cpus - 1))
fi
return 0
fi
# determine number of CPUs and cache it
if command -v nproc >/dev/null; then
_num_cpus=$(nproc)
elif [ $os = linux -o $os = windows ]; then
_num_cpus=$(grep '^processor *:' /proc/cpuinfo | wc -l)
2019-04-25 16:22:07 +00:00
elif [ $os = mac ] || [ $os = freebsd ]; then
2017-08-31 23:56:06 +00:00
_num_cpus=$(sysctl -n hw.ncpu)
fi
[ -z "$_num_cpus" ] && _num_cpus=1
num_cpus
}
2016-12-13 00:46:14 +00:00
check_cross() {
2017-03-23 21:09:17 +00:00
target=$(echo "$target" | tr 'A-Z' 'a-z')
2016-12-22 15:04:27 +00:00
if [ -z "$target" ]; then
if [ -n "$msys2" ]; then
case "$MSYSTEM" in
MINGW32)
target='mingw-w64-i686'
;;
MINGW64)
target='mingw-w64-x86_64'
;;
2017-03-23 21:09:17 +00:00
MSYS)
error 'host builds in MSYS mode are not supported, supply a target or start a MINGW shell'
;;
2016-12-22 15:04:27 +00:00
*)
error 'unknown value for $MSYSTEM: '"$MSYSTEM"' '
;;
esac
else
return
fi
fi
2016-12-13 00:46:14 +00:00
2017-03-23 21:09:17 +00:00
case "$target" in
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
win32|win64|mingw*)
2017-03-23 21:09:17 +00:00
if [ -z "$arch_linux" -a -z "$msys2" -a -z "$debian" -a -z "$fedora" ]; then
error 'win32 cross compiling targets are only supported on Debian/Ubuntu, Fedora, Arch and MSYS2 at the moment'
fi
2016-12-13 00:46:14 +00:00
2017-03-23 21:09:17 +00:00
case "$target" in
win32)
target='mingw-w64-i686'
;;
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
win64)
target='mingw-w64-x86_64'
;;
2017-03-23 21:09:17 +00:00
mingw-w64-i686)
;;
mingw-w64-x86_64)
;;
*)
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
error "target must be one of 'm32', 'win32', 'MinGW-w64-i686', 'win64' or 'MinGW-w64-x86_64'"
2017-03-23 21:09:17 +00:00
;;
esac
2016-12-13 00:46:14 +00:00
2017-03-23 21:09:17 +00:00
# get the necessary win32 headers
2019-11-03 00:24:18 +00:00
check git submodule update --init --remote --recursive
2016-12-13 00:46:14 +00:00
;;
2019-02-21 22:33:14 +00:00
m32|-m32)
target=m32
if [ -z "$msys2" -a -z "$fedora" -a -z "$arch_linux" -a -z "$solus" -a -z "$suse" ]; then
error '32 bit builds are only supported on Fedora, OpenSUSE, Arch, Solus and MSYS2 at the moment'
2017-03-23 21:09:17 +00:00
fi
if [ -n "$msys2" ]; then
target='mingw-w64-i686'
else
2018-04-02 13:29:32 +00:00
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-m32.cmake"
2017-03-23 21:09:17 +00:00
fi
2016-12-13 00:46:14 +00:00
;;
2017-03-23 21:09:17 +00:00
m64)
if [ -z "$msys2" ]; then
error '64 bit cross target only supported on MSYS2 at the moment'
fi
target='mingw-w64-x86_64'
2016-12-21 21:02:55 +00:00
;;
2016-12-13 00:46:14 +00:00
*)
2017-03-23 21:09:17 +00:00
error "unknown cross target: '$target' "
2016-12-13 00:46:14 +00:00
;;
esac
}
2016-12-11 07:28:28 +00:00
debian_installdeps() {
2016-12-21 21:02:55 +00:00
debian=1
2016-12-13 00:46:14 +00:00
check_cross
installing
2016-12-11 07:28:28 +00:00
2016-12-21 21:02:55 +00:00
if [ -z "$target" ]; then
2019-03-09 03:55:10 +00:00
sudo apt-get -qq -y update
2018-07-10 11:10:25 +00:00
sfml_libs=$(apt-cache search libsfml | grep -E 'graphics|window|network' | sed 's/ - .*//')
2018-07-10 11:44:38 +00:00
glew_lib=$(apt-cache search libglew | grep '^libglew[0-9]' | sed 's/ - .*//')
2019-08-31 23:46:25 +00:00
# not present in trusty
2019-11-13 01:34:46 +00:00
if [ -n "$ENABLE_FFMPEG" ]; then
libswresample_dev=$(apt-cache search libswresample-dev | awk '{print $1}')
fi
2019-08-31 23:46:25 +00:00
2019-11-12 18:45:43 +00:00
# in newer distros
wx_lib=$(apt-cache search 'libwxgtk3.0-gtk3(-[^[:space:]]+)?$' | grep -v -- -dev | sed 's/ - .*//')
wx_lib_dev=$(apt-cache search 'libwxgtk3.0-gtk3-dev(-[^[:space:]]+)?$' | sed 's/ - .*//')
if [ -z "$wx_lib" ] || [ -z "$wx_lib_dev" ]; then
wx_lib=libwxgtk3.0
wx_lib_dev=libwxgtk3.0-dev
fi
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libpng-dev libsdl2-dev libsdl2-2.0 libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev libsfml-dev $sfml_libs $glew_lib $wx_lib $wx_lib_dev libgtk2.0-dev libgtk-3-dev ccache zip ninja-build"
2019-11-13 01:34:46 +00:00
[ -n "$ENABLE_OPENAL" ] && pkgs="$pkgs libopenal-dev"
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev"
check sudo apt-get -qy install $pkgs
2016-12-21 21:02:55 +00:00
else
case "$target" in
mingw-w64-i686)
target='i686-w64-mingw32.static'
2018-06-27 01:49:26 +00:00
CMAKE="/usr/lib/mxe/usr/bin/i686-w64-mingw32.static-cmake"
2016-12-21 21:02:55 +00:00
;;
mingw-w64-x86_64)
target='x86-64-w64-mingw32.static'
2018-06-27 01:49:26 +00:00
CMAKE="/usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-cmake"
2016-12-21 21:02:55 +00:00
;;
*)
error "unknown cross target (you shouldn't see this)"
;;
esac
2020-02-03 01:41:37 +00:00
pre_build='export PATH="$PATH:/usr/lib/mxe/usr/bin"'
2019-09-29 01:40:01 +00:00
debian_rel=$(lsb_release -a 2>/dev/null | sed -En 's/^Codename:[[:space:]]*//p')
case "$debian_rel" in
bionic|stretch|trusty|xenial)
;;
buster|cosmic|disco)
debian_rel=bionic
;;
yakkety|zesty|artful)
debian_rel=xenial
;;
*)
debian_rel=trusty
;;
esac
2019-03-09 00:56:46 +00:00
mxe_apt_sources=/etc/apt/sources.list.d/mxeapt.list
2016-12-21 21:02:55 +00:00
2019-03-09 03:55:10 +00:00
sudo apt-get -qq -y update
2016-12-21 21:02:55 +00:00
if [ -z "$(apt-cache search '^mxe-source$')" ]; then
if [ ! -f "$mxe_apt_sources" ]; then
2019-08-31 22:58:59 +00:00
echo "deb http://pkg.mxe.cc/repos/apt $debian_rel main" | sudo -- sh -c "cat > $mxe_apt_sources"
2019-03-15 11:44:45 +00:00
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C6BF758A33A3A276 || :
2016-12-21 21:02:55 +00:00
else
error "$mxe_apt_sources exists but mxe packages are not found in apt, either delete it or fix it"
fi
fi
2019-11-13 01:34:46 +00:00
deps="gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets"
[ -n "$ENABLE_OPENAL" ] && deps="$deps openal"
[ -n "$ENABLE_FFMPEG" ] && deps="$deps ffmpeg"
2016-12-21 21:02:55 +00:00
set --
2019-11-13 01:34:46 +00:00
for dep in $deps; do
2016-12-21 21:02:55 +00:00
set -- "$@" "mxe-${target}-$dep"
done
2019-03-15 11:44:45 +00:00
check sudo apt-get --allow-unauthenticated -qq -y update
2020-02-03 01:41:37 +00:00
# Native wx-common needed for wxrc executable.
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
check sudo apt-get --allow-unauthenticated -qy install build-essential cmake ninja-build ccache wx-common "$@"
2020-02-03 01:41:37 +00:00
# The ccache symlink is broken in some versions of these mxe packages.
ccache_link=/usr/lib/mxe/.ccache/bin/ccache
if [ ! -e "$ccache_link" ]; then
sudo mkdir -p ${ccache_link%/*}
sudo ln -sf /usr/bin/ccache "$ccache_link"
fi
2016-12-21 21:02:55 +00:00
fi
2016-12-11 07:28:28 +00:00
2016-12-22 15:04:27 +00:00
build_instructions
2016-12-11 07:28:28 +00:00
}
2016-12-28 16:48:30 +00:00
fedora_installdeps() {
fedora=1
2017-09-12 20:47:56 +00:00
ffmpeg=ffmpeg-devel
rpms_installed=
2016-12-28 16:48:30 +00:00
check_cross
installing
2017-01-25 18:53:05 +00:00
warning=
2019-11-13 01:34:46 +00:00
if [ -n "$ENABLE_FFMPEG" ]; then
# using --nogpgcheck with dnf because keys can be a problem on rawhide
fedora_release=$(rpm -E %fedora)
tries=3
curdir=$(pwd)
# make sure rpmfusion is installed for ffmpeg
while [ $tries -gt 0 ]; do
mkdir -p "${tmp}/fusion"
cd "${tmp}/fusion"
if ! curl -fLO https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${fedora_release}.noarch.rpm; then
fedora_release=$((fedora_release - 1))
tries=$((tries - 1))
continue
fi
if ! curl -fLO https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${fedora_release}.noarch.rpm; then
tries=0
break
fi
# check if already installed
if rpm -q rpmfusion-free-release-${fedora_release} >/dev/null 2>&1 && rpm -q rpmfusion-nonfree-release-${fedora_release} >/dev/null 2>&1; then
info_msg 'rpmfusion already installed, good'
break
fi
# otherwise try to install
if ! sudo rpm --nodeps -Uvh ./rpmfusion-*.rpm; then
tries=0
break
fi
2017-03-25 11:02:52 +00:00
break
2019-11-13 01:34:46 +00:00
done
cd "$curdir"
if [ $tries -eq 0 ]; then
warning 'installing rpmfusion repos failed, continuing without ffmpeg'
no_ffmpeg=1
2017-03-25 11:02:52 +00:00
fi
fi
2016-12-28 16:48:30 +00:00
# non-multiarch packages first
2019-03-28 21:45:06 +00:00
check sudo dnf -y --nogpgcheck --best --allowerasing install gcc gcc-c++ make cmake ccache git nasm redhat-rpm-config pkgconfig ccache ninja-build
2017-02-16 11:39:51 +00:00
2017-03-23 21:09:17 +00:00
# try to install multiarch libgcc, glibc-devel and pkgconfig if available
2017-02-16 11:39:51 +00:00
if [ -n "$amd64" ]; then
2017-03-23 21:09:17 +00:00
for pkg in pkgconfig libgcc glibc-devel; do
if [ "$target" = m32 ]; then
sudo dnf -y --nogpgcheck --best --allowerasing install "$pkg".i686
else
sudo dnf -y --nogpgcheck --best --allowerasing install "$pkg".x86_64
fi
done
2017-02-16 11:39:51 +00:00
fi
2016-12-28 16:48:30 +00:00
set --
2017-03-23 21:09:17 +00:00
if [ -z "$target" -o "$target" = m32 ]; then
2017-02-16 11:39:51 +00:00
# try to install both 64 bit and 32 bit versions on 64 bit hosts (see below)
2017-02-16 13:21:40 +00:00
if [ -n "$amd64" ]; then
# this is sometimes necessary for rawhide
set -- --exclude='glibc32*'
fi
2019-03-28 21:45:06 +00:00
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel libpng-devel SDL2-devel SFML-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
2017-03-25 11:02:52 +00:00
case $pkg in
*ffmpeg*)
2019-11-13 01:34:46 +00:00
[ -z "$ENABLE_FFMPEG" ] && continue
;;
*openal*)
[ -z "$ENABLE_OPENAL" ] && continue
2017-03-25 11:02:52 +00:00
;;
esac
2017-01-25 18:53:05 +00:00
if [ -n "$amd64" ]; then
2017-03-23 21:09:17 +00:00
if [ "$target" = m32 ]; then
set -- "$@" "${pkg}.i686"
else
set -- "$@" "${pkg}.x86_64"
fi
2017-01-25 18:53:05 +00:00
else
set -- "$@" "$pkg"
fi
done
2017-03-23 21:09:17 +00:00
# fedora has a bug where all necessary -devel packages are not pulled in for 32 bit direct -devel deps
2017-09-12 20:47:56 +00:00
# this hack adds them to the list
2017-03-23 21:09:17 +00:00
if [ -n "$amd64" -a "$target" = m32 ]; then
info_msg 'Calculating dependencies, this will take a while..'
curdeps=
newdeps=$@
while [ "$curdeps" != "$newdeps" ]; do
curdeps=$newdeps
set -- $(echo "$@" $(sudo dnf -y --nogpgcheck repoquery --deplist "$@" 2>/dev/null | sed -n 's/\.x86_64$/.i686/; s/^ *provider: *\([^ ]*-devel-.*\)$/\1/p' | sort -u) | sed 's/ */\n/g' | sort -u)
newdeps=$@
2017-09-12 20:47:56 +00:00
printf '%s' .
2017-03-23 21:09:17 +00:00
done
2017-09-12 20:47:56 +00:00
echo
info_msg 'Done'
## install the RPMs with rpm --force get around file conflicts
host_rpms=$(echo "$@" | sed 's/\.i686//g')
# first update the host arch versions to reduce chances of conflicts
check sudo dnf -y --nogpgcheck --allowerasing --best install $host_rpms
oldcwd=$PWD
mkdir "$tmp/rpms"
cd "$tmp/rpms"
check sudo dnf -y --nogpgcheck --allowerasing --best download "$@"
# first try installing with dnf to pull in deps
check sudo dnf -y --nogpgcheck --allowerasing --best --skip-broken install *.rpm
# follow up with rpm --force to ignore conflicts
check sudo rpm -Uvh --force *.rpm
rm -f *.rpm
# reinstall the host rpms to make sure any overwritten files are the host version
check sudo dnf -y --nogpgcheck --allowerasing --best download $host_rpms
check sudo dnf -y --nogpgcheck --allowerasing --best --skip-broken install *.rpm
check sudo rpm -Uvh --force *.rpm
cd "$oldcwd"
rm -rf "$tmp/rpms"
ffmpeg=ffmpeg-devel.i686
rpms_installed=1
2017-03-23 21:09:17 +00:00
fi
2017-01-25 18:53:05 +00:00
else # mingw build
set -- "$@" pkgconfig
case "$target" in
mingw-w64-i686)
target=mingw32
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-MinGW-w64-i686-static.cmake"
2017-01-25 18:53:05 +00:00
;;
mingw-w64-x86_64)
target=mingw64
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-MinGW-w64-x86_64-static.cmake"
2017-01-25 18:53:05 +00:00
;;
*)
error 'unknown cross target (this should not happen)'
;;
esac
# install static deps
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
for pkg in zlib gettext libpng SDL2 wxWidgets3; do
2017-01-25 18:53:05 +00:00
set -- "$@" "${target}-${pkg}-static"
done
# install deps that are not available as static
2019-11-13 01:34:46 +00:00
if [ -n "$ENABLE_OPENAL" ]; then
for pkg in openal-soft; do
set -- "$@" "${target}-${pkg}"
done
fi
2017-01-25 18:53:05 +00:00
warning='SFML is required for LINK support, Fedora does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
fi
2017-09-12 20:47:56 +00:00
[ -z "$rpms_installed" ] && check sudo dnf -y --nogpgcheck --best --allowerasing install "$@"
2017-03-25 11:02:52 +00:00
2019-11-13 01:34:46 +00:00
if [ -n "$ENABLE_FFMPEG" ] && ! rpm -q $ffmpeg >/dev/null 2>&1; then
2017-03-25 11:02:52 +00:00
warning 'ffmpeg failed to install (probably due to conflicts)'
fi
2017-03-23 21:09:17 +00:00
[ -n "$warning" ] && warning "$warning"
2017-01-25 18:53:05 +00:00
2016-12-28 16:48:30 +00:00
build_instructions
}
2019-03-28 21:45:06 +00:00
rhel_installdeps() {
rhel=1
ffmpeg=ffmpeg-devel
rpms_installed=
check_cross
installing
warning=
rhel_release=$(rpm -E %rhel)
tries=3
curdir=$(pwd)
# this source is necessary for mingw packages on rhel, and may be for other things in the future
check sudo yum -y install epel-release
# make sure rpmfusion is installed for ffmpeg
2019-11-13 01:34:46 +00:00
if [ -n "$ENABLE_FFMPEG" ]; then
while [ $tries -gt 0 ]; do
mkdir -p "${tmp}/fusion"
cd "${tmp}/fusion"
if ! curl -fLO https://download1.rpmfusion.org/free/el/rpmfusion-free-release-${rhel_release}.noarch.rpm; then
rhel_release=$((rhel_release - 1))
tries=$((tries - 1))
continue
fi
if ! curl -fLO https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-${rhel_release}.noarch.rpm; then
tries=0
break
fi
# check if already installed
if rpm -q rpmfusion-free-release-${rhel_release} >/dev/null 2>&1 && rpm -q rpmfusion-nonfree-release-${rhel_release} >/dev/null 2>&1; then
info_msg 'rpmfusion already installed, good'
break
fi
# otherwise try to install
if ! sudo rpm --nodeps -Uvh ./rpmfusion-*.rpm; then
tries=0
break
fi
2019-03-28 21:45:06 +00:00
break
2019-11-13 01:34:46 +00:00
done
cd "$curdir"
if [ $tries -eq 0 ]; then
warning 'installing rpmfusion repos failed, continuing without ffmpeg'
2019-03-28 21:45:06 +00:00
fi
fi
# non-multiarch packages first
CMAKE=cmake3
check sudo yum -y install gcc gcc-c++ make cmake3 ccache git nasm redhat-rpm-config pkgconfig ccache ninja-build
# try to install multiarch libgcc, glibc-devel and pkgconfig if available
if [ -n "$amd64" ]; then
for pkg in pkgconfig libgcc glibc-devel; do
if [ "$target" = m32 ]; then
sudo yum -y install "$pkg".i686
else
sudo yum -y install "$pkg".x86_64
fi
done
fi
set --
if [ -z "$target" -o "$target" = m32 ]; then
# try to install both 64 bit and 32 bit versions on 64 bit hosts (see below)
if [ -n "$amd64" ]; then
# this is sometimes necessary for rawhide
set -- --exclude='glibc32*'
fi
warning='RHEL does not currently have SFML packages, LINK support will be disabled'
2019-03-28 22:20:16 +00:00
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel libpng-devel SDL2-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
2019-03-28 21:45:06 +00:00
case $pkg in
*ffmpeg*)
2019-11-13 01:34:46 +00:00
[ -z "$ENABLE_FFMPEG" ] && continue
;;
*openal*)
[ -z "$ENABLE_OPENAL" ] && continue
2019-03-28 21:45:06 +00:00
;;
esac
if [ -n "$amd64" ]; then
if [ "$target" = m32 ]; then
set -- "$@" "${pkg}.i686"
else
set -- "$@" "${pkg}.x86_64"
fi
else
set -- "$@" "$pkg"
fi
done
# redhat has a bug where all necessary -devel packages are not pulled in for 32 bit direct -devel deps
# this hack adds them to the list
if [ -n "$amd64" -a "$target" = m32 ]; then
info_msg 'Calculating dependencies, this will take a while..'
curdeps=
newdeps=$@
while [ "$curdeps" != "$newdeps" ]; do
curdeps=$newdeps
set -- $(echo "$@" $(repoquery --deplist "$@" 2>/dev/null | sed -n 's/\.x86_64$/.i686/; s/^ *provider: *\([^ ]*-devel-.*\)$/\1/p' | sort -u) | sed 's/ */\n/g' | sort -u)
newdeps=$@
printf '%s' .
done
echo
info_msg 'Done'
## install the RPMs with rpm --force get around file conflicts
host_rpms=$(echo "$@" | sed 's/\.i686//g')
# first update the host arch versions to reduce chances of conflicts
check sudo yum -y install $host_rpms
oldcwd=$PWD
mkdir "$tmp/rpms"
cd "$tmp/rpms"
check sudo yum -y download "$@"
# first try installing with yum to pull in deps
check sudo yum -y --skip-broken install *.rpm
# follow up with rpm --force to ignore conflicts
check sudo rpm -Uvh --force *.rpm
rm -f *.rpm
# reinstall the host rpms to make sure any overwritten files are the host version
check sudo yum -y download $host_rpms
check sudo yum -y --skip-broken install *.rpm
check sudo rpm -Uvh --force *.rpm
cd "$oldcwd"
rm -rf "$tmp/rpms"
ffmpeg=ffmpeg-devel.i686
rpms_installed=1
fi
else # mingw build
set -- "$@" pkgconfig
case "$target" in
mingw-w64-i686)
target=mingw32
2019-08-20 08:21:38 +00:00
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-MinGW-w64-i686.cmake"
2019-03-28 21:45:06 +00:00
;;
mingw-w64-x86_64)
target=mingw64
2019-08-20 08:21:38 +00:00
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-MinGW-w64-x86_64.cmake"
2019-03-28 21:45:06 +00:00
;;
*)
error 'unknown cross target (this should not happen)'
;;
esac
# install static deps
for pkg in zlib gettext libpng SDL2 wxWidgets; do
set -- "$@" "${target}-${pkg}-static"
done
# install deps that are not available as static
2019-11-13 01:34:46 +00:00
if [ -n "$ENABLE_OPENAL" ]; then
for pkg in openal-soft; do
set -- "$@" "${target}-${pkg}"
done
fi
2019-03-28 21:45:06 +00:00
warning='SFML is required for LINK support, RHEL/EPEL does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
fi
[ -z "$rpms_installed" ] && check sudo yum -y install "$@"
2019-11-13 01:34:46 +00:00
if [ -n "$ENABLE_FFMPEG" ] && ! rpm -q $ffmpeg >/dev/null 2>&1; then
2019-03-28 21:45:06 +00:00
warning 'ffmpeg failed to install (probably due to conflicts)'
fi
[ -n "$warning" ] && warning "$warning"
build_instructions
}
2018-02-24 19:39:29 +00:00
suse_installdeps() {
2019-02-21 22:33:14 +00:00
suse=1
2018-02-24 19:39:29 +00:00
check_cross
installing
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
tools="make cmake ccache nasm gettext-tools pkg-config ccache zip sfml2-devel ninja"
2019-02-21 22:33:14 +00:00
2019-11-13 01:34:46 +00:00
libs="gcc gcc-c++ libpng16-devel libSDL2-devel wxWidgets-3_0-devel" # ffmpeg-devel
[ -n "$ENABLE_OPENAL" ] && libs="$libs openal-soft-devel"
2018-04-26 21:08:16 +00:00
# ffmpeg requires packman repos
2018-02-24 19:39:29 +00:00
2019-02-21 22:33:14 +00:00
if [ "$target" = m32 ]; then
libs=$(echo "$libs" | sed -E 's/([^ ]) ([^ ])/\1-32bit \2/g; s/$/-32bit/;')
fi
check sudo zypper in -y $tools $libs
2018-02-24 19:39:29 +00:00
build_instructions
}
2017-03-23 21:09:17 +00:00
archlinux_require_yaourt() {
if ! command -v yaourt >/dev/null; then
(
cd "$tmp"
git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg --noconfirm -si
cd ..
git clone https://aur.archlinux.org/yaourt.git
cd yaourt
makepkg --noconfirm -si
)
[ $? -ne 0 ] && error 'could not install yaourt'
fi
pacman='yaourt --aur --m-arg=--skipinteg'
}
2016-12-11 07:28:28 +00:00
archlinux_installdeps() {
2016-12-13 00:46:14 +00:00
arch_linux=1
2016-12-11 07:28:28 +00:00
2016-12-13 00:46:14 +00:00
pacman='sudo pacman'
command -v pacaur >/dev/null && pacman='pacaur --noedit'
command -v yaourt >/dev/null && pacman='yaourt --aur --m-arg=--skipinteg'
2016-12-11 07:28:28 +00:00
2016-12-13 00:46:14 +00:00
check_cross
installing
# check for gcc-multilib
gcc_pkg=gcc
if $pacman -Q gcc-multilib >/dev/null 2>&1; then
gcc_pkg=gcc-multilib
fi
# update catalogs
check $pacman -Sy
2017-03-23 21:09:17 +00:00
# common needed dev packages
# not using the base-devel group because it can break gcc-multilib
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
check $pacman --noconfirm --needed -S binutils file grep gawk gzip libtool make patch sed util-linux nasm cmake ccache pkg-config git ccache zip ninja
2017-03-23 21:09:17 +00:00
2019-02-24 14:43:48 +00:00
gtk=gtk3
$pacman -Q gtk3-classic >/dev/null 2>&1 && gtk=gtk3-classic
2019-11-13 01:34:46 +00:00
libs="zlib mesa gettext libpng sdl2 wxgtk3 $gtk sfml"
[ -n "$ENABLE_OPENAL" ] && libs="$libs openal"
[ -n "$ENABLE_FFMPEG" ] && libs="$libs ffmpeg"
2017-03-23 21:09:17 +00:00
if [ -z "$target" -o "$target" = m32 ]; then
if [ -z "$target" -o -z "$amd64" ]; then
# native build
check $pacman --noconfirm --needed -S "$gcc_pkg" $libs
else
# try to build 32 bit binaries
# lib32-sfml and lib32-ffmpeg are in AUR
archlinux_require_yaourt
# enable multilib repos if not enabled
cp /etc/pacman.conf ${tmp}/pacman.conf
cat <<'EOF' >> ${tmp}/pacman.conf
[multilib-testing]
Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
EOF
pacman="$pacman --config ${tmp}/pacman.conf"
# pull in multilib repo info
$pacman -Sy
yes | check $pacman --needed -S gcc-multilib
libs32=
for lib in $libs; do
libs32="$libs32 lib32-$lib"
done
check $pacman --noconfirm --needed -S $libs32
fi
2016-12-13 00:46:14 +00:00
else
# windows cross build
case "$target" in
*i686*)
2019-08-20 08:21:38 +00:00
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-MinGW-w64-i686.cmake"
2016-12-13 00:46:14 +00:00
;;
*x86_64*)
2019-08-20 08:21:38 +00:00
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-MinGW-w64-x86_64.cmake"
2016-12-13 00:46:14 +00:00
;;
*)
# this will never be reached, it's checked in check_cross()
2016-12-22 15:04:27 +00:00
error 'unknown cross target (you should not see this)'
2016-12-13 00:46:14 +00:00
;;
esac
2017-03-23 21:09:17 +00:00
check $pacman --noconfirm --needed -S "$gcc_pkg"
archlinux_require_yaourt
2016-12-13 00:46:14 +00:00
pkg_prefix='mingw-w64-'
2016-12-13 15:38:15 +00:00
# cross toolchain (without headers and crt, we'll use -git versions)
2016-12-13 00:46:14 +00:00
set --
2016-12-13 15:38:15 +00:00
for p in binutils gcc winpthreads; do
2016-12-13 00:46:14 +00:00
set -- "$@" "${pkg_prefix}${p}"
done
check $pacman --noconfirm --needed -S "$@"
# build library deps from AUR
info_msg 'We will now build dependencies from AUR, this will take quite a while and has a high probability of failure. In fact, it is definitely broken at the time of this writing. Press CTRL-C now to abort'
countdown 16
# pass appropriate make -jX flag through makepkg
export MAKEPKG_CONF=${MAKEPKG_CONF:-/etc/makepkg.conf}
grep -Ev '^[ ]*MAKEFLAGS=' "$MAKEPKG_CONF" > "$tmp/makepkg.conf"
2017-08-31 23:56:06 +00:00
export MAKEFLAGS=$(jobs_flag)
2016-12-13 00:46:14 +00:00
echo "MAKEFLAGS=\"$MAKEFLAGS\"" >> "$tmp/makepkg.conf"
export MAKEPKG_CONF="$tmp/makepkg.conf"
# now do the AUR builds
2016-12-13 15:38:15 +00:00
# first we need -headers-git and -crt-git (unless the non-git packages are installed)
for p in "${pkg_prefix}headers" "${pkg_prefix}crt"; do
if ! $pacman -Q "$p" >/dev/null 2>&1; then
check $pacman --noconfirm --needed -S "${p}-git"
else
warning "${pkg_prefix}headers-git and ${pkg_prefix}crt-git are recommended over the regular versions, if you have build failures try to install them"
fi
done
2016-12-13 00:46:14 +00:00
2019-11-13 01:34:46 +00:00
deps="zlib gettext libpng pkg-config sdl2 wxmsw"
[ -n "$ENABLE_OPENAL" ] && deps="$deps openal"
2016-12-13 00:46:14 +00:00
# and the actual deps
2019-11-13 01:34:46 +00:00
for p in $deps; do
2016-12-13 00:46:14 +00:00
pkg="${pkg_prefix}${p}"
# check if already installed
if ! $pacman -Q "$pkg" >/dev/null 2>&1; then
set -- "$@" "${pkg_prefix}${p}"
fi
done
2016-12-13 03:55:44 +00:00
[ $# -gt 0 ] && check $pacman --noconfirm --needed -S "$@"
2016-12-13 00:46:14 +00:00
warning 'SFML is required for LINK support, the SFML package in AUR is currently broken, if you want LINK support you will need to install it manually'
fi
2016-12-11 07:28:28 +00:00
2016-12-22 15:04:27 +00:00
build_instructions
2016-12-11 07:28:28 +00:00
}
2017-03-20 02:09:33 +00:00
solus_installdeps() {
2017-03-23 21:09:17 +00:00
solus=1
check_cross
installing
check sudo eopkg -y update-repo
2017-03-20 02:09:33 +00:00
check sudo eopkg -y install -c system.devel
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
check sudo eopkg -y install git ccache ninja
2017-03-23 21:09:17 +00:00
2019-11-13 01:34:46 +00:00
set -- sdl2-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel
[ -n "$ENABLE_OPENAL" ] && set -- "$@" openal-soft-devel
2017-03-23 21:09:17 +00:00
if [ -n "$amd64" -a "$target" = m32 ]; then
info_msg 'Calculating dependencies, this will take a while..'
2017-03-24 08:38:34 +00:00
# first expand all dep lists recursively for -devel packages
2017-03-23 21:09:17 +00:00
curdeps=
newdeps=$@
while [ "$curdeps" != "$newdeps" ]; do
curdeps=$newdeps
2017-03-24 08:38:34 +00:00
set -- $(echo "$@" $(sudo eopkg info "$@" 2>/dev/null | sed -n 's/^Dependencies *: *\(.*\)/\1/p' | sort -u) | sed 's/ */\n/g' | grep -- '-devel$' | sort -u)
2017-03-23 21:09:17 +00:00
newdeps=$@
done
# transform to 32bit package names
first=1
for pkg in "$@"; do
if [ "$first" = 1 ]; then
set --
first=0
fi
2017-03-24 08:38:34 +00:00
case "$pkg" in
*-32bit-devel)
# already 32 bit
;;
*-devel)
set -- "$@" "${pkg%-devel}-32bit-devel"
;;
*)
set -- "$@" "$pkg"
;;
esac
2017-03-23 21:09:17 +00:00
done
# prune the ones that don't exist
first=1
for pkg in "$@"; do
if [ "$first" = 1 ]; then
set --
first=0
fi
if ! sudo eopkg info "$pkg" | grep -q 'not found in binary repositories'; then
set -- "$@" "$pkg"
fi
done
else
# no 32bit versions of these
set -- "$@" SFML-devel ffmpeg-devel
fi
check sudo eopkg -y install "$@"
if [ -n "$amd64" -a "$target" = m32 ]; then
warning 'SFML is required for LINK support, there is no 32 bit SFML package in Solus currently, if you want LINK support you will need to install it manually'
warning 'ffmpeg is required for game recording, there is no 32 bit ffmpeg package in Solus currently, you may wish to install it manually'
fi
2017-03-20 02:09:33 +00:00
build_instructions
}
2018-08-04 11:41:42 +00:00
gentoo_installdeps() {
installing
check sudo emerge-webrsync
2019-11-13 01:34:46 +00:00
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
ebuilds="gcc make cmake ccache binutils libsdl2 libsfml wxGTK zlib dev-util/pkgconfig nasm dev-util/ninja"
2019-11-13 01:34:46 +00:00
[ -n "$ENABLE_OPENAL" ] && ebuilds="$ebuilds media-libs/openal"
[ -n "$ENABLE_FFMPEG" ] && ebuilds="$ebuilds media-video/ffmpeg"
check sudo emerge -vuDUa $ebuilds
2018-08-04 11:41:42 +00:00
build_instructions
}
2017-09-02 10:59:31 +00:00
windows_installdeps() {
2016-12-13 00:46:14 +00:00
msys2=1
check_cross
installing
# update catalogs
check pacman -Sy
2016-12-11 07:28:28 +00:00
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
pkgs="SDL2 sfml wxWidgets zlib binutils cmake crt-git extra-cmake-modules gcc gcc-libs gcc-libgfortran gdb headers-git make pkg-config tools-git windows-default-manifest libmangle-git nasm ninja"
2019-11-13 01:34:46 +00:00
[ -n "$ENABLE_OPENAL" ] && pkgs="$pkgs openal"
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
2016-12-13 03:55:44 +00:00
set --
2019-11-13 01:34:46 +00:00
for p in $pkgs; do
2017-03-23 21:09:17 +00:00
set -- "$@" "${target}-${p}"
2016-12-13 03:55:44 +00:00
done
2016-12-13 00:46:14 +00:00
# install
2018-06-27 02:06:28 +00:00
check pacman --noconfirm --needed -S git make zip ccache "$@"
2016-12-11 07:28:28 +00:00
2017-03-23 21:09:17 +00:00
cmake_flags="$cmake_flags -G 'MSYS Makefiles'"
if [ "$MSYSTEM" = MSYS ]; then
case "$target" in
*i686)
pre_build=\
"MSYSTEM=MINGW32 bash -l
cd $(pwd)"
;;
*x86_64)
pre_build=\
"MSYSTEM=MINGW64 bash -l
cd $(pwd)"
;;
esac
post_build=exit
fi
2016-12-11 07:28:28 +00:00
2016-12-22 15:04:27 +00:00
build_instructions
2016-12-11 07:28:28 +00:00
}
2017-09-02 10:59:31 +00:00
mac_installdeps() {
2016-12-11 07:28:28 +00:00
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
2016-12-13 00:46:14 +00:00
error 'Please install XCode and the XCode Command Line Tools, then run this script again. On newer systems this can be done with: xcode-select --install '
2016-12-11 07:28:28 +00:00
fi
if command -v brew >/dev/null; then
brew_installdeps
elif command -v port >/dev/null; then
macports_installdeps
elif command -v fink >/dev/null; then
fink_installdeps
else
2016-12-13 00:46:14 +00:00
error 'You have no package manager, please install homebrew, macports or fink'
2016-12-11 07:28:28 +00:00
fi
}
brew_installdeps() {
2016-12-13 00:46:14 +00:00
check_cross
installing
2016-12-11 07:28:28 +00:00
2016-12-13 00:46:14 +00:00
check brew -v update
2016-12-13 03:55:44 +00:00
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
brews="nasm cmake ccache gettext libpng pkg-config sdl2 wxmac ccache ninja"
2019-11-13 01:34:46 +00:00
[ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg"
2019-05-22 21:06:42 +00:00
# sfml brew currently broken in the travis mac environment
2019-05-29 23:26:46 +00:00
# if [ -z "$TRAVIS" ]; then
2019-05-22 21:06:42 +00:00
brews="$brews sfml"
2019-05-29 23:26:46 +00:00
# fi
2019-05-22 21:06:42 +00:00
2016-12-13 03:55:44 +00:00
set --
2019-05-22 21:06:42 +00:00
for f in $brews; do
2016-12-13 03:55:44 +00:00
if brew info "$f" | grep -Eq '^Not installed$'; then
set -- "$@" "$f"
fi
done
[ $# -gt 0 ] && check brew -v install "$@"
2016-12-11 07:28:28 +00:00
2019-07-04 03:51:00 +00:00
brew link gettext --force
2016-12-11 07:28:28 +00:00
brew -v cleanup
2016-12-22 15:04:27 +00:00
build_instructions
2016-12-11 07:28:28 +00:00
}
macports_installdeps() {
2016-12-13 00:46:14 +00:00
check_cross
installing
2016-12-11 07:28:28 +00:00
2016-12-13 00:46:14 +00:00
check sudo port -v selfupdate
2019-11-13 01:34:46 +00:00
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
ports="cmake ccache nasm gettext libpng pkgconfig libsdl2 sfml wxWidgets-3.0 libiconv ninja"
2019-11-13 01:34:46 +00:00
[ -n "$ENABLE_FFMPEG" ] && ports="$ports ffmpeg"
check sudo port -v install $ports
2016-12-13 00:46:14 +00:00
check sudo port select wxWidgets wxWidgets-3.0
2016-12-11 07:28:28 +00:00
2016-12-22 15:04:27 +00:00
build_instructions
2016-12-11 07:28:28 +00:00
}
fink_installdeps() {
2016-12-13 00:46:14 +00:00
check_cross
installing
2016-12-11 07:28:28 +00:00
2016-12-13 00:46:14 +00:00
check sudo fink -vy selfupdate
2019-11-13 01:34:46 +00:00
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
pkgs="cmake ccache nasm libgettext8-dev gettext-tools libpng16 pkgconfig sdl2 wxwidgets300-osxcocoa libiconv-dev sfml24-dev ccache ninja"
2019-11-13 01:34:46 +00:00
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
check sudo fink -vy install $pkgs
2016-12-11 07:28:28 +00:00
2016-12-22 15:04:27 +00:00
build_instructions
2016-12-11 07:28:28 +00:00
}
2016-12-22 15:04:27 +00:00
build_instructions() {
2016-12-11 07:28:28 +00:00
cat <<EOF
[32mDone! To build do: [0m
2017-03-23 21:09:17 +00:00
$pre_build
mkdir -p build && cd build
cmake: Fix fedora mingw build + misc improvements.
Use the 3.x wxwidgets mingw package in installdeps.
Add the win64 alias to installdeps for 64 bit mingw builds, like the
win32 alias for 32 bit mingw builds.
Check CROSS_ARCH in Architecture.cmake, set by our mingw toolchains.
Disable LTO by default for all mingw builds, not just amd64, because it
is unfortunately broken on i686 as well now.
Search for heuristically the most appropriate wx-config and set
wxWidgets_CONFIG_EXECUTABLE accordingly in the mingw toolchains.
Refactor the mingw toolchains somewhat, put common code into a common
file, add static toolchains.
For static toolchains, also search for a static zlib and set ZLIB_ROOT.
Change installdeps instructions to use ninja instead of make. Add ninja
to all target dependencies where it was missing, this may be incorrect
in a couple of the rarely used targets, if this is the case the affected
users are free to open an issue.
Also start using ninja on travis instead of make, except for libretro
which uses a GNU Makefile.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2020-02-01 16:43:08 +00:00
$CMAKE .. $cmake_flags -G Ninja
ninja
2017-03-23 21:09:17 +00:00
$post_build
2016-12-11 07:28:28 +00:00
EOF
}
main "$@"