Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #
  2. # Copyright (C) 2006-2016 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. PKG_NAME:=llvm-project
  9. PKG_VERSION:=15.0.7
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
  12. PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
  13. PKG_HASH:=8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6
  14. PKG_CPE_ID:=cpe:/a:llvm:llvm
  15. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src
  16. CMAKE_BINARY_SUBDIR := build
  17. CMAKE_SOURCE_SUBDIR := llvm
  18. include $(INCLUDE_DIR)/host-build.mk
  19. include $(INCLUDE_DIR)/cmake.mk
  20. LLVM_BPF_PREFIX = llvm-bpf-$(PKG_VERSION).$(HOST_OS)-$(HOST_ARCH)
  21. CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/$(LLVM_BPF_PREFIX)
  22. CMAKE_HOST_OPTIONS += \
  23. -DLLVM_ENABLE_BINDINGS=OFF \
  24. -DLLVM_INCLUDE_DOCS=OFF \
  25. -DLLVM_INCLUDE_EXAMPLES=OFF \
  26. -DLLVM_INCLUDE_TESTS=OFF \
  27. -DLLVM_ENABLE_PROJECTS="clang;lld" \
  28. -DLLVM_TARGETS_TO_BUILD=BPF \
  29. -DCLANG_BUILD_EXAMPLES=OFF \
  30. -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
  31. -DLLVM_LINK_LLVM_DYLIB=ON \
  32. -DLLVM_TOOLCHAIN_TOOLS="llvm-objcopy;llvm-objdump;llvm-readelf;llvm-strip;llvm-ar;llvm-as;llvm-dis;llvm-link;llvm-nm;llvm-ranlib;llc;opt" \
  33. -DCMAKE_SKIP_RPATH=OFF
  34. define Host/Install
  35. rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
  36. $(Host/Install/Default)
  37. ln -s $(LLVM_BPF_PREFIX) $(STAGING_DIR_HOST)/llvm-bpf
  38. STRIP_KMOD= PATCHELF= STRIP=strip $(SCRIPT_DIR)/rstrip.sh $(STAGING_DIR_HOST)/llvm-bpf
  39. echo "$(PKG_VERSION)" > $(CMAKE_HOST_INSTALL_PREFIX)/.llvm-version
  40. endef
  41. define Host/Uninstall
  42. rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
  43. endef
  44. $(eval $(call HostBuild))