未验证 提交 6ff19d01 编写于 作者: H haosanzi 提交者: GitHub

rune && shim: Introduce make package

This rule enables building package useable for the running system.
Signed-off-by: Nshirong <shirong@linux.alibaba.com>
上级 11ec5ace
......@@ -5,3 +5,4 @@ _output/
shim/bin/
shim/.idea/
*.rpm
*.deb
.PHONY: all install clean uninstall rpm
.PHONY: all install clean uninstall package
export INCLAVARE_CONTAINERS_VERSION := $(shell cat ./VERSION)
components := rune shim sgx-tools
rpm_release_components := rune shim
dist_release_components := rune shim
all:
for name in $(components); do \
......@@ -24,7 +24,7 @@ uninstall:
$(MAKE) -C $$name uninstall; \
done
rpm:
for name in $(rpm_release_components); do \
$(MAKE) -C $$name rpm; \
package:
for name in $(dist_release_components); do \
$(MAKE) -C $$name package; \
done
......@@ -161,11 +161,11 @@ localcross:
CGO_ENABLED=1 GOARCH=arm64 CC=aarch64-linux-gnu-gcc $(GO_BUILD) -o runc-arm64 .
CGO_ENABLED=1 GOARCH=ppc64le CC=powerpc64le-linux-gnu-gcc $(GO_BUILD) -o runc-ppc64le .
rpm:
$(MAKE) -C dist rpm
package:
$(MAKE) -C dist package
.PHONY: rune all recvtty static release dbuild lint man runcimage \
test localtest unittest localunittest integration localintegration \
rootlessintegration localrootlessintegration shell install install-bash \
install-man clean uninstall validate ci \
vendor verify-dependencies cross localcross skeleton rpm
vendor verify-dependencies cross localcross skeleton package
......@@ -16,4 +16,17 @@ rpm: release-tarball
@rm -rf $(RPMBUILD_DIR)
@echo "the rpms of rune located in $(PROJECT_DIR)"
.PHONY: release-tarball rpm
deb:
@cd deb && ./build.sh
@echo "the debs of rune located in $(PROJECT_DIR)"
package:
ifeq (/etc/debian_version, $(wildcard /etc/debian_version))
make deb
else ifeq (/etc/redhat-release, $(wildcard /etc/redhat-release))
make rpm
else
@echo "error! don't support generating packages on this system"
endif
.PHONY: release-tarball rpm deb package
#!/bin/bash
PROJECT_DIR=$(cd ../../..; pwd)
DEBBUILD_DIR=$(mktemp -u /tmp/debbuild.XXXX)
SCRIPT_DIR=$(pwd)
PACKAGE=rune
PROJECT=inclavare-containers
VERSION=$(cd ../../..; cat ./VERSION)
RELEASE_TARBALL=$DEBBUILD_DIR/v$VERSION.tar.gz
RELEASE_TARBALL_URL=https://github.com/alibaba/inclavare-containers/archive/v$VERSION.tar.gz
TARBALL_NAME=$PACKAGE\_$VERSION.orig.tar.gz
DEB_BUILD_FOLDER=$DEBBUILD_DIR/$PACKAGE-$VERSION
# create and rename the tarball
mkdir -p $DEBBUILD_DIR
if [ ! -f "$RELEASE_TARBALL" ]; then
wget -P $DEBBUILD_DIR $RELEASE_TARBALL_URL
fi
tar zxfP $DEBBUILD_DIR/v$VERSION.tar.gz -C $DEBBUILD_DIR
mv $DEBBUILD_DIR/$PROJECT-$VERSION $DEBBUILD_DIR/$PACKAGE-$VERSION
cd $DEBBUILD_DIR && tar zcfP $TARBALL_NAME $PACKAGE-$VERSION
# check the go version
if ! [ -x "$(command -v go)" ]; then
echo 'Error: go is not installed. Please install Go 1.14 and above'
exit 1
fi
NEED_GO_VERSION=14
CURRENT_GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//g' | sed 's/\./ /g' | awk '{print $2}')
if [ $CURRENT_GO_VERSION -lt $NEED_GO_VERSION ]; then
echo 'Error: go version is less than 1.14.0. Please install Go 1.14 and above'
exit
fi
# build_deb_package
cp -rf $SCRIPT_DIR/debian $DEB_BUILD_FOLDER
cd $DEB_BUILD_FOLDER
dpkg-buildpackage -us -uc
cp $DEBBUILD_DIR/*.deb $PROJECT_DIR
rm -rf $DEBBUILD_DIR
rune (0.2.0-1) unstable; urgency=low
* Initial release.
-- Shirong Hao <shirong@linux.alibaba.com> Mon, 13 Jul 2020 13:48:35 +0000
Source: rune
Section: devel
Priority: extra
Maintainer: Shirong Hao <shirong@linux.alibaba.com>
Build-Depends: debhelper (>=9), libseccomp-dev, libprotobuf-dev (>=3), protobuf-compiler
Standards-Version: 3.9.8
Homepage: https://github.com/alibaba/inclavare-containers
Package: rune
Architecture: amd64
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: rune is a CLI tool for spawning and running enclaves in containers according to the OCI specification. The codebase of rune is a fork of runc, so rune can be used as runc if enclave is not configured or available.
#!/usr/bin/make -f
BUILD_ROOT := $(CURDIR)/debian/rune
BUILD_DIR := /usr/bin
LICENSE := /usr/share/licenses/rune
PROTOBUF_VERSION := 1.3.5
export GO111MODULE := on
%:
dh $@
override_dh_auto_build:
go get github.com/golang/protobuf/protoc-gen-go@v$(PROTOBUF_VERSION)
make -C rune
override_dh_auto_install:
install -d -p $(BUILD_ROOT)$(BUILD_DIR)
install -p -m 755 $(CURDIR)/rune/rune $(BUILD_ROOT)$(BUILD_DIR)
install -d -p $(BUILD_ROOT)$(LICENSE)
install -p -m 644 $(CURDIR)/rune/LICENSE $(BUILD_ROOT)$(LICENSE)
......@@ -39,7 +39,7 @@ SHIM_CGO_ENABLED ?= 0
BINARIES=$(addprefix bin/,$(COMMANDS))
.PHONY: clean all binaries help install uninstall rpm
.PHONY: clean all binaries help install uninstall package
.DEFAULT: default
all: binaries
......@@ -55,8 +55,8 @@ clean: ## clean up binaries
@echo "$@"
@rm -f $(BINARIES)
rpm:
$(MAKE) -C dist rpm
package:
$(MAKE) -C dist package
install: ## install binaries
@echo "$@ $(BINARIES)"
......
# Variables for building rpm
PROJECT_DIR := $(shell cd ../..; pwd)
RPMBUILD_DIR := $(shell mktemp -u /tmp/rpmbuild.XXXX)
RELEASE_TARBALL_URL := https://github.com/alibaba/inclavare-containers/archive/v$(INCLAVARE_CONTAINERS_VERSION).tar.gz
......@@ -17,4 +16,17 @@ rpm: release-tarball
@rm -rf $(RPMBUILD_DIR)
@echo "the rpms of shim-rune located in $(PROJECT_DIR)"
.PHONY: release-tarball rpm
deb:
@cd deb && ./build.sh
@echo "the debs of shim-rune located in $(PROJECT_DIR)"
package:
ifeq (/etc/debian_version, $(wildcard /etc/debian_version))
make deb
else ifeq (/etc/redhat-release, $(wildcard /etc/redhat-release))
make rpm
else
@echo "error! don't support generating packages on this system"
endif
.PHONY: release-tarball rpm deb package
#!/bin/bash
PROJECT_DIR=$(cd ../../..; pwd)
DEBBUILD_DIR=$(mktemp -u /tmp/debbuild.XXXX)
SCRIPT_DIR=$(pwd)
PACKAGE=shim-rune
PROJECT=inclavare-containers
VERSION=$(cd ../../..; cat ./VERSION)
RELEASE_TARBALL=$DEBBUILD_DIR/v$VERSION.tar.gz
RELEASE_TARBALL_URL=https://github.com/alibaba/inclavare-containers/archive/v$VERSION.tar.gz
TARBALL_NAME=$PACKAGE\_$VERSION.orig.tar.gz
DEB_BUILD_FOLDER=$DEBBUILD_DIR/$PACKAGE-$VERSION
# create and rename the tarball
mkdir -p $DEBBUILD_DIR
if [ ! -f "$RELEASE_TARBALL" ]; then
wget -P $DEBBUILD_DIR $RELEASE_TARBALL_URL
fi
tar zxfP $DEBBUILD_DIR/v$VERSION.tar.gz -C $DEBBUILD_DIR
mv $DEBBUILD_DIR/$PROJECT-$VERSION $DEBBUILD_DIR/$PACKAGE-$VERSION
cd $DEBBUILD_DIR && tar zcfP $TARBALL_NAME $PACKAGE-$VERSION
# check the go version
if ! [ -x "$(command -v go)" ]; then
echo 'Error: go is not installed. Please install Go 1.14 and above'
exit 1
fi
NEED_GO_VERSION=14
CURRENT_GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//g' | sed 's/\./ /g' | awk '{print $2}')
if [ $CURRENT_GO_VERSION -lt $NEED_GO_VERSION ]; then
echo 'Error: go version is less than 1.14.0. Please install Go 1.14 and above'
exit
fi
# build deb package
cp -rf $SCRIPT_DIR/debian $DEB_BUILD_FOLDER
cd $DEB_BUILD_FOLDER
dpkg-buildpackage -us -uc
cp $DEBBUILD_DIR/*.deb $PROJECT_DIR
rm -rf $DEBBUILD_DIR
shim-rune (0.2.0-1) unstable; urgency=low
* Initial release. Closes:
-- Shirong Hao <shirong@linux.alibaba.com> Mon, 13 Jul 2020 13:48:35 +0000
Source: shim-rune
Section: devel
Priority: extra
Maintainer: Shirong Hao <shirong@linux.alibaba.com>
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.8
Homepage: https://github.com/alibaba/inclavare-containers
Package: shim-rune
Architecture: amd64
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: containerd-shim-rune-v2 is a shim for Inclavare Containers(runE).
#!/bin/sh
SHIM_CONFIG_DIR=/etc/inclavare-containers
mkdir -p $SHIM_CONFIG_DIR
cat << EOF > $SHIM_CONFIG_DIR/config.toml
log_level = "info" # "debug" "info" "warn" "error"
sgx_tool_sign = "/opt/intel/sgxsdk/bin/x64/sgx_sign"
[containerd]
socket = "/run/containerd/containerd.sock"
[enclave_runtime]
[enclave_runtime.occlum]
build_image = "docker.io/occlum/occlum:0.13.0-ubuntu18.04"
enclave_runtime_path = "/usr/lib64/libocclum-pal.so"
[enclave_runtime.graphene]
EOF
#!/bin/bash
SHIM_CONFIG_DIR=/etc/inclavare-containers
rm -f $SHIM_CONFIG_DIR/config.toml
#!/usr/bin/make -f
BUILD_ROOT := $(CURDIR)/debian/shim-rune
BUILD_DIR := /usr/local/bin
LICENSE := /usr/share/licenses/shim-rune
%:
dh $@
override_dh_auto_build:
GOOS=linux make binaries -C shim
override_dh_auto_install:
install -d -p $(BUILD_ROOT)$(BUILD_DIR)
install -p -m 755 $(CURDIR)/shim/bin/containerd-shim-rune-v2 $(BUILD_ROOT)$(BUILD_DIR)
install -d -p $(BUILD_ROOT)$(LICENSE)
install -p -m 644 $(CURDIR)/shim/LICENSE $(BUILD_ROOT)$(LICENSE)
override_dh_usrlocal:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册