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