[install] Add `make install` target (#684)

The `make install` target can be used on Unixy platforms to install
Xamarin.Android into a system-wide location. By default it installs
into a prefix of `/usr/local`:

	make install

The prefix may be changed by overriding the `$(prefix)` make variable:

	# Install system-wide
	make install prefix=/usr

Installation is performed by copying the contents of
`bin/$(CONFIGURATION)` into `$(prefix)/lib/xamarin.android`.

Only `xabuild` is installed into `$(prefix)/bin` and (presumably)
accessible within `$PATH`.
This commit is contained in:
Tim Wanders 2017-07-03 19:09:22 +02:00 коммит произвёл Jonathan Pryor
Родитель 73eb76caa9
Коммит b34193c25c
3 изменённых файлов: 29 добавлений и 5 удалений

Просмотреть файл

@ -2,6 +2,7 @@ export OS := $(shell uname)
export OS_ARCH := $(shell uname -m)
export NO_SUDO ?= false
V ?= 0
prefix = /usr/local
CONFIGURATION = Debug
RUNTIME := $(shell if [ -f "`which mono64`" ] ; then echo mono64 ; else echo mono; fi) --debug=casts
SOLUTION = Xamarin.Android.sln
@ -25,7 +26,27 @@ all::
all-tests::
MSBUILD="$(MSBUILD)" tools/scripts/xabuild $(MSBUILD_FLAGS) Xamarin.Android-Tests.sln
install::
@if [ ! -d "bin/$(CONFIGURATION)" ]; then \
echo "run 'make all' before you execute 'make install'!"; \
exit 1; \
fi
-mkdir -p "$(prefix)/lib/mono/xbuild-frameworks"
-mkdir -p "$(prefix)/lib/xamarin.android"
-mkdir -p "$(prefix)/lib/mono/xbuild/Xamarin/"
cp -a "bin/$(CONFIGURATION)/." "$(prefix)/lib/xamarin.android/"
cp tools/scripts/xabuild "$(prefix)/bin/xabuild"
-rm "$(prefix)/lib/mono/xbuild/Xamarin/Android"
-rm "$(prefix)/lib/mono/xbuild-frameworks/MonoAndroid"
ln -s "$(prefix)/lib/xamarin.android/lib/xbuild/Xamarin/Android/" "$(prefix)/lib/mono/xbuild/Xamarin/Android"
ln -s "$(prefix)/lib/xamarin.android/lib/xbuild-frameworks/MonoAndroid/" "$(prefix)/lib/mono/xbuild-frameworks/MonoAndroid"
uninstall::
rm -rf "$(prefix)/lib/xamarin.android/" "$(prefix)/bin/xabuild"
rm "$(prefix)/lib/mono/xbuild/Xamarin/Android"
rm "$(prefix)/lib/mono/xbuild-frameworks/MonoAndroid"
ifeq ($(OS),Linux)
export LINUX_DISTRO := $(shell lsb_release -i -s || true)
export LINUX_DISTRO_RELEASE := $(shell lsb_release -r -s || true)
@ -33,7 +54,7 @@ prepare:: linux-prepare
endif # $(OS)=Linux
prepare:: prepare-msbuild
linux-prepare::
BINFMT_MISC_TROUBLE="cli win" \
BINFMT_WARN=no ; \

Просмотреть файл

@ -29,10 +29,11 @@ ARCH_DEPS="autoconf
texinfo
unzip
which
zip
xxd
"
if [ $NO_SUDO = "false" ]; then
sudo pacman -S --noconfirm $ARCH_DEPS
sudo pacman -S --noconfirm --needed $ARCH_DEPS
else
echo "Sudo is required!"
fi

Просмотреть файл

@ -72,8 +72,10 @@ if [[ "$prefix" == */tools/scripts ]] ; then
exit 1
fi
prefix="$real_prefix"
xa_prefix="$real_prefix"
elif [[ "$prefix" == */bin ]] ; then
prefix="$prefix/.."
xa_prefix="$prefix/../lib/xamarin.android"
else
(>&2 echo "$name: Could not determine Xamarin.Android prefix.")
exit 1
@ -109,8 +111,8 @@ fi
declare -a XABUILD_FLAGS
XABUILD_FLAGS=(
/p:MonoAndroidBinDirectory="$prefix/bin"
/p:MonoAndroidToolsDirectory="$prefix/lib/mandroid"
/p:MonoAndroidBinDirectory="$xa_prefix/bin"
/p:MonoAndroidToolsDirectory="$xa_prefix/lib/mandroid"
/p:MonoDroidInstallDirectory="$MONO_ANDROID_PATH"
)