[mmp] Use relative path in mmp script. (#7909)

* [mmp] Use relative path in mmp script.

Makes relocating mmp easier.

* [mmp] Resolve the right directory.

mmp might be in two locations (the second one works because the Commands
directory is a symlink to the actual bin directory):

* /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp
* /Library/Frameworks/Xamarin.Mac.framework/Commands/mmp

The mmp script didn't work properly in the latter case, because it would
calculate where to find the mmp.exe assembly based on real location the parent
directory (which would be /Library/Frameworks/Xamarin.Mac.framework), instead
of the real location of the directory where mmp is
(/Library/Frameworks/Xamarin.Mac.framework/Commands, which would resolve to
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin).

The fix is to just get the real path of the Commands directory, and compute
the location of the mmp.exe from there.
This commit is contained in:
Rolf Bjarne Kvinge 2020-02-25 06:57:15 +01:00 коммит произвёл GitHub
Родитель feb5e96c2a
Коммит e9ac84097a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 9 добавлений и 10 удалений

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

@ -30,9 +30,8 @@ MMP_DIRECTORIES = \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/mmp: mmp.in | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin
$(Q_GEN) sed 's!@XAMARIN_MAC_PREFIX@!$(abspath $(MAC_TARGETDIR)$(MAC_FRAMEWORK_CURRENT_DIR))!g' $< > $@
$(Q) chmod +x $@
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/mmp: mmp | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin
$(Q) $(CP) $< $@
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/mmp.exe: $(MMP_DIR)/mmp.exe | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp
$(Q) $(CP) $(dir $<)/*.exe $(dir $@)
@ -71,10 +70,6 @@ install-local:: $(MMP_TARGETS)
all-local:: $(MMP_TARGETS)
endif
mmp: \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/mmp \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/mmp.exe \
clean-local::
rm -f mmp.stub.c mmp.helper.o
rm -rf bin obj

7
tools/mmp/mmp Executable file
Просмотреть файл

@ -0,0 +1,7 @@
#!/bin/bash -e
pushd "$(dirname "$0")" > /dev/null
BIN_DIR=$(pwd -P)
popd > /dev/null
exec /Library/Frameworks/Mono.framework/Commands/mono --debug "$BIN_DIR/../lib/mmp/mmp.exe" "$@"

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

@ -1,3 +0,0 @@
#!/bin/sh
exec /Library/Frameworks/Mono.framework/Commands/mono --debug @XAMARIN_MAC_PREFIX@/lib/mmp/mmp.exe "$@"