You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.4KB

  1. # This file is part of MXE. See LICENSE.md for licensing information.
  2. PKG := ccache
  3. $(PKG)_WEBSITE := https://ccache.samba.org
  4. $(PKG)_DESCR := ccache – a fast compiler cache
  5. $(PKG)_IGNORE :=
  6. $(PKG)_VERSION := 3.6
  7. $(PKG)_CHECKSUM := a6b129576328fcefad00cb72035bc87bc98b6a76aec0f4b59bed76d67a399b1f
  8. $(PKG)_SUBDIR := ccache-$($(PKG)_VERSION)
  9. $(PKG)_FILE := ccache-$($(PKG)_VERSION).tar.xz
  10. $(PKG)_URL := https://www.samba.org/ftp/ccache/ccache-$($(PKG)_VERSION).tar.xz
  11. $(PKG)_DEPS := $(BUILD)~$(PKG)
  12. $(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS)
  13. $(PKG)_DEPS_$(BUILD) :=
  14. define $(PKG)_UPDATE
  15. $(call GET_LATEST_VERSION, https://www.samba.org/ftp/ccache)
  16. endef
  17. BOOTSTRAP_PKGS += ccache
  18. $(PKG)_SYS_CONF := $(MXE_CCACHE_DIR)/etc/$(PKG).conf
  19. $(PKG)_USR_CONF := $(MXE_CCACHE_DIR)/$(PKG).conf
  20. ifeq (mxe,$(MXE_USE_CCACHE))
  21. define $(PKG)_BUILD_$(BUILD)
  22. # remove any previous symlinks
  23. rm -fv '$(PREFIX)/$(BUILD)/bin/$(BUILD_CC)' '$(PREFIX)/$(BUILD)/bin/$(BUILD_CXX)'
  24. # minimal reqs build with bundled zlib
  25. cd '$(BUILD_DIR)' && $(SOURCE_DIR)/configure \
  26. $(MXE_CONFIGURE_OPTS) \
  27. --with-bundled-zlib \
  28. --disable-man \
  29. --prefix='$(MXE_CCACHE_DIR)' \
  30. --sysconfdir='$(dir $($(PKG)_SYS_CONF))'
  31. $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' $(MXE_DISABLE_DOCS)
  32. $(MAKE) -C '$(BUILD_DIR)' -j 1 install $(MXE_DISABLE_DOCS)
  33. # setup symlinks
  34. ln -sf '$(MXE_CCACHE_DIR)/bin/ccache' '$(PREFIX)/$(BUILD)/bin/$(BUILD_CC)'
  35. ln -sf '$(MXE_CCACHE_DIR)/bin/ccache' '$(PREFIX)/$(BUILD)/bin/$(BUILD_CXX)'
  36. # https://ccache.samba.org/manual/latest.html#_configuration_settings
  37. # always set/replace mxe `system` config
  38. mkdir -p '$(dir $($(PKG)_SYS_CONF))'
  39. (echo '# ccache system config'; \
  40. echo '# this file is controlled by mxe, user config is in:'; \
  41. echo '# $($(PKG)_USR_CONF)'; \
  42. echo; \
  43. echo 'base_dir = $(MXE_CCACHE_BASE_DIR)'; \
  44. echo 'cache_dir = $(MXE_CCACHE_DIR)'; \
  45. echo 'compiler_check = %compiler% -v'; \
  46. ) > '$($(PKG)_SYS_CONF)'
  47. # leave user config alone if set
  48. [ -f '$($(PKG)_USR_CONF)' ] || \
  49. (mkdir -p '$(dir $($(PKG)_USR_CONF))' && \
  50. (echo '# ccache user config'; \
  51. echo '# https://ccache.samba.org/manual/latest.html#_configuration_settings'; \
  52. echo '# system config: $($(PKG)_SYS_CONF)'; \
  53. echo; \
  54. echo 'max_size = 20.0G'; \
  55. ) > '$($(PKG)_USR_CONF)')
  56. endef
  57. define $(PKG)_BUILD
  58. # setup symlinks
  59. ln -sf '$(MXE_CCACHE_DIR)/bin/ccache' '$(PREFIX)/$(BUILD)/bin/$(TARGET)-gcc'
  60. ln -sf '$(MXE_CCACHE_DIR)/bin/ccache' '$(PREFIX)/$(BUILD)/bin/$(TARGET)-g++'
  61. # setup cmake toolchain to allow runtime override
  62. # CMAKE_CXX_COMPILER_LAUNCHER shows original cc and isn't clear in logs etc.
  63. mkdir -p '$(CMAKE_TOOLCHAIN_DIR)'
  64. (echo 'option(MXE_USE_CCACHE "Enable ccache by default" ON)'; \
  65. echo 'if(MXE_USE_CCACHE)'; \
  66. echo ' set(CMAKE_C_COMPILER $(PREFIX)/$(BUILD)/bin/$(TARGET)-gcc)'; \
  67. echo ' set(CMAKE_CXX_COMPILER $(PREFIX)/$(BUILD)/bin/$(TARGET)-g++)'; \
  68. echo 'endif()'; \
  69. ) > '$(CMAKE_TOOLCHAIN_DIR)/$(PKG).cmake'
  70. endef
  71. else
  72. define $(PKG)_BUILD_$(BUILD)
  73. # remove symlinks
  74. rm -fv '$(PREFIX)/$(BUILD)/bin/$(BUILD_CC)' '$(PREFIX)/$(BUILD)/bin/$(BUILD_CXX)'
  75. endef
  76. define $(PKG)_BUILD
  77. # remove symlinks and cmake toolchain
  78. rm -fv '$(PREFIX)/$(BUILD)/bin/$(TARGET)-'*
  79. rm -fv '$(CMAKE_TOOLCHAIN_DIR)/$(PKG).cmake'
  80. endef
  81. endif