builder: updates for opensuse, refactor cross deps

Move linux distribution detection into `detect_os()` in the core.

The appropriate routine is then called with eval.

Move linux deps installation (for fedora previously) from
`linux-cross-builder` to `mingw-cross.sh` using the `linux_distribution`
variable set by `detect_os()`.

Add a routine to install suse cross dependencies as well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-04-15 23:38:26 +00:00
parent d28fd302aa
commit 9b38a38428
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
3 changed files with 64 additions and 28 deletions

View File

@ -613,17 +613,7 @@ linux_install_core_deps() {
;;
esac
if [ -f /etc/debian_version ]; then
debian_install_core_deps
elif [ -f /etc/fedora-release ]; then
fedora_install_core_deps
elif [ -f /etc/arch-release ]; then
archlinux_install_core_deps
elif [ -f /etc/solus-release ]; then
solus_install_core_deps
elif path_exists /etc/os-release && [ "$(. /etc/os-release; puts "$ID_LIKE")" = suse ]; then
suse_install_core_deps
fi
eval "${linux_distribution}_install_core_deps"
}
debian_install_core_deps() {
@ -647,7 +637,7 @@ suse_install_core_deps() {
sudo zypper in -y gcc gcc-c++ binutils glibc-devel-static make curl perl ccache file patch
}
archlinux_install_core_deps() {
arch_install_core_deps() {
installing_core_deps
# check for gcc-multilib
@ -810,6 +800,22 @@ detect_os() {
LD_START_GROUP='-Wl,--start-group'
LD_END_GROUP='-Wl,--end-group'
fi
# detect linux distribution
linux_distribution=unknown
if [ $os = linux ]; then
if [ -f /etc/debian_version ]; then
linux_distribution=debian
elif [ -f /etc/fedora-release ]; then
linux_distribution=fedora
elif [ -f /etc/arch-release ]; then
linux_distribution=arch
elif [ -f /etc/solus-release ]; then
linux_distribution=solus
elif path_exists /etc/os-release && (. /etc/os-release; puts "$ID_LIKE") | grep -q suse; then
linux_distribution=suse
fi
fi
}
delete_outdated_dists() {

View File

@ -63,6 +63,52 @@ export REQUIRED_CMAKE_ARGS="$REQUIRED_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE='$(perl
. "${0%/*}/../builder/mingw.sh"
installing_cross_deps() {
puts "${NL}Installing cross dependencies for your OS...${NL}${NL}"
}
fedora_install_cross_deps() {
pkg_prefix="mingw${target_bits}"
set --
for p in gcc cpp gcc-c++ binutils headers crt filesystem winpthreads-static; do
set -- "$@" "${pkg_prefix}-${p}"
done
sudo dnf install -y --nogpgcheck --best --allowerasing "$@" gettext-devel wxGTK3-devel python
}
suse_install_cross_deps() {
suse_dist=$(. /etc/os-release; echo $PRETTY_NAME | sed 's/ /_/g')
sudo zypper ar -f https://download.opensuse.org/repositories/windows:/mingw:/win64/${suse_dist}/windows:mingw:win64.repo || :
sudo zypper ar -f https://download.opensuse.org/repositories/windows:/mingw:/win32/${suse_dist}/windows:mingw:win32.repo || :
sudo zypper refresh
pkg_prefix="mingw${target_bits}"
set --
for p in cross-gcc cross-cpp cross-gcc-c++ cross-binutils headers filesystem winpthreads-devel; do
set -- "$@" "${pkg_prefix}-${p}"
done
sudo zypper in -y "$@" gettext-tools wxGTK3-3_2-devel python
}
case "$linux_distribution" in
fedora)
installing_cross_deps
fedora_install_cross_deps
done_msg
;;
suse)
installing_cross_deps
suse_install_cross_deps
done_msg
;;
esac
openssl_host=mingw
[ "$target_bits" -eq 64 ] && openssl_host=mingw64

View File

@ -4,20 +4,4 @@ set -e
. "${0%/*}/../builder/mingw-cross.sh"
# install cross deps on fedora
if [ $# -eq 0 ] && [ -f /etc/fedora-release ]; then
puts "${NL}Installing cross dependencies for your OS...${NL}${NL}"
pkg_prefix="mingw${target_bits}"
set --
for p in gcc cpp gcc-c++ binutils headers crt filesystem winpthreads-static; do
set -- "$@" "${pkg_prefix}-${p}"
done
sudo dnf install -y --nogpgcheck --best --allowerasing "$@" gettext-devel wxGTK3-devel python
set --
fi
builder "$@"