From fd77e441e359e543a8da6baaa7e8b00155572b33 Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Tue, 9 Aug 2016 18:12:28 +0200 Subject: [PATCH] Make package installation on Linux optional Xamarin.Android needs a number of packages to be installed on Linux in order to build properly. The makefile provides support for that but it requires using `sudo` to invoke the package installer. That may not be desired on build bots and so this commit makes package installation optional. In order to avoid package installation invoke make like so: make NO_SUDO=true prepare In this mode the makefile will merely report the installation status of all the dependency packages instead of installing them. --- Makefile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Makefile b/Makefile index bbe4bb981f2..5a7d72d6bfb 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,8 @@ include build-tools/scripts/BuildEverything.mk # Please keep the package names sorted ifeq ($(OS),Linux) +NO_SUDO ?= false + UBUNTU_DEPS = \ autoconf \ autotools-dev \ @@ -84,10 +86,34 @@ prepare:: linux-prepare-$(LINUX_DISTRO) linux-prepare-$(LINUX_DISTRO)-$(LINUX_DI cat Documentation/binfmt_misc-warning-Linux.txt ; \ fi +ifeq ($(NO_SUDO),false) linux-prepare-Ubuntu:: + @echo @echo Installing build depedencies for $(LINUX_DISTRO) @echo Will use sudo, please provide your password as needed + @echo sudo apt-get -f -u install $(UBUNTU_DEPS) +else +linux-prepare-Ubuntu:: + @echo + @echo sudo is disabled, cannot install dependencies + @echo Listing status of all the dependencies + @PACKAGES_MISSING=no ; \ + for p in $(UBUNTU_DEPS); do \ + if dpkg -l $$p > /dev/null 2>&1 ; then \ + echo "[INSTALLED] $$p" ; \ + else \ + echo "[ MISSING ] $$p" ; \ + PACKAGES_MISSING=yes ; \ + fi ; \ + done ; \ + echo ; \ + if [ "x$$PACKAGES_MISSING" = "xyes" ]; then \ + echo Some packages are missing, cannot continue ; \ + echo ; \ + false ; \ + fi +endif linux-prepare-$(LINUX_DISTRO)::