Use makefile for dep download

This commit is contained in:
Jake Howard 2017-08-27 22:17:07 +01:00
parent 0f56823093
commit a105907ce6
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 29 additions and 37 deletions

View file

@ -12,7 +12,7 @@ jobs:
- cargo-{{ checksum "Cargo.lock" }} - cargo-{{ checksum "Cargo.lock" }}
- run: which rustfmt || cargo install rustfmt - run: which rustfmt || cargo install rustfmt
- run: apt update && apt install -y wget - run: apt update && apt install -y wget
- run: ./scripts/install-deps.sh - run: make lib
- run: cargo fmt -- --write-mode=diff - run: cargo fmt -- --write-mode=diff
- run: cargo build - run: cargo build
- run: cargo build --release - run: cargo build --release

28
Makefile Normal file
View file

@ -0,0 +1,28 @@
LIB_DIR=lib
PANDOC_VERSION=1.19.2.1
WKTOX_VERSION=0.12.4
PANDOC_DL=pandoc-${PANDOC_VERSION}-1-amd64.deb
WKTOX_DL=wkhtmltox-${WKTOX_VERSION}_linux-generic-amd64.tar.xz
lib_path:
@rm -rf $(LIB_DIR)
@mkdir -p $(LIB_DIR)
pandoc: lib_path
wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/${PANDOC_DL} -O $(LIB_DIR)/$(PANDOC_DL)
ar p $(LIB_DIR)/$(PANDOC_DL) data.tar.gz | tar xz --strip-components 2 -C $(LIB_DIR)
mv $(LIB_DIR)/bin/* $(LIB_DIR)
cd $(LIB_DIR) && rm -r bin/ share/ $(PANDOC_DL)
wktox: lib_path
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKTOX_VERSION}/${WKTOX_DL} -O $(LIB_DIR)/$(WKTOX_DL)
tar -xJf $(LIB_DIR)/$(WKTOX_DL) -C $(LIB_DIR)
mv $(LIB_DIR)/wkhtmltox/lib/* $(LIB_DIR)
cd $(LIB_DIR) && rm -r wkhtmltox/ $(WKTOX_DL)
lib: pandoc wktox
.PHONY: pandoc lib_path wktox

View file

@ -1,36 +0,0 @@
#!/usr/bin/env bash
set -e
LIB_DIR=lib/
PANDOC_VERSION="1.19.2.1"
WKTOX_VERSION="0.12.4"
PANDOC_DL="pandoc-${PANDOC_VERSION}-1-amd64.deb"
WKTOX_DL="wkhtmltox-${WKTOX_VERSION}_linux-generic-amd64.tar.xz"
rm -rf $LIB_DIR
mkdir -p $LIB_DIR
cd $LIB_DIR
echo "> Downloading Pandoc..."
wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/${PANDOC_DL}
echo ">> Unpacking pandoc binaries..."
ar p $PANDOC_DL data.tar.gz | tar xz --strip-components 2 -C .
mv bin/* .
echo ">> Cleaning up..."
rm -r bin/ share/ $PANDOC_DL
echo "> Downloading wkhtmltox..."
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKTOX_VERSION}/${WKTOX_DL}
echo ">> Unpacking wkhtmltox..."
tar -xJf $WKTOX_DL
mv wkhtmltox/lib/* .
echo ">> Cleaning up..."
rm -r wkhtmltox/ $WKTOX_DL