diff --git a/tools/builder/core.sh b/tools/builder/core.sh index b0a6971f..7f3a1422 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -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() { diff --git a/tools/builder/mingw-cross.sh b/tools/builder/mingw-cross.sh index cad71323..6ee23bad 100644 --- a/tools/builder/mingw-cross.sh +++ b/tools/builder/mingw-cross.sh @@ -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 diff --git a/tools/win/linux-cross-builder b/tools/win/linux-cross-builder index 15c42989..54f49f71 100755 --- a/tools/win/linux-cross-builder +++ b/tools/win/linux-cross-builder @@ -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 "$@"