diff --git a/.circleci/config.yml b/.circleci/config.yml index e22bf96..1a83368 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ jobs: - cargo-{{ checksum "Cargo.lock" }} - run: which rustfmt || cargo install rustfmt - run: apt update && apt install -y wget - - run: ./scripts/install-deps.sh + - run: make lib - run: cargo fmt -- --write-mode=diff - run: cargo build - run: cargo build --release diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..39d607b --- /dev/null +++ b/Makefile @@ -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 + diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh deleted file mode 100755 index 0b78ba6..0000000 --- a/scripts/install-deps.sh +++ /dev/null @@ -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