vendor openssl

This commit is contained in:
2021-01-06 00:41:45 +03:00
parent 7e700e362a
commit 21ea82abc0
10 changed files with 118 additions and 1 deletions

5
.cargo/config.toml Normal file
View File

@ -0,0 +1,5 @@
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
[target.armv7-unknown-linux-musleabihf]
linker = "musl-gcc"

2
.dockerignore Executable file
View File

@ -0,0 +1,2 @@
/target/
/.git/

64
.drone.yml Normal file
View File

@ -0,0 +1,64 @@
---
kind: pipeline
type: docker
name: default
platform:
os: "linux"
arch: "arm"
steps:
- name: "deps"
image: "rust:1.49"
volumes:
- name: "cache"
path: "/.target"
commands:
- "apt-get update"
- "apt-get install -yqq musl-tools make"
- "rustup target add armv7-unknown-linux-musleabihf"
- "cargo check"
- "cargo test"
- "cargo build --release --target=armv7-unknown-linux-musleabihf"
- name: "check"
image: "rust:1.49"
depends_on:
- "deps"
volumes:
- name: "cache"
path: "/.target"
commands:
- "cargo check"
- name: "test"
image: "rust:1.49"
depends_on:
- "deps"
volumes:
- name: "cache"
path: "/.target"
commands:
- "cargo test"
- name: "deploy"
image: "rust:1.49"
depends_on:
- "check"
- "test"
environment:
SSH_PK:
from_secret: SSH_PRIVATE_KEY
SSH_PARAMS: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/tmp/known_hosts'
TARGET_DIR: "./.target/armv7-unknown-linux-musleabihf/release"
commands:
- "mkdir /tmp/ssh 2>&1"
- "echo -n ${SSH_PK} | base64 -d > /tmp/ssh/deploy_key "
- "eval $(ssh-agent -s)"
- "chmod 600 /tmp/ssh/deploy_key"
- "ssh-add /tmp/ssh/deploy_key"
- "scp ${SSH_PARAMS} ${TARGET_DIR}/alterego ${SSH_USER}@${SSH_HOST}:/home/pi/alterego"
volumes:
- name: "cache"
temp: {}

0
.env Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

11
Cargo.lock generated Normal file → Executable file
View File

@ -16,6 +16,7 @@ dependencies = [
"env_logger",
"envconfig",
"log",
"openssl",
"reqwest",
"serde",
"serde_json",
@ -723,6 +724,15 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "openssl-src"
version = "111.13.0+1.1.1i"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "045e4dc48af57aad93d665885789b43222ae26f4886494da12d1ed58d309dcb6"
dependencies = [
"cc",
]
[[package]]
name = "openssl-sys"
version = "0.9.58"
@ -732,6 +742,7 @@ dependencies = [
"autocfg",
"cc",
"libc",
"openssl-src",
"pkg-config",
"vcpkg",
]

1
Cargo.toml Normal file → Executable file
View File

@ -17,3 +17,4 @@ uuid = { version = "0.8.1", features = ["v4"] }
log = "0.4"
env_logger = "0.8.1"
envconfig = "0.9.1"
openssl = {version="*", features = ["vendored"]}

7
Dockerfile Executable file
View File

@ -0,0 +1,7 @@
FROM docker.io/rust:1.49
RUN apt-get update && apt-get install -yqq \
musl-tools \
make
RUN rustup target add armv7-unknown-linux-musleabihf

27
makefile Executable file
View File

@ -0,0 +1,27 @@
export DOCKER_BUILDKIT=1
DOCKERFLAGS:=-it --rm \
-v "${PWD}":"/app" \
--workdir "/app" \
-e "PWD=/app"
DOCKERIMG:="rust-build-env:V1"
image:
docker build -t rust-build-env:V1 .
.PHONY: image
ARM_PREFIX:=CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=arm-linux-gnueabihf-ld \
REALGCC=arm-linux-gnueabihf-gcc-8 \
TARGET_CC=musl-gcc
build_debug_arm:
${ARM_PREFIX} cargo build --target=armv7-unknown-linux-musleabihf
.PHONY: build_debug_arm
build_release_arm:
docker run ${DOCKERFLAGS} ${DOCKERIMG} /bin/sh -c 'cargo build --release --target=armv7-unknown-linux-gnueabihf'
.PHONY: build_release_arm
docker_build_release_arm:
docker run ${DOCKERFLAGS} ${DOCKERIMG} make build_release_arm

2
src/main.rs Normal file → Executable file
View File

@ -5,7 +5,7 @@ use teloxide::{prelude::*, utils::command::BotCommand};
#[tokio::main]
async fn main() {
run().await
tokio::spawn(run()).await.unwrap();
}
#[derive(Envconfig, Clone)]