android-tools.mk 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. ANDROID_TOOLS_DEPENDENCIES = host-pkgconf
  14. HOST_ANDROID_TOOLS_DEPENDENCIES = host-pkgconf
  15. # Extract the Debian tarball inside the sources
  16. define ANDROID_TOOLS_DEBIAN_EXTRACT
  17. $(call suitable-extractor,$(notdir $(ANDROID_TOOLS_EXTRA_DOWNLOADS))) \
  18. $(ANDROID_TOOLS_DL_DIR)/$(notdir $(ANDROID_TOOLS_EXTRA_DOWNLOADS)) | \
  19. $(TAR) -C $(@D) $(TAR_OPTIONS) -
  20. endef
  21. HOST_ANDROID_TOOLS_POST_EXTRACT_HOOKS += ANDROID_TOOLS_DEBIAN_EXTRACT
  22. ANDROID_TOOLS_POST_EXTRACT_HOOKS += ANDROID_TOOLS_DEBIAN_EXTRACT
  23. # Apply the Debian patches before applying the Buildroot patches
  24. define ANDROID_TOOLS_DEBIAN_PATCH
  25. $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*
  26. endef
  27. HOST_ANDROID_TOOLS_PRE_PATCH_HOOKS += ANDROID_TOOLS_DEBIAN_PATCH
  28. ANDROID_TOOLS_PRE_PATCH_HOOKS += ANDROID_TOOLS_DEBIAN_PATCH
  29. ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT),y)
  30. HOST_ANDROID_TOOLS_BUILD_TARGETS += fastboot
  31. HOST_ANDROID_TOOLS_INSTALL_TARGETS += build-fastboot/fastboot
  32. HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux
  33. endif
  34. ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB),y)
  35. HOST_ANDROID_TOOLS_BUILD_TARGETS += adb
  36. HOST_ANDROID_TOOLS_INSTALL_TARGETS += build-adb/adb
  37. HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-openssl
  38. endif
  39. ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS),y)
  40. HOST_ANDROID_TOOLS_BUILD_TARGETS += ext4_utils
  41. HOST_ANDROID_TOOLS_INSTALL_TARGETS += \
  42. $(addprefix build-ext4_utils/,make_ext4fs ext4fixup ext2simg img2simg simg2img simg2simg)
  43. HOST_ANDROID_TOOLS_DEPENDENCIES += host-libselinux
  44. endif
  45. ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT),y)
  46. ANDROID_TOOLS_TARGETS += fastboot
  47. ANDROID_TOOLS_DEPENDENCIES += zlib libselinux
  48. endif
  49. ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_ADB),y)
  50. ANDROID_TOOLS_TARGETS += adb
  51. ANDROID_TOOLS_DEPENDENCIES += zlib openssl
  52. endif
  53. ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_ADBD),y)
  54. ANDROID_TOOLS_TARGETS += adbd
  55. ANDROID_TOOLS_DEPENDENCIES += zlib openssl
  56. endif
  57. # Build each tool in its own directory not to share object files
  58. define HOST_ANDROID_TOOLS_BUILD_CMDS
  59. $(foreach t,$(HOST_ANDROID_TOOLS_BUILD_TARGETS),\
  60. mkdir -p $(@D)/build-$(t) && \
  61. $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
  62. -C $(@D)/build-$(t) -f $(@D)/debian/makefiles/$(t).mk$(sep))
  63. endef
  64. define ANDROID_TOOLS_BUILD_CMDS
  65. $(foreach t,$(ANDROID_TOOLS_TARGETS),\
  66. mkdir -p $(@D)/build-$(t) && \
  67. $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
  68. -C $(@D)/build-$(t) -f $(@D)/debian/makefiles/$(t).mk$(sep))
  69. endef
  70. define HOST_ANDROID_TOOLS_INSTALL_CMDS
  71. $(foreach t,$(HOST_ANDROID_TOOLS_INSTALL_TARGETS),\
  72. $(INSTALL) -D -m 0755 $(@D)/$(t) $(HOST_DIR)/bin/$(notdir $(t))$(sep))
  73. endef
  74. define ANDROID_TOOLS_INSTALL_TARGET_CMDS
  75. $(foreach t,$(ANDROID_TOOLS_TARGETS),\
  76. $(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(TARGET_DIR)/usr/bin/$(t)$(sep))
  77. endef
  78. $(eval $(generic-package))
  79. $(eval $(host-generic-package))