mirror of https://github.com/dswd/vpncloud.git
Updated builders
This commit is contained in:
parent
0bed988629
commit
dd7ae3dec5
7
build.rs
7
build.rs
|
@ -4,10 +4,7 @@
|
|||
|
||||
extern crate cc;
|
||||
|
||||
use std::process::Command;
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::fs;
|
||||
use std::{env, fs, path::Path, process::Command};
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
|
@ -23,7 +20,7 @@ fn main() {
|
|||
Ok(_) => {
|
||||
Command::new("gzip").args(&["vpncloud.1"]).current_dir(&Path::new(&out_dir)).status().unwrap();
|
||||
fs::copy(Path::new(&out_dir).join("vpncloud.1.gz"), "target/vpncloud.1.gz").unwrap();
|
||||
},
|
||||
}
|
||||
Err(err) => {
|
||||
println!("cargo:warning=Error building manpage: {}", err);
|
||||
println!("cargo:warning=The manpage will not be build. Do you have 'ronn'?");
|
||||
|
|
|
@ -2,6 +2,9 @@ FROM centos:7
|
|||
|
||||
RUN yum groupinstall -y 'Development Tools'
|
||||
|
||||
RUN yum-config-manager --add-repo http://springdale.math.ias.edu/data/puias/computational/7/x86_64 \
|
||||
&& yum install --nogpgcheck -y rubygem-ronn
|
||||
|
||||
RUN useradd -ms /bin/bash user
|
||||
USER user
|
||||
WORKDIR /home/user
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
function docker_cmd() {
|
||||
DIST=$1
|
||||
CMD=$2
|
||||
mkdir -p $CACHE/$DIST/{target,registry,git,tmp}
|
||||
docker run -it --rm -v $(pwd)/..:/home/user/code \
|
||||
-v $CACHE/registry:/home/user/.cargo/registry \
|
||||
-v $CACHE/git:/home/user/.cargo/git \
|
||||
-v $CACHE/tmp:/home/user/.cargo/tmp \
|
||||
-v $CACHE/$DIST/target:/home/user/code/target \
|
||||
-v $CACHE/$DIST/registry:/home/user/.cargo/registry \
|
||||
-v $CACHE/$DIST/git:/home/user/.cargo/git \
|
||||
-v $CACHE/$DIST/tmp:/home/user/.cargo/tmp \
|
||||
vpncloud-builder-$DIST bash -c "$CMD"
|
||||
}
|
||||
|
||||
|
@ -16,7 +18,7 @@ cd $(dirname $0)
|
|||
|
||||
VERSION=$(grep -e '^version =' ../Cargo.toml | sed -e 's/version = "\(.*\)"/\1/')
|
||||
|
||||
mkdir -p cache/{git,tmp,registry}
|
||||
mkdir -p cache/{rpm,deb}
|
||||
CACHE=$(pwd)/cache
|
||||
|
||||
mkdir -p ../dist
|
||||
|
@ -25,19 +27,19 @@ docker build --rm -f=Dockerfile-deb -t vpncloud-builder-deb .
|
|||
|
||||
# x86_64 deb
|
||||
docker_cmd deb 'cd code && cargo deb'
|
||||
cp ../target/debian/vpncloud_${VERSION}_amd64.deb ../dist/vpncloud_${VERSION}_amd64.deb
|
||||
cp $CACHE/deb/target/debian/vpncloud_${VERSION}_amd64.deb ../dist/vpncloud_${VERSION}_amd64.deb
|
||||
|
||||
# arm7hf deb
|
||||
docker_cmd deb 'cd code && cargo deb --target armv7-unknown-linux-gnueabihf'
|
||||
cp ../target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${VERSION}_armhf.deb ../dist/vpncloud_${VERSION}_armhf.deb
|
||||
cp $CACHE/deb/target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${VERSION}_armhf.deb ../dist/vpncloud_${VERSION}_armhf.deb
|
||||
|
||||
# aarch64 deb
|
||||
docker_cmd deb 'cd code && cargo deb --target aarch64-unknown-linux-gnu'
|
||||
cp ../target/aarch64-unknown-linux-gnu/debian/vpncloud_${VERSION}_arm64.deb ../dist/vpncloud_${VERSION}_arm64.deb
|
||||
cp $CACHE/deb/target/aarch64-unknown-linux-gnu/debian/vpncloud_${VERSION}_arm64.deb ../dist/vpncloud_${VERSION}_arm64.deb
|
||||
|
||||
|
||||
docker build --rm -f=Dockerfile-rpm -t vpncloud-builder-rpm .
|
||||
|
||||
# x86_64 rpm
|
||||
docker_cmd rpm 'cd code && cargo rpm build'
|
||||
cp ../target/release/rpmbuild/RPMS/x86_64/vpncloud-${VERSION}-1.x86_64.rpm ../dist/vpncloud_${VERSION}.x86_64.rpm
|
||||
cp $CACHE/rpm/target/release/rpmbuild/RPMS/x86_64/vpncloud-${VERSION}-1.x86_64.rpm ../dist/vpncloud_${VERSION}.x86_64.rpm
|
||||
|
|
Loading…
Reference in New Issue