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.

114 lines
3.6 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=oci-runtime-tools
  3. PKG_VERSION:=1.0.0-pre20210326
  4. PKG_RELEASE:=$(AUTORELEASE)
  5. PKG_LICENSE:=Apache-2.0
  6. PKG_LICENSE_FILES:=LICENSE
  7. PKG_SOURCE_PROTO:=git
  8. PKG_SOURCE_NAME:=runtime-tools
  9. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  10. PKG_SOURCE_URL:=https://github.com/opencontainers/runtime-tools.git
  11. PKG_SOURCE_VERSION:=59cdde06764be8d761db120664020f0415f36045
  12. PKG_MIRROR_HASH:=ef331e3ad5f99220583399fe1c2ded243f4b01f8dabc7acd152d46304da70f6f
  13. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  14. PKG_BUILD_DEPENDS:=golang/host
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_USE_MIPS16:=0
  17. GO_PKG:=github.com/opencontainers/runtime-tools/
  18. GO_PKG_LDFLAGS_X:=main.gitCommit=$(PKG_SOURCE_VERSION) main.version=$(PKG_SOURCE_VERSION)
  19. BUSYBOX_STATIC_VERSION:=1.31.0
  20. include $(INCLUDE_DIR)/package.mk
  21. include ../../lang/golang/golang-package.mk
  22. define Download/busybox-static-armv8l
  23. URL:=https://busybox.net/downloads/binaries/$$(BUSYBOX_STATIC_VERSION)-defconfig-multiarch-musl/
  24. URL_FILE:=busybox-armv8l
  25. FILE:=busybox-$(BUSYBOX_STATIC_VERSION)-static-armv8l
  26. HASH:=141adb1b625a6f44c4b114f76b4387b4ea4f7ab802b88eb40e0d2f6adcccb1c3
  27. endef
  28. define Package/oci-runtime-tool
  29. SECTION:=utils
  30. CATEGORY:=Utilities
  31. TITLE:=oci-runtime-tool
  32. URL:=https://github.com/opencontainers/runtime-tools
  33. DEPENDS:=$(GO_ARCH_DEPENDS)
  34. endef
  35. define Package/oci-runtime-tool/description
  36. OCI (Open Container Initiative) runtime tools
  37. Generate OCI runtime spec configuration files and validate OCI bundles.
  38. endef
  39. define Package/oci-runtime-tests
  40. SECTION:=utils
  41. CATEGORY:=Utilities
  42. TITLE:=OCI runtimetest tool
  43. URL:=https://github.com/opencontainers/runtime-tools
  44. DEPENDS:=@(aarch64||i386||i686||x86_64) oci-runtime-tool +tar
  45. endef
  46. define Package/oci-runtime-tests/description
  47. OCI (Open Container Initiative) runtime tools
  48. This package provides test cases as well as artifacts required to
  49. validate an OCI runtime.
  50. Best used in combination with a TAP consumer like 'node-tap',
  51. installable via npm.
  52. endef
  53. GO_PKG_BUILD_VARS += GO111MODULE=auto
  54. define Build/Prepare
  55. $(call Build/Prepare/Default)
  56. ifdef CONFIG_aarch64
  57. $(eval $(call Download,busybox-static-armv8l))
  58. ( \
  59. mkdir -p $(PKG_BUILD_DIR)/rootfs-armv8l ;\
  60. cd $(PKG_BUILD_DIR)/rootfs-armv8l ;\
  61. $(TAR) xzf ../rootfs-amd64.tar.gz ;\
  62. $(CP) $(DL_DIR)/busybox-$(BUSYBOX_STATIC_VERSION)-static-armv8l bin/busybox ;\
  63. chmod 0755 bin/busybox ;\
  64. $(TAR) czf ../rootfs-arm64.tar.gz . ;\
  65. )
  66. endif
  67. endef
  68. define Build/Compile
  69. $(call GoPackage/Build/Compile)
  70. $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  71. endef
  72. define Package/oci-runtime-tool/install
  73. $(INSTALL_DIR) $(1)/usr/bin
  74. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/oci-runtime-tool $(1)/usr/bin
  75. endef
  76. define Package/oci-runtime-tests/install
  77. $(INSTALL_DIR) $(1)/usr/libexec/oci-runtime-test
  78. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/runtimetest $(1)/usr/libexec/oci-runtime-test/
  79. ( cd $(PKG_BUILD_DIR) ; $(FIND) ./validation/ -name *.go | grep -v util | \
  80. xargs -I'%' -n 1 basename % .go | while read testbin; do \
  81. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$${testbin} \
  82. $(1)/usr/libexec/oci-runtime-test/$$$${testbin}.t ; \
  83. done )
  84. ifdef CONFIG_x86
  85. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rootfs-386.tar.gz $(1)/usr/libexec/oci-runtime-test
  86. ifdef CONFIG_x86_64
  87. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rootfs-amd64.tar.gz $(1)/usr/libexec/oci-runtime-test
  88. endif
  89. endif
  90. ifdef CONFIG_aarch64
  91. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rootfs-arm64.tar.gz $(1)/usr/libexec/oci-runtime-test
  92. endif
  93. endef
  94. $(eval $(call GoBinPackage,oci-runtime-tools))
  95. $(eval $(call BuildPackage,oci-runtime-tool))
  96. $(eval $(call BuildPackage,oci-runtime-tests))