libreboot

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 71a2623fbef25fefc1886bc6374832a92188742d
parent 35d692494d22932129340ea9c1a8e329e380d6d7
Author: Swift Geek <swiftgeek@gmail.com>
Date:   Thu, 14 Sep 2017 06:56:02 +0000

Merge branch 'grabbin-deps' of kragle/libreboot into master

Diffstat:
libs/tool | 19+++++++++++++++++++
tools/dependencies/configs/parabola/i386/README | 24++++++++++++++++++++++++
tools/dependencies/configs/parabola/i386/deps-bucts | 4++++
tools/dependencies/configs/parabola/i386/deps-coreboot | 11+++++++++++
tools/dependencies/configs/parabola/i386/deps-crossgcc-arm | 1+
tools/dependencies/configs/parabola/i386/deps-dejavu-fonts | 3+++
tools/dependencies/configs/parabola/i386/deps-documentation | 1+
tools/dependencies/configs/parabola/i386/deps-download | 2++
tools/dependencies/configs/parabola/i386/deps-flashrom | 7+++++++
tools/dependencies/configs/parabola/i386/deps-generic | 10++++++++++
tools/dependencies/configs/parabola/i386/deps-grub | 17+++++++++++++++++
tools/dependencies/configs/parabola/i386/deps-i945-pwm | 5+++++
tools/dependencies/configs/parabola/i386/deps-memtest86plus | 2++
tools/dependencies/configs/parabola/i686 | 2++
tools/dependencies/configs/parabola/x86_64/README | 24++++++++++++++++++++++++
tools/dependencies/configs/parabola/x86_64/deps-bucts | 4++++
tools/dependencies/configs/parabola/x86_64/deps-coreboot | 11+++++++++++
tools/dependencies/configs/parabola/x86_64/deps-crossgcc-arm | 1+
tools/dependencies/configs/parabola/x86_64/deps-crossgcc-i386 | 9+++++++++
tools/dependencies/configs/parabola/x86_64/deps-dejavu-fonts | 3+++
tools/dependencies/configs/parabola/x86_64/deps-documentation | 1+
tools/dependencies/configs/parabola/x86_64/deps-download | 2++
tools/dependencies/configs/parabola/x86_64/deps-flashrom | 7+++++++
tools/dependencies/configs/parabola/x86_64/deps-generic | 10++++++++++
tools/dependencies/configs/parabola/x86_64/deps-grub | 17+++++++++++++++++
tools/dependencies/configs/parabola/x86_64/deps-i945-pwm | 5+++++
tools/dependencies/configs/parabola/x86_64/deps-memtest86plus | 2++
tools/dependencies/configs/targets | 2++
tools/dependencies/configs/trisquel7/i386/README | 24++++++++++++++++++++++++
tools/dependencies/configs/trisquel7/i386/deps-bucts | 6++++++
tools/dependencies/configs/trisquel7/i386/deps-coreboot | 13+++++++++++++
tools/dependencies/configs/trisquel7/i386/deps-crossgcc-arm | 1+
tools/dependencies/configs/trisquel7/i386/deps-dejavu-fonts | 2++
tools/dependencies/configs/trisquel7/i386/deps-documentation | 1+
tools/dependencies/configs/trisquel7/i386/deps-download | 2++
tools/dependencies/configs/trisquel7/i386/deps-flashrom | 10++++++++++
tools/dependencies/configs/trisquel7/i386/deps-generic | 17+++++++++++++++++
tools/dependencies/configs/trisquel7/i386/deps-grub | 17+++++++++++++++++
tools/dependencies/configs/trisquel7/i386/deps-i945-pwm | 6++++++
tools/dependencies/configs/trisquel7/i386/deps-memtest86plus | 2++
tools/dependencies/configs/trisquel7/i686 | 2++
tools/dependencies/configs/trisquel7/x86_64/README | 24++++++++++++++++++++++++
tools/dependencies/configs/trisquel7/x86_64/deps-bucts | 6++++++
tools/dependencies/configs/trisquel7/x86_64/deps-coreboot | 13+++++++++++++
tools/dependencies/configs/trisquel7/x86_64/deps-crossgcc-arm | 1+
tools/dependencies/configs/trisquel7/x86_64/deps-crossgcc-i386 | 10++++++++++
tools/dependencies/configs/trisquel7/x86_64/deps-dejavu-fonts | 2++
tools/dependencies/configs/trisquel7/x86_64/deps-documentation | 1+
tools/dependencies/configs/trisquel7/x86_64/deps-download | 2++
tools/dependencies/configs/trisquel7/x86_64/deps-flashrom | 10++++++++++
tools/dependencies/configs/trisquel7/x86_64/deps-generic | 17+++++++++++++++++
tools/dependencies/configs/trisquel7/x86_64/deps-grub | 17+++++++++++++++++
tools/dependencies/configs/trisquel7/x86_64/deps-i945-pwm | 6++++++
tools/dependencies/configs/trisquel7/x86_64/deps-memtest86plus | 2++
tools/dependencies/dependencies | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/dependencies/dependencies-helper | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56 files changed, 550 insertions(+), 0 deletions(-)

diff --git a/libs/tool b/libs/tool @@ -200,6 +200,25 @@ tool_action_arguments_recursive() { fi } +tool_arguments_targets() { + local tool="$1" + shift + + local tool_path="$(tool_path "${tool}")" + local targets_path="${tool_path}/${CONFIGS}" + local argument + + for argument in "$@"; do + targets_path="${targets_path}/${argument}" + done + + targets_path="${targets_path}/${TARGETS}" + + if [[ -f "${targets_path}" ]]; then + cat "${targets_path}" + fi +} + tool_path() { local tool=$1 diff --git a/tools/dependencies/configs/parabola/i386/README b/tools/dependencies/configs/parabola/i386/README @@ -0,0 +1,24 @@ +Each file in this directory contains a list of dependencies that +should be installed before compiling the program indicated by the +filename's suffix, with a few exceptions; these exceptions being +"deps-documentation", "deps-download", and "deps-generic" for reasons +noted below: + +* "deps-documentation" contains a general list of packages that are + needed to build Libreboot documentation. +* "deps-download" contains packages necessary for downloading either + source code repositories and/or supporting files from a remote + source. +* "deps-generic" contains generic dependencies that didn't quite fit + (i.e. listed) under any of the other dependency lists but are + necessary nonetheless. + +It is expected that these files are updated whenever upstream projects +change dependency requirements. + +Any duplications between files are intentional; in order to provide a +clear picture as to which dependencies are needed by individual +programs, any attempt to consolidate these lists is dissuaded. + +This README is released under Creative Commons Zero 1.0: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/tools/dependencies/configs/parabola/i386/deps-bucts b/tools/dependencies/configs/parabola/i386/deps-bucts @@ -0,0 +1,4 @@ +gcc +make +pciutils +zlib diff --git a/tools/dependencies/configs/parabola/i386/deps-coreboot b/tools/dependencies/configs/parabola/i386/deps-coreboot @@ -0,0 +1,11 @@ +bison +doxygen +flex +gcc +gdb +g++ +iasl +make +ncurses +openssl +pkg-config diff --git a/tools/dependencies/configs/parabola/i386/deps-crossgcc-arm b/tools/dependencies/configs/parabola/i386/deps-crossgcc-arm @@ -0,0 +1 @@ +arm-none-eabi-gcc diff --git a/tools/dependencies/configs/parabola/i386/deps-dejavu-fonts b/tools/dependencies/configs/parabola/i386/deps-dejavu-fonts @@ -0,0 +1,3 @@ +fontforge +perl-font-ttf +perl-io-string diff --git a/tools/dependencies/configs/parabola/i386/deps-documentation b/tools/dependencies/configs/parabola/i386/deps-documentation @@ -0,0 +1 @@ +pandoc diff --git a/tools/dependencies/configs/parabola/i386/deps-download b/tools/dependencies/configs/parabola/i386/deps-download @@ -0,0 +1,2 @@ +git +wget diff --git a/tools/dependencies/configs/parabola/i386/deps-flashrom b/tools/dependencies/configs/parabola/i386/deps-flashrom @@ -0,0 +1,7 @@ +libftdi +libftdi-compat +libusb +make +pciutils +pkg-config +zlib diff --git a/tools/dependencies/configs/parabola/i386/deps-generic b/tools/dependencies/configs/parabola/i386/deps-generic @@ -0,0 +1,10 @@ +autogen +binutils +coreutils +fakeroot +gawk +help2man +libfaketime +m4 +texinfo +xz diff --git a/tools/dependencies/configs/parabola/i386/deps-grub b/tools/dependencies/configs/parabola/i386/deps-grub @@ -0,0 +1,17 @@ +autoconf +automake +bdf-unifont +bison +device-mapper +flex +freetype2 +gcc +gettext +glibc +libpciaccess +libusb +make +pciutils +python +qemu +sdl diff --git a/tools/dependencies/configs/parabola/i386/deps-i945-pwm b/tools/dependencies/configs/parabola/i386/deps-i945-pwm @@ -0,0 +1,5 @@ +gcc +gdb +pciutils +make +zlib diff --git a/tools/dependencies/configs/parabola/i386/deps-memtest86plus b/tools/dependencies/configs/parabola/i386/deps-memtest86plus @@ -0,0 +1,2 @@ +gcc +make diff --git a/tools/dependencies/configs/parabola/i686 b/tools/dependencies/configs/parabola/i686 @@ -0,0 +1 @@ +i386+ \ No newline at end of file diff --git a/tools/dependencies/configs/parabola/x86_64/README b/tools/dependencies/configs/parabola/x86_64/README @@ -0,0 +1,24 @@ +Each file in this directory contains a list of dependencies that +should be installed before compiling the program indicated by the +filename's suffix, with a few exceptions; these exceptions being +"deps-documentation", "deps-download", and "deps-generic" for reasons +noted below: + +* "deps-documentation" contains a general list of packages that are + needed to build Libreboot documentation. +* "deps-download" contains packages necessary for downloading either + source code repositories and/or supporting files from a remote + source. +* "deps-generic" contains generic dependencies that didn't quite fit + (i.e. listed) under any of the other dependency lists but are + necessary nonetheless. + +It is expected that these files are updated whenever upstream projects +change dependency requirements. + +Any duplications between files are intentional; in order to provide a +clear picture as to which dependencies are needed by individual +programs, any attempt to consolidate these lists is dissuaded. + +This README is released under Creative Commons Zero 1.0: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/tools/dependencies/configs/parabola/x86_64/deps-bucts b/tools/dependencies/configs/parabola/x86_64/deps-bucts @@ -0,0 +1,4 @@ +gcc +make +pciutils +zlib diff --git a/tools/dependencies/configs/parabola/x86_64/deps-coreboot b/tools/dependencies/configs/parabola/x86_64/deps-coreboot @@ -0,0 +1,11 @@ +bison +doxygen +flex +gcc +gdb +g++ +iasl +make +ncurses +openssl +pkg-config diff --git a/tools/dependencies/configs/parabola/x86_64/deps-crossgcc-arm b/tools/dependencies/configs/parabola/x86_64/deps-crossgcc-arm @@ -0,0 +1 @@ +arm-none-eabi-gcc diff --git a/tools/dependencies/configs/parabola/x86_64/deps-crossgcc-i386 b/tools/dependencies/configs/parabola/x86_64/deps-crossgcc-i386 @@ -0,0 +1,9 @@ +gcc-libs-multilib +gcc-multilib +lib32-fakeroot +lib32-glibc +lib32-libltdl +lib32-libpciaccess +lib32-libstdc++5 +lib32-openssl +lib32-ncurses diff --git a/tools/dependencies/configs/parabola/x86_64/deps-dejavu-fonts b/tools/dependencies/configs/parabola/x86_64/deps-dejavu-fonts @@ -0,0 +1,3 @@ +fontforge +perl-font-ttf +perl-io-string diff --git a/tools/dependencies/configs/parabola/x86_64/deps-documentation b/tools/dependencies/configs/parabola/x86_64/deps-documentation @@ -0,0 +1 @@ +pandoc diff --git a/tools/dependencies/configs/parabola/x86_64/deps-download b/tools/dependencies/configs/parabola/x86_64/deps-download @@ -0,0 +1,2 @@ +git +wget diff --git a/tools/dependencies/configs/parabola/x86_64/deps-flashrom b/tools/dependencies/configs/parabola/x86_64/deps-flashrom @@ -0,0 +1,7 @@ +libftdi +libftdi-compat +libusb +make +pciutils +pkg-config +zlib diff --git a/tools/dependencies/configs/parabola/x86_64/deps-generic b/tools/dependencies/configs/parabola/x86_64/deps-generic @@ -0,0 +1,10 @@ +autogen +binutils +coreutils +fakeroot +gawk +help2man +libfaketime +m4 +texinfo +xz diff --git a/tools/dependencies/configs/parabola/x86_64/deps-grub b/tools/dependencies/configs/parabola/x86_64/deps-grub @@ -0,0 +1,17 @@ +autoconf +automake +bdf-unifont +bison +device-mapper +flex +freetype2 +gcc +gettext +glibc +libpciaccess +libusb +make +pciutils +python +qemu +sdl diff --git a/tools/dependencies/configs/parabola/x86_64/deps-i945-pwm b/tools/dependencies/configs/parabola/x86_64/deps-i945-pwm @@ -0,0 +1,5 @@ +gcc +gdb +pciutils +make +zlib diff --git a/tools/dependencies/configs/parabola/x86_64/deps-memtest86plus b/tools/dependencies/configs/parabola/x86_64/deps-memtest86plus @@ -0,0 +1,2 @@ +gcc +make diff --git a/tools/dependencies/configs/targets b/tools/dependencies/configs/targets @@ -0,0 +1,2 @@ +parabola +trisquel7 diff --git a/tools/dependencies/configs/trisquel7/i386/README b/tools/dependencies/configs/trisquel7/i386/README @@ -0,0 +1,24 @@ +Each file in this directory contains a list of dependencies that +should be installed before compiling the program indicated by the +filename's suffix, with a few exceptions; these exceptions being +"deps-documentation", "deps-download", and "deps-generic" for reasons +noted below: + +* "deps-documentation" contains a general list of packages that are + needed to build Libreboot documentation. +* "deps-download" contains packages necessary for downloading either + source code repositories and/or supporting files from a remote + source. +* "deps-generic" contains generic dependencies that didn't quite fit + (i.e. listed) under any of the other dependency lists but are + necessary nonetheless. + +It is expected that these files are updated whenever upstream projects +change dependency requirements. + +Any duplications between files are intentional; in order to provide a +clear picture as to which dependencies are needed by individual +programs, any attempt to consolidate these lists is dissuaded. + +This README is released under Creative Commons Zero 1.0: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/tools/dependencies/configs/trisquel7/i386/deps-bucts b/tools/dependencies/configs/trisquel7/i386/deps-bucts @@ -0,0 +1,6 @@ +gcc +libpci3 +libpci-dev +make +zlib1g +zlib1g-dev diff --git a/tools/dependencies/configs/trisquel7/i386/deps-coreboot b/tools/dependencies/configs/trisquel7/i386/deps-coreboot @@ -0,0 +1,13 @@ +bison +doxygen +flex +gcc +gdb +g++ +iasl +libncurses5 +libncurses5-dev +libssl-dev +make +ncurses-base +pkg-config diff --git a/tools/dependencies/configs/trisquel7/i386/deps-crossgcc-arm b/tools/dependencies/configs/trisquel7/i386/deps-crossgcc-arm @@ -0,0 +1 @@ +gcc-arm-linux-gnueabi diff --git a/tools/dependencies/configs/trisquel7/i386/deps-dejavu-fonts b/tools/dependencies/configs/trisquel7/i386/deps-dejavu-fonts @@ -0,0 +1,2 @@ +fontforge +libfont-ttf-perl diff --git a/tools/dependencies/configs/trisquel7/i386/deps-documentation b/tools/dependencies/configs/trisquel7/i386/deps-documentation @@ -0,0 +1 @@ +pandoc diff --git a/tools/dependencies/configs/trisquel7/i386/deps-download b/tools/dependencies/configs/trisquel7/i386/deps-download @@ -0,0 +1,2 @@ +git +wget diff --git a/tools/dependencies/configs/trisquel7/i386/deps-flashrom b/tools/dependencies/configs/trisquel7/i386/deps-flashrom @@ -0,0 +1,10 @@ +libftdi1 +libftdi-dev +libpci3 +libpci-dev +libusb-1.0-0 +libusb-1.0-0-dev +pciutils +pkg-config +zlib1g +zlib1g-dev diff --git a/tools/dependencies/configs/trisquel7/i386/deps-generic b/tools/dependencies/configs/trisquel7/i386/deps-generic @@ -0,0 +1,17 @@ +autogen +binutils +build-essential +coreutils +fakeroot +gawk +help2man +libfakeroot +libfaketime +libltdl-dev +liblzma-dev +libopts25 +libopts25-dev +libtool +m4 +texinfo +xz-utils diff --git a/tools/dependencies/configs/trisquel7/i386/deps-grub b/tools/dependencies/configs/trisquel7/i386/deps-grub @@ -0,0 +1,17 @@ +autoconf +automake +bison +flex +gcc +gettext +libdevmapper-dev +libfreetype6 +libfreetype6-dev +libpciaccess0 +libpciaccess-dev +libusb-1.0-0 +libusb-1.0-0-dev +python +qemu-system-x86 +ttf-unifont +xorriso diff --git a/tools/dependencies/configs/trisquel7/i386/deps-i945-pwm b/tools/dependencies/configs/trisquel7/i386/deps-i945-pwm @@ -0,0 +1,6 @@ +gcc +libpci3 +libpci-dev +make +zlib1g +zlib1g-dev diff --git a/tools/dependencies/configs/trisquel7/i386/deps-memtest86plus b/tools/dependencies/configs/trisquel7/i386/deps-memtest86plus @@ -0,0 +1,2 @@ +gcc +make diff --git a/tools/dependencies/configs/trisquel7/i686 b/tools/dependencies/configs/trisquel7/i686 @@ -0,0 +1 @@ +i386+ \ No newline at end of file diff --git a/tools/dependencies/configs/trisquel7/x86_64/README b/tools/dependencies/configs/trisquel7/x86_64/README @@ -0,0 +1,24 @@ +Each file in this directory contains a list of dependencies that +should be installed before compiling the program indicated by the +filename's suffix, with a few exceptions; these exceptions being +"deps-documentation", "deps-download", and "deps-generic" for reasons +noted below: + +* "deps-documentation" contains a general list of packages that are + needed to build Libreboot documentation. +* "deps-download" contains packages necessary for downloading either + source code repositories and/or supporting files from a remote + source. +* "deps-generic" contains generic dependencies that didn't quite fit + (i.e. listed) under any of the other dependency lists but are + necessary nonetheless. + +It is expected that these files are updated whenever upstream projects +change dependency requirements. + +Any duplications between files are intentional; in order to provide a +clear picture as to which dependencies are needed by individual +programs, any attempt to consolidate these lists is dissuaded. + +This README is released under Creative Commons Zero 1.0: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-bucts b/tools/dependencies/configs/trisquel7/x86_64/deps-bucts @@ -0,0 +1,6 @@ +gcc +libpci3 +libpci-dev +make +zlib1g +zlib1g-dev diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-coreboot b/tools/dependencies/configs/trisquel7/x86_64/deps-coreboot @@ -0,0 +1,13 @@ +bison +doxygen +flex +gcc +gdb +g++ +iasl +libncurses5 +libncurses5-dev +libssl-dev +make +ncurses-base +pkg-config diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-crossgcc-arm b/tools/dependencies/configs/trisquel7/x86_64/deps-crossgcc-arm @@ -0,0 +1 @@ +gcc-arm-linux-gnueabi diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-crossgcc-i386 b/tools/dependencies/configs/trisquel7/x86_64/deps-crossgcc-i386 @@ -0,0 +1,10 @@ +gcc-multilib +lib32ncurses5 +lib32ncurses5-dev +lib32stdc++6 +lib32tinfo-dev +lib32tinfo5 +lib32z1 +lib32z1-dev +libc6-dev-i386 +libc6-i386 diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-dejavu-fonts b/tools/dependencies/configs/trisquel7/x86_64/deps-dejavu-fonts @@ -0,0 +1,2 @@ +fontforge +libfont-ttf-perl diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-documentation b/tools/dependencies/configs/trisquel7/x86_64/deps-documentation @@ -0,0 +1 @@ +pandoc diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-download b/tools/dependencies/configs/trisquel7/x86_64/deps-download @@ -0,0 +1,2 @@ +git +wget diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-flashrom b/tools/dependencies/configs/trisquel7/x86_64/deps-flashrom @@ -0,0 +1,10 @@ +libftdi1 +libftdi-dev +libpci3 +libpci-dev +libusb-1.0-0 +libusb-1.0-0-dev +pciutils +pkg-config +zlib1g +zlib1g-dev diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-generic b/tools/dependencies/configs/trisquel7/x86_64/deps-generic @@ -0,0 +1,17 @@ +autogen +binutils +build-essential +coreutils +fakeroot +gawk +help2man +libfakeroot +libfaketime +libltdl-dev +liblzma-dev +libopts25 +libopts25-dev +libtool +m4 +texinfo +xz-utils diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-grub b/tools/dependencies/configs/trisquel7/x86_64/deps-grub @@ -0,0 +1,17 @@ +autoconf +automake +bison +flex +gcc +gettext +libdevmapper-dev +libfreetype6 +libfreetype6-dev +libpciaccess0 +libpciaccess-dev +libusb-1.0-0 +libusb-1.0-0-dev +python +qemu-system-x86 +ttf-unifont +xorriso diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-i945-pwm b/tools/dependencies/configs/trisquel7/x86_64/deps-i945-pwm @@ -0,0 +1,6 @@ +gcc +libpci3 +libpci-dev +make +zlib1g +zlib1g-dev diff --git a/tools/dependencies/configs/trisquel7/x86_64/deps-memtest86plus b/tools/dependencies/configs/trisquel7/x86_64/deps-memtest86plus @@ -0,0 +1,2 @@ +gcc +make diff --git a/tools/dependencies/dependencies b/tools/dependencies/dependencies @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# Copyright (C) 2017 Andrew Robbins <contact@andrewrobbins.info> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +arguments() { + tool_arguments_targets "${tool}" "$@" +} + +usage() { + tool_usage_actions "${tool}" 'print' + tool_usage_arguments "${tool}" "$@" +} + +print() { + local distro="$1" + + local arch="$(uname -i || uname -m)" + local tool_path="$(tool_path "${tool}")" + + if [[ -z "${arch}" ]]; then + printf '\n%s\n' 'uname(1) produced no output. Exiting' 1>&2 + + return 1 + fi + + dependencies_host_supported "${distro}" "${arch}" || return + + local -a dependencies + + for dependency_file in "${tool_path}/${CONFIGS}/${distro}/${arch}"/*; do + if [[ "${dependency_file##*/}" != 'README' ]]; then + local -i origin="${#dependencies[@]}" + + mapfile -tO "${origin}" dependencies < "${dependency_file}" + else + continue + fi + done + + local -a sorted + mapfile -t sorted < <(printf '%s\n' "${dependencies[@]}" | sort | uniq) + + dependencies_print "${distro}" "${sorted[@]}" +} diff --git a/tools/dependencies/dependencies-helper b/tools/dependencies/dependencies-helper @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +# Copyright (C) 2017 Andrew Robbins <contact@andrewrobbins.info> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +dependencies_print() { + local distro="$1" + shift + + if [[ "${distro}" == 'parabola' ]]; then + printf '\n%s\n' 'Enable the multilib repository in /etc/pacman.conf' + printf '\n%s\n' 'Then, run the following command as root:' + printf '\n%s%s\n' 'pacman -S --needed ' "$*" + else + printf '\n%s\n' 'You will need to run the following command as root:' + printf '\n%s%s\n' 'apt-get -y install ' "$*" + fi +} + +dependencies_host_supported() { + local distro="$1" + local arch="$2" + + dependencies_distro_supported "${distro}" || return + dependencies_arch_supported "${distro}" "${arch}" || return +} + +dependencies_arch_supported() { + local distro="$1" + local arch="$2" + + local tool_path="$(tool_path "${tool}")" + local distro_dir="${tool_path}/${CONFIGS}/${distro}" + + if ! [[ -d "${distro_dir}/${arch}" ]]; then + printf '\n%s\n' "Architecture \"${arch}\" is not supported" 1>&2 + + return 1 + fi +} + +dependencies_distro_supported() { + local distro="$1" + + local tool_path="$(tool_path "${tool}")" + local targets_path="${tool_path}/${CONFIGS}/${TARGETS}" + + local -a targets_list + mapfile -t targets_list < "${targets_path}" + + # Necessary to properly format the string for extglob use below + IFS='|' eval 'local distro_list="${targets_list[*]}"' + + if [[ "${distro}" != @(${distro_list}) ]]; then + printf '\n%s' "Argument \"${distro}\" is not supported. " 1>&2 + printf '%s\n' 'Check spelling?' 1>&2 + + usage + return 1 + fi +}