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.

57 lines
1.5 KiB

  1. # Copyright (C) 2022 Sergey V. Lobanov <sergey@lobanov.in>
  2. #
  3. # SPDX-License-Identifier: GPL-2.0-or-later
  4. include $(TOPDIR)/rules.mk
  5. PKG_NAME:=fakeuname
  6. PKG_RELEASE:=$(COMMITCOUNT)
  7. PKG_LICENSE:=GPL-2.0-or-later
  8. PKG_MAINTAINER:=Sergey V. Lobanov <sergey@lobanov.in>
  9. PKG_HOST_ONLY:=1
  10. define Package/fakeuname
  11. SECTION:=utils
  12. CATEGORY:=Utilities
  13. TITLE:=Fake uname host tool for cross-compile purposes
  14. BUILDONLY:=1
  15. endef
  16. define Package/fakeuname/description
  17. Fakeuname is a host tool for cross-compile cross-platform builds
  18. if configure or/and build scripts check uname output for target
  19. build and use invalid build flags. This tool should not be used
  20. in normal case if configure/build scripts allow to redefine
  21. required values instead of using uname output
  22. endef
  23. include $(INCLUDE_DIR)/kernel.mk
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/host-build.mk
  26. define Host/Configure
  27. endef
  28. define Host/Compile
  29. { \
  30. cat src/header.py.inc; \
  31. echo machine = \"$(ARCH)\"; \
  32. echo kernel_release = \"$(LINUX_UNAME_VERSION)\"; \
  33. echo kernel_version = \"#0 $(shell date --date=@$(SOURCE_DATE_EPOCH))\"; \
  34. cat src/footer.py.inc; \
  35. } > $(HOST_BUILD_DIR)/$(PKG_NAME)
  36. endef
  37. define Host/Install
  38. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/$(PKG_NAME)
  39. $(INSTALL_BIN) $(HOST_BUILD_DIR)/$(PKG_NAME) $(STAGING_DIR_HOSTPKG)/lib/$(PKG_NAME)/uname
  40. endef
  41. define Host/Clean
  42. rm -rf "$(STAGING_DIR_HOSTPKG)/lib/$(PKG_NAME)"
  43. endef
  44. $(eval $(call HostBuild))
  45. $(eval $(call BuildPackage,fakeuname))