common.mk 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #
  2. # Copyright (C) 2012-2013 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/target.mk
  9. PKG_NAME:=musl
  10. PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION))
  11. PKG_RELEASE=1
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  14. PKG_SOURCE_VERSION:=769f53598e781ffc89191520f3f8a93cb58db91f
  15. PKG_MIRROR_HASH:=c148c570cc46471ab30a1b36e96531519837e41c4347f3164bf610ab98741d80
  16. PKG_SOURCE_URL:=git://git.musl-libc.org/musl
  17. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  18. LIBC_SO_VERSION:=$(PKG_VERSION)
  19. PATCH_DIR:=$(PATH_PREFIX)/patches
  20. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
  21. include $(INCLUDE_DIR)/toolchain-build.mk
  22. include $(INCLUDE_DIR)/hardening.mk
  23. MUSL_CONFIGURE:= \
  24. $(TARGET_CONFIGURE_OPTS) \
  25. CFLAGS="$(TARGET_CFLAGS)" \
  26. CROSS_COMPILE="$(TARGET_CROSS)" \
  27. $(HOST_BUILD_DIR)/configure \
  28. --prefix=/ \
  29. --host=$(GNU_HOST_NAME) \
  30. --target=$(REAL_GNU_TARGET_NAME) \
  31. --disable-gcc-wrapper \
  32. --enable-debug
  33. define Host/Prepare
  34. $(call Host/Prepare/Default)
  35. $(if $(strip $(QUILT)), \
  36. cd $(HOST_BUILD_DIR); \
  37. if $(QUILT_CMD) next >/dev/null 2>&1; then \
  38. $(QUILT_CMD) push -a; \
  39. fi
  40. )
  41. ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  42. endef
  43. define Host/Configure
  44. ( cd $(HOST_BUILD_DIR); rm -f config.cache; \
  45. $(MUSL_CONFIGURE) \
  46. );
  47. endef
  48. define Host/Clean
  49. rm -rf \
  50. $(HOST_BUILD_DIR) \
  51. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
  52. $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
  53. endef