Skip to content

Commit dca8870

Browse files
committed
mk: install-runtime-target added to install.mk (pushing shared library to android target)
1 parent bfccfdc commit dca8870

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

mk/install.mk

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,66 @@ uninstall:
154154
done
155155
$(Q)rm -Rf $(PHL)/rustc
156156
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustc.1
157+
158+
# target platform specific variables
159+
# for arm-linux-androidabi
160+
define DEF_ADB_STATUS
161+
CFG_ADB_DEVICE=$(1)
162+
endef
163+
164+
$(foreach target,$(CFG_TARGET_TRIPLES), \
165+
$(if $(findstring $(target),"arm-linux-androideabi"), \
166+
$(if $(findstring adb,$(shell which adb)), \
167+
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[A-Za-z0-9]+[[:blank:]]+device')), \
168+
$(info install: install-runtime-target for arm-linux-androideabi enabled \
169+
$(info install: android device attached) \
170+
$(eval $(call DEF_ADB_STATUS, true))), \
171+
$(info install: install-runtime-target for arm-linux-androideabi disabled \
172+
$(info install: android device not attached) \
173+
$(eval $(call DEF_ADB_STATUS, false))) \
174+
), \
175+
$(info install: install-runtime-target for arm-linux-androideabi disabled \
176+
$(info install: adb not found) \
177+
$(eval $(call DEF_ADB_STATUS, false))) \
178+
), \
179+
) \
180+
)
181+
182+
ifeq ($(CFG_ADB_DEVICE),true)
183+
184+
ifdef VERBOSE
185+
ADB = adb $(1)
186+
ADB_PUSH = adb push $(1) $(2)
187+
ADB_SHELL = adb shell $(1) $(2)
188+
else
189+
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null 2>/dev/null
190+
ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null 2>/dev/null
191+
ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null 2>/dev/null
192+
endif
193+
194+
define INSTALL_RUNTIME_TARGET_N
195+
install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
196+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CFG_RUNTIME_$(1)),/system/lib)
197+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CORELIB_GLOB_$(1)),/system/lib)
198+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(STDLIB_GLOB_$(1)),/system/lib)
199+
endef
200+
201+
define INSTALL_RUNTIME_TARGET_CLEANUP_N
202+
install-runtime-target-$(1)-cleanup:
203+
$(Q)$(call ADB,remount)
204+
$(Q)$(call ADB_SHELL,rm,/system/lib/$(CFG_RUNTIME_$(1)))
205+
$(Q)$(call ADB_SHELL,rm,/system/lib/$(CORELIB_GLOB_$(1)))
206+
$(Q)$(call ADB_SHELL,rm,/system/lib/$(STDLIB_GLOB_$(1)))
207+
endef
208+
209+
$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD_TRIPLE)))
210+
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
211+
212+
install-runtime-target: \
213+
install-runtime-target-arm-linux-androideabi-cleanup \
214+
install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD_TRIPLE)
215+
216+
else
217+
install-runtime-target:
218+
@echo
219+
endif

0 commit comments

Comments
 (0)