32 bit cross compiling support on Linux
Add the `m32` parameter to ./installdeps to fetch 32 bit multilib dependencies on Fedora, Arch and Solus linuxes and add a cmake toolchain file to build with them. For MSYS2 support both an `m32` and an `m64` to choose deps for 32 bit or 64 bit mingw targets. Adjust build instructions from ./installdeps to support both usages. Other changes: - use --nogpgcheck --best --allowerasing for dnf invocations for Fedora, the --nogpgcheck is necessary when Rawhide is confused about which keys it has, and the latter two are needed for upgrades that remove unneeded deps etc - when finding GTK2, first try using pkg-config, and only fall back to the cmake script when that fails, pkg-config works better for cross builds - add cairo to dep lists in ./installdeps for the time being - for arch, list individual packages from base-devel instead of base-devel that do not require gcc-libs because of potential conflicts between gcc and gcc-multilib
This commit is contained in:
parent
352527254b
commit
41ead88dcb
|
@ -0,0 +1,51 @@
|
||||||
|
SET(CMAKE_C_FLAGS "-m32" CACHE STRING "C compiler flags" FORCE)
|
||||||
|
SET(CMAKE_CXX_FLAGS "-m32" CACHE STRING "C++ compiler flags" FORCE)
|
||||||
|
|
||||||
|
SET(LIB32 /usr/lib) # Fedora
|
||||||
|
|
||||||
|
IF(EXISTS /usr/lib32)
|
||||||
|
SET(LIB32 /usr/lib32) # Arch, Solus
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
SET(CMAKE_SYSTEM_LIBRARY_PATH ${LIB32} CACHE STRING "system library search path" FORCE)
|
||||||
|
SET(CMAKE_LIBRARY_PATH ${LIB32} CACHE STRING "library search path" FORCE)
|
||||||
|
|
||||||
|
# this is probably unlikely to be needed, but just in case
|
||||||
|
SET(CMAKE_EXE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "executable linker flags" FORCE)
|
||||||
|
SET(CMAKE_SHARED_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "shared library linker flags" FORCE)
|
||||||
|
SET(CMAKE_MODULE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "module linker flags" FORCE)
|
||||||
|
|
||||||
|
# find Wx config script on Fedora for the highest version of 32 bit Wx installed
|
||||||
|
IF(EXISTS ${LIB32}/wx/config)
|
||||||
|
FILE(GLOB WX_INSTALLS ${LIB32}/wx/config/*)
|
||||||
|
|
||||||
|
SET(MAX_WX_VERSION 0.0)
|
||||||
|
FOREACH(WX_INSTALL ${WX_INSTALLS})
|
||||||
|
STRING(REGEX MATCH "[0-9]+(\\.[0-9]+)+\$" WX_VERSION ${WX_INSTALL})
|
||||||
|
|
||||||
|
IF(WX_VERSION VERSION_GREATER MAX_WX_VERSION)
|
||||||
|
SET(MAX_WX_VERSION ${WX_VERSION})
|
||||||
|
ENDIF()
|
||||||
|
ENDFOREACH()
|
||||||
|
|
||||||
|
FILE(GLOB WX_INSTALL_CONFIGS "${LIB32}/wx/config/*${MAX_WX_VERSION}")
|
||||||
|
LIST(GET WX_INSTALL_CONFIGS 0 WX_INSTALL_CONFIG)
|
||||||
|
|
||||||
|
SET(WX_CONFIG_TRANSFORM_SCRIPT_LINES
|
||||||
|
""
|
||||||
|
)
|
||||||
|
FILE(WRITE ${CMAKE_BINARY_DIR}/wx-config-wrapper
|
||||||
|
"#!/bin/sh
|
||||||
|
${WX_INSTALL_CONFIG} \"\$@\" | sed 's!/emul32/!/usr/!g'
|
||||||
|
")
|
||||||
|
EXECUTE_PROCESS(COMMAND chmod +x ${CMAKE_BINARY_DIR}/wx-config-wrapper)
|
||||||
|
|
||||||
|
SET(wxWidgets_CONFIG_EXECUTABLE ${CMAKE_BINARY_DIR}/wx-config-wrapper)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have
|
||||||
|
# to include the regular system .pc files as well (at the end), because some
|
||||||
|
# are not always present in the 32 bit directory
|
||||||
|
IF(EXISTS ${LIB32}/pkgconfig)
|
||||||
|
SET(ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig)
|
||||||
|
ENDIF()
|
|
@ -62,6 +62,12 @@ to (usually 2 or 3).
|
||||||
|
|
||||||
Support for more OSes/distributions for `./installdeps` is planned.
|
Support for more OSes/distributions for `./installdeps` is planned.
|
||||||
|
|
||||||
|
## Cross compiling for 32 bit on a 64 bit host
|
||||||
|
|
||||||
|
`./installdeps m32` will set things up to build a 32 bit binary.
|
||||||
|
|
||||||
|
This is supported on Fedora, Arch, Solus and MSYS2.
|
||||||
|
|
||||||
## Cross Compiling for Win32
|
## Cross Compiling for Win32
|
||||||
|
|
||||||
`./installdeps` takes one optional parameter for cross-compiling target, which
|
`./installdeps` takes one optional parameter for cross-compiling target, which
|
||||||
|
|
283
installdeps
283
installdeps
|
@ -33,10 +33,7 @@ main() {
|
||||||
Darwin)
|
Darwin)
|
||||||
osx_installdeps
|
osx_installdeps
|
||||||
;;
|
;;
|
||||||
MSYS*)
|
MINGW*|MSYS*)
|
||||||
error 'You must run this program from a MINGW 32 bit or 64 bit shell, not the MSYS shell'
|
|
||||||
;;
|
|
||||||
MINGW*)
|
|
||||||
msys2_installdeps
|
msys2_installdeps
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -68,18 +65,23 @@ host OS.
|
||||||
This program may require [1;35msudo[0m.
|
This program may require [1;35msudo[0m.
|
||||||
|
|
||||||
A cross-compile target may be specified as the only parameter, of either
|
A cross-compile target may be specified as the only parameter, of either
|
||||||
[1;35mwin32[0m, [1;35mMinGW-w64-i686[0m or [1;35mMinGW-w64-x86_64[0m.
|
[1;35mm32[0m which targets the host in 32 bit mode (e.g. x86 on an amd64
|
||||||
[1;35mwin32[0m is an alias for [1;35mMinGW-w64-i686[0m.
|
host) or [1;35mwin32[0m, [1;35mMinGW-w64-i686[0m or
|
||||||
This is only supported on Debian/Ubuntu, Arch Linux and MSYS2.
|
[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.
|
||||||
|
|
||||||
On MSYS2 dependencies are installed for 32 or 64 bit native Windows targets
|
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
|
based on which shell you started (the value of $MSYSTEM) unless you specify one
|
||||||
or the other. MSYS2 POSIX layer builds are not supported.
|
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.
|
||||||
|
|
||||||
[1m-h, --help, --usage[0m Show this help screen and exit.
|
[1m-h, --help, --usage[0m Show this help screen and exit.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
[32m./installdeps[0m # install dependencies for a host build
|
[32m./installdeps[0m # install dependencies for a host build
|
||||||
|
[32m./installdeps [1;35mm32[0m # make a 32 bit binary for the host OS
|
||||||
[32m./installdeps [1;35mwin32[0m # cross-compile for 32 bit windows (Debian/Ubuntu, Arch Linux or MSYS2)
|
[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
|
[32m./installdeps [1;35mMinGW-w64-i686[0m # likewise
|
||||||
[32m./installdeps [1;35mMinGW-w64-x86_64[0m # cross-compile for 64 bit windows (Debian/Ubuntu, Arch Linux or MSYS2)
|
[32m./installdeps [1;35mMinGW-w64-x86_64[0m # cross-compile for 64 bit windows (Debian/Ubuntu, Arch Linux or MSYS2)
|
||||||
|
@ -103,7 +105,7 @@ info_msg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
installing() {
|
installing() {
|
||||||
echo '[32mInstalling deps....[0m'
|
echo '[32mInstalling deps...[0m'
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,6 +155,8 @@ linux_installdeps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_cross() {
|
check_cross() {
|
||||||
|
target=$(echo "$target" | tr 'A-Z' 'a-z')
|
||||||
|
|
||||||
if [ -z "$target" ]; then
|
if [ -z "$target" ]; then
|
||||||
if [ -n "$msys2" ]; then
|
if [ -n "$msys2" ]; then
|
||||||
case "$MSYSTEM" in
|
case "$MSYSTEM" in
|
||||||
|
@ -162,6 +166,9 @@ check_cross() {
|
||||||
MINGW64)
|
MINGW64)
|
||||||
target='mingw-w64-x86_64'
|
target='mingw-w64-x86_64'
|
||||||
;;
|
;;
|
||||||
|
MSYS)
|
||||||
|
error 'host builds in MSYS mode are not supported, supply a target or start a MINGW shell'
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
error 'unknown value for $MSYSTEM: '"$MSYSTEM"' '
|
error 'unknown value for $MSYSTEM: '"$MSYSTEM"' '
|
||||||
;;
|
;;
|
||||||
|
@ -171,12 +178,12 @@ check_cross() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$target" in
|
||||||
|
win32|mingw*)
|
||||||
if [ -z "$arch_linux" -a -z "$msys2" -a -z "$debian" -a -z "$fedora" ]; then
|
if [ -z "$arch_linux" -a -z "$msys2" -a -z "$debian" -a -z "$fedora" ]; then
|
||||||
error 'cross compiling targets are only supported on Debian/Ubuntu, Fedora, Arch Linux and MSYS2 at the moment'
|
error 'win32 cross compiling targets are only supported on Debian/Ubuntu, Fedora, Arch and MSYS2 at the moment'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
target=$(echo "$target" | tr 'A-Z' 'a-z')
|
|
||||||
|
|
||||||
case "$target" in
|
case "$target" in
|
||||||
win32)
|
win32)
|
||||||
target='mingw-w64-i686'
|
target='mingw-w64-i686'
|
||||||
|
@ -186,12 +193,34 @@ check_cross() {
|
||||||
mingw-w64-x86_64)
|
mingw-w64-x86_64)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error "target must be one of 'MinGW-w64-i686' or 'MinGW-w64-x86_64'"
|
error "target must be one of 'm32', 'win32', 'MinGW-w64-i686' or 'MinGW-w64-x86_64'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# all good, get the necessary win32 headers
|
# get the necessary win32 headers
|
||||||
check git submodule update --init --recursive
|
check git submodule update --init --recursive
|
||||||
|
;;
|
||||||
|
m32)
|
||||||
|
if [ -z "$msys2" -a -z "$fedora" -a -z "$arch_linux" -a -z "$solus" ]; then
|
||||||
|
error '32 bit builds are only supported on Fedora, Arch, Solus and MSYS2 at the moment'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$msys2" ]; then
|
||||||
|
target='mingw-w64-i686'
|
||||||
|
else
|
||||||
|
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-m32.cmake"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
m64)
|
||||||
|
if [ -z "$msys2" ]; then
|
||||||
|
error '64 bit cross target only supported on MSYS2 at the moment'
|
||||||
|
fi
|
||||||
|
target='mingw-w64-x86_64'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "unknown cross target: '$target' "
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
debian_installdeps() {
|
debian_installdeps() {
|
||||||
|
@ -246,50 +275,73 @@ fedora_installdeps() {
|
||||||
|
|
||||||
warning=
|
warning=
|
||||||
|
|
||||||
|
# using --nogpgcheck with dnf because keys can be a problem on rawhide
|
||||||
|
|
||||||
# make sure rpmfusion is installed for ffmpeg
|
# make sure rpmfusion is installed for ffmpeg
|
||||||
check sudo su -c 'dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'
|
check sudo su -c 'dnf -y --nogpgcheck install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'
|
||||||
|
|
||||||
# non-multiarch packages first
|
# non-multiarch packages first
|
||||||
check sudo dnf -y install gcc gcc-c++ make cmake git nasm redhat-rpm-config pkgconfig
|
check sudo dnf -y --nogpgcheck --best --allowerasing install gcc gcc-c++ make cmake git nasm redhat-rpm-config pkgconfig
|
||||||
|
|
||||||
# older fedora has separate 32 bit and 64 bit pkgconfig packages
|
# try to install multiarch libgcc, glibc-devel and pkgconfig if available
|
||||||
# try to install both, ignoring errors
|
|
||||||
if [ -n "$amd64" ]; then
|
if [ -n "$amd64" ]; then
|
||||||
sudo dnf -y install pkgconfig.x86_64 >/dev/null 2>&1
|
for pkg in pkgconfig libgcc glibc-devel; do
|
||||||
sudo dnf -y install pkgconfig.i686 >/dev/null 2>&1
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set --
|
set --
|
||||||
if [ -z "$target" ]; then
|
if [ -z "$target" -o "$target" = m32 ]; then
|
||||||
# try to install both 64 bit and 32 bit versions on 64 bit hosts (see below)
|
# try to install both 64 bit and 32 bit versions on 64 bit hosts (see below)
|
||||||
if [ -n "$amd64" ]; then
|
if [ -n "$amd64" ]; then
|
||||||
# this is sometimes necessary for rawhide
|
# this is sometimes necessary for rawhide
|
||||||
set -- --exclude='glibc32*'
|
set -- --exclude='glibc32*'
|
||||||
fi
|
fi
|
||||||
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
|
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
|
||||||
if [ -n "$amd64" ]; then
|
if [ -n "$amd64" ]; then
|
||||||
set -- "$@" "${pkg}.x86_64" "${pkg}.i686"
|
if [ "$target" = m32 ]; then
|
||||||
|
set -- "$@" "${pkg}.i686"
|
||||||
|
else
|
||||||
|
set -- "$@" "${pkg}.x86_64"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
set -- "$@" "$pkg"
|
set -- "$@" "$pkg"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# fedora has a bug where all necessary -devel packages are not pulled in for 32 bit direct -devel deps
|
||||||
|
# this hacks 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 "$@" $(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=$@
|
||||||
|
done
|
||||||
|
fi
|
||||||
else # mingw build
|
else # mingw build
|
||||||
set -- "$@" pkgconfig
|
set -- "$@" pkgconfig
|
||||||
case "$target" in
|
case "$target" in
|
||||||
mingw-w64-i686)
|
mingw-w64-i686)
|
||||||
target=mingw32
|
target=mingw32
|
||||||
cmake_flags='-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-i686.cmake -DENABLE_LINK=NO'
|
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-i686.cmake -DENABLE_LINK=NO"
|
||||||
;;
|
;;
|
||||||
mingw-w64-x86_64)
|
mingw-w64-x86_64)
|
||||||
target=mingw64
|
target=mingw64
|
||||||
cmake_flags='-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-x86_64.cmake -DENABLE_LINK=NO'
|
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-x86_64.cmake -DENABLE_LINK=NO"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error 'unknown cross target (this should not happen)'
|
error 'unknown cross target (this should not happen)'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# install static deps
|
# install static deps
|
||||||
for pkg in zlib gettext libpng SDL2 wxWidgets; do
|
for pkg in zlib gettext libpng SDL2 wxWidgets cairo; do
|
||||||
set -- "$@" "${target}-${pkg}-static"
|
set -- "$@" "${target}-${pkg}-static"
|
||||||
done
|
done
|
||||||
# install deps that are not available as static
|
# install deps that are not available as static
|
||||||
|
@ -300,26 +352,30 @@ fedora_installdeps() {
|
||||||
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'
|
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
|
fi
|
||||||
|
|
||||||
if ! sudo dnf -y install "$@"; then
|
check sudo dnf -y --nogpgcheck --best --allowerasing install "$@"
|
||||||
if [ -n "$amd64" ]; then
|
|
||||||
# try without 32 bit packages, this is a problem on rawhide currently
|
|
||||||
warning 'installing 32 bit packages failed, trying to install 64 bit only packages...'
|
|
||||||
unset amd64
|
|
||||||
fedora_installdeps
|
|
||||||
return $?
|
|
||||||
else
|
|
||||||
error 'installing dependencies for Fedora failed' NOQUIT
|
|
||||||
echo 'The failing command was:'
|
|
||||||
echo sudo dnf -y install "$@"
|
|
||||||
quit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
warning "$warning"
|
[ -n "$warning" ] && warning "$warning"
|
||||||
|
|
||||||
build_instructions
|
build_instructions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
|
||||||
archlinux_installdeps() {
|
archlinux_installdeps() {
|
||||||
arch_linux=1
|
arch_linux=1
|
||||||
|
|
||||||
|
@ -339,17 +395,52 @@ archlinux_installdeps() {
|
||||||
# update catalogs
|
# update catalogs
|
||||||
check $pacman -Sy
|
check $pacman -Sy
|
||||||
|
|
||||||
if [ -z "$target" ]; then
|
# common needed dev packages
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
if [ -z "$target" -o "$target" = m32 ]; then
|
||||||
|
if [ -z "$target" -o -z "$amd64" ]; then
|
||||||
# native build
|
# native build
|
||||||
check $pacman --noconfirm --needed -S base-devel "$gcc_pkg" nasm zlib mesa cairo cmake ffmpeg gettext libpng pkg-config sdl2 sfml openal wxgtk gtk2 gtk3
|
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
|
||||||
else
|
else
|
||||||
# windows cross build
|
# windows cross build
|
||||||
case "$target" in
|
case "$target" in
|
||||||
*i686*)
|
*i686*)
|
||||||
cmake_flags='-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-i686.cmake -DENABLE_LINK=NO'
|
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-i686.cmake -DENABLE_LINK=NO"
|
||||||
;;
|
;;
|
||||||
*x86_64*)
|
*x86_64*)
|
||||||
cmake_flags='-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-x86_64.cmake -DENABLE_LINK=NO'
|
cmake_flags="$cmake_flags -DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-x86_64.cmake -DENABLE_LINK=NO"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# this will never be reached, it's checked in check_cross()
|
# this will never be reached, it's checked in check_cross()
|
||||||
|
@ -357,24 +448,9 @@ archlinux_installdeps() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# base devel packages
|
check $pacman --noconfirm --needed -S "$gcc_pkg"
|
||||||
check $pacman --noconfirm --needed -S base-devel "$gcc_pkg" nasm cmake git
|
|
||||||
|
|
||||||
# now install yaourt if we don't have it
|
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'
|
|
||||||
|
|
||||||
pkg_prefix='mingw-w64-'
|
pkg_prefix='mingw-w64-'
|
||||||
|
|
||||||
|
@ -429,8 +505,62 @@ archlinux_installdeps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
solus_installdeps() {
|
solus_installdeps() {
|
||||||
|
solus=1
|
||||||
|
|
||||||
|
check_cross
|
||||||
|
installing
|
||||||
|
|
||||||
|
check sudo eopkg -y update-repo
|
||||||
check sudo eopkg -y install -c system.devel
|
check sudo eopkg -y install -c system.devel
|
||||||
check sudo eopkg -y install git ffmpeg-devel sdl2-devel SFML-devel openal-soft-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel
|
check sudo eopkg -y install git
|
||||||
|
|
||||||
|
set -- sdl2-devel openal-soft-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel
|
||||||
|
if [ -n "$amd64" -a "$target" = m32 ]; then
|
||||||
|
info_msg 'Calculating dependencies, this will take a while..'
|
||||||
|
|
||||||
|
# first expand all dep lists recursively
|
||||||
|
curdeps=
|
||||||
|
newdeps=$@
|
||||||
|
while [ "$curdeps" != "$newdeps" ]; do
|
||||||
|
curdeps=$newdeps
|
||||||
|
set -- $(echo "$@" $(sudo eopkg info "$@" 2>/dev/null | sed -n 's/^Dependencies *: *\(.*\)/\1/p' | sort -u) | sed 's/ */\n/g' | sort -u)
|
||||||
|
newdeps=$@
|
||||||
|
done
|
||||||
|
|
||||||
|
# transform to 32bit package names
|
||||||
|
first=1
|
||||||
|
for pkg in "$@"; do
|
||||||
|
if [ "$first" = 1 ]; then
|
||||||
|
set --
|
||||||
|
first=0
|
||||||
|
fi
|
||||||
|
set -- "$@" "${pkg%-devel}-32bit-devel"
|
||||||
|
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'
|
||||||
|
|
||||||
|
cmake_flags="$cmake_flags -DENABLE_LINK=NO -DENABLE_FFMPEG=NO"
|
||||||
|
fi
|
||||||
|
|
||||||
build_instructions
|
build_instructions
|
||||||
}
|
}
|
||||||
|
@ -446,15 +576,29 @@ msys2_installdeps() {
|
||||||
|
|
||||||
set --
|
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 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
|
||||||
if ! pacman -Q "${target}-${p}" >/dev/null 2>&1; then
|
|
||||||
set -- "$@" "${target}-${p}"
|
set -- "$@" "${target}-${p}"
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# install
|
# install
|
||||||
check pacman --noconfirm --needed -S git make zip "$@"
|
check pacman --noconfirm --needed -S git make zip "$@"
|
||||||
|
|
||||||
cmake_flags="-G 'MSYS Makefiles'"
|
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
|
||||||
|
|
||||||
build_instructions
|
build_instructions
|
||||||
}
|
}
|
||||||
|
@ -517,7 +661,7 @@ fink_installdeps() {
|
||||||
|
|
||||||
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'
|
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='-DENABLE_LINK=NO'
|
cmake_flags="$cmake_flags -DENABLE_LINK=NO"
|
||||||
|
|
||||||
build_instructions
|
build_instructions
|
||||||
}
|
}
|
||||||
|
@ -527,9 +671,12 @@ build_instructions() {
|
||||||
|
|
||||||
[32mDone! To build do:[0m
|
[32mDone! To build do:[0m
|
||||||
|
|
||||||
mkdir build && cd build
|
$pre_build
|
||||||
|
mkdir -p build && cd build
|
||||||
$cmake .. $cmake_flags
|
$cmake .. $cmake_flags
|
||||||
make -j8
|
make -j8
|
||||||
|
$post_build
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ ENDFOREACH()
|
||||||
|
|
||||||
# check if this build of wx actually has OpenGL support
|
# check if this build of wx actually has OpenGL support
|
||||||
|
|
||||||
SET(CMAKE_REQUIRED_LIBRARIES ${MY_CXX_FLAGS} ${MY_C_FLAGS} ${MY_CXX_LINKER_FLAGS} ${MY_C_LINKER_FLAGS} ${CMAKE_REQUIRED_LIBRARIES} ${wxWidgets_LIBRARIES})
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MY_CXX_FLAGS} ${MY_C_FLAGS} ${MY_CXX_LINKER_FLAGS} ${MY_C_LINKER_FLAGS} ${wxWidgets_LIBRARIES})
|
||||||
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${wxWidgets_CXX_FLAGS} ${MY_CXX_FLAGS} ${MY_C_FLAGS})
|
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${wxWidgets_CXX_FLAGS} ${MY_CXX_FLAGS} ${MY_C_FLAGS})
|
||||||
|
|
||||||
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${wxWidgets_INCLUDE_DIRS})
|
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${wxWidgets_INCLUDE_DIRS})
|
||||||
|
@ -97,7 +97,7 @@ FOREACH(DEF ${wxWidgets_DEFINITIONS})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
|
|
||||||
# CheckCXXSourceCompiles ignores compiler flags, so we have to stuff them into the definitions
|
# CheckCXXSourceCompiles ignores compiler flags, so we have to stuff them into the definitions
|
||||||
SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${CMAKE_REQUIRED_FLAGS})
|
SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_FLAGS} ${CMAKE_REQUIRED_DEFINITIONS})
|
||||||
|
|
||||||
INCLUDE(CheckCXXSourceCompiles)
|
INCLUDE(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
@ -171,6 +171,15 @@ IF(NOT WIN32 AND NOT APPLE)
|
||||||
ELSE()
|
ELSE()
|
||||||
CHECK_CXX_SYMBOL_EXISTS(__WXGTK20__ ${WX_CONFIG_H} WX_USING_GTK2)
|
CHECK_CXX_SYMBOL_EXISTS(__WXGTK20__ ${WX_CONFIG_H} WX_USING_GTK2)
|
||||||
IF(WX_USING_GTK2)
|
IF(WX_USING_GTK2)
|
||||||
|
# try to use pkg-config to find gtk2 first
|
||||||
|
PKG_CHECK_MODULES(GTK2 REQUIRED gtk+-2.0)
|
||||||
|
IF(GTK2_INCLUDE_DIRS)
|
||||||
|
INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
|
||||||
|
LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
|
||||||
|
ADD_COMPILE_OPTIONS(${GTK2_CFLAGS_OTHER})
|
||||||
|
SET(GTK_LIBRARIES ${GTK2_LIBRARIES})
|
||||||
|
ELSE()
|
||||||
|
# and if that fails, use the cmake module
|
||||||
FIND_PACKAGE(GTK2 REQUIRED gtk)
|
FIND_PACKAGE(GTK2 REQUIRED gtk)
|
||||||
IF(NOT GTK2_INCLUDE_DIRS)
|
IF(NOT GTK2_INCLUDE_DIRS)
|
||||||
MESSAGE(FATAL_ERROR "Could not find gtk2")
|
MESSAGE(FATAL_ERROR "Could not find gtk2")
|
||||||
|
@ -178,6 +187,7 @@ IF(NOT WIN32 AND NOT APPLE)
|
||||||
INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
|
||||||
ADD_COMPILE_OPTIONS(${GTK2_DEFINITIONS})
|
ADD_COMPILE_OPTIONS(${GTK2_DEFINITIONS})
|
||||||
SET(GTK_LIBRARIES ${GTK2_LIBRARIES})
|
SET(GTK_LIBRARIES ${GTK2_LIBRARIES})
|
||||||
|
ENDIF()
|
||||||
ELSE()
|
ELSE()
|
||||||
FIND_PACKAGE(GTK REQUIRED gtk)
|
FIND_PACKAGE(GTK REQUIRED gtk)
|
||||||
IF(NOT GTK_INCLUDE_DIRS)
|
IF(NOT GTK_INCLUDE_DIRS)
|
||||||
|
|
Loading…
Reference in New Issue