android-tools.mk 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ################################################################################
  2. #
  3. # android-tools
  4. #
  5. ################################################################################
  6. ANDROID_TOOLS_SITE = https://launchpad.net/ubuntu/+archive/primary/+files
  7. ANDROID_TOOLS_VERSION = 4.2.2+git20130218
  8. ANDROID_TOOLS_SOURCE = android-tools_$(ANDROID_TOOLS_VERSION).orig.tar.xz
  9. ANDROID_TOOLS_EXTRA_DOWNLOADS = android-tools_$(ANDROID_TOOLS_VERSION)-3ubuntu41.debian.tar.gz
  10. HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS = $(ANDROID_TOOLS_EXTRA_DOWNLOADS)
  11. ANDROID_TOOLS_LICENSE = Apache-2.0
  12. ANDROID_TOOLS_LICENSE_FILES = debian/copyright
  13. # Extract the Debian tarball inside the sources
  14. define ANDROID_TOOLS_DEBIAN_EXTRACT
  15. $(call suitable-extractor,$(notdir $(ANDROID_TOOLS_EXTRA_DOWNLOADS))) \
  16. $(ANDROID_TOOLS_DL_DIR)/$(notdir $(ANDROID_TOOLS_EXTRA_DOWNLOADS)) | \
  17. $(TAR) -C $(@D) $(TAR_OPTIONS) -
  18. endef
  19. HOST_ANDROID_TOOLS_POST_EXTRACT_HOOKS += ANDROID_TOOLS_DEBIAN_EXTRACT
  20. ANDROID_TOOLS_POST_EXTRACT_HOOKS += ANDROID_TOOLS_DEBIAN_EXTRACT
  21. # Apply the Debian patches before applying the Buildroot patches
  22. define ANDROID_TOOLS_DEBIAN_PATCH
  23. $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*
  24. endef
  25. HOST_ANDROID_TOOLS_PRE_PATCH_HOOKS += ANDROID_TOOLS_DEBIAN_PATCH
  26. ANDROID_TOOLS_PRE_PATCH_HOOKS += ANDROID_TOOLS_DEBIAN_PATCH
  27. ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT),y)
  28. HOST_ANDROID_TOOLS_TARGETS += fastboot
  29. HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux
  30. endif
  31. ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB),y)
  32. HOST_ANDROID_TOOLS_TARGETS += adb
  33. HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-openssl
  34. endif
  35. ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT),y)
  36. ANDROID_TOOLS_TARGETS += fastboot
  37. ANDROID_TOOLS_DEPENDENCIES += zlib libselinux
  38. endif
  39. ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_ADB),y)
  40. ANDROID_TOOLS_TARGETS += adb
  41. ANDROID_TOOLS_DEPENDENCIES += zlib openssl
  42. endif
  43. ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_ADBD),y)
  44. ANDROID_TOOLS_TARGETS += adbd
  45. ANDROID_TOOLS_DEPENDENCIES += zlib openssl
  46. endif
  47. # Build each tool in its own directory not to share object files
  48. define HOST_ANDROID_TOOLS_BUILD_CMDS
  49. $(foreach t,$(HOST_ANDROID_TOOLS_TARGETS),\
  50. mkdir -p $(@D)/build-$(t) && \
  51. $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
  52. -C $(@D)/build-$(t) -f $(@D)/debian/makefiles/$(t).mk$(sep))
  53. endef
  54. define ANDROID_TOOLS_BUILD_CMDS
  55. $(foreach t,$(ANDROID_TOOLS_TARGETS),\
  56. mkdir -p $(@D)/build-$(t) && \
  57. $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
  58. -C $(@D)/build-$(t) -f $(@D)/debian/makefiles/$(t).mk$(sep))
  59. endef
  60. define HOST_ANDROID_TOOLS_INSTALL_CMDS
  61. $(foreach t,$(HOST_ANDROID_TOOLS_TARGETS),\
  62. $(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(HOST_DIR)/bin/$(t)$(sep))
  63. endef
  64. define ANDROID_TOOLS_INSTALL_TARGET_CMDS
  65. $(foreach t,$(ANDROID_TOOLS_TARGETS),\
  66. $(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(TARGET_DIR)/usr/bin/$(t)$(sep))
  67. endef
  68. $(eval $(host-generic-package))
  69. $(eval $(generic-package))