Screw the makefile!

This commit is contained in:
Jake Howard 2017-09-09 19:18:42 +01:00
parent ac4c7ed0d0
commit fb43be50d4
Signed by: jake
GPG key ID: 57AFB45680EDD477
5 changed files with 63 additions and 51 deletions

View file

@ -12,16 +12,16 @@ 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 unzip sudo libgtk-3-dev - run: apt update && apt install -y wget unzip sudo libgtk-3-dev
- run: make lib - run: ./scripts/lib
- run: ./.circleci/wkhtmltopdf.sh - run: ./.circleci/wkhtmltopdf.sh
- run: cargo fmt -- --write-mode=diff - run: cargo fmt -- --write-mode=diff
- run: make build - run: ./scripts/build
- run: make release - run: ./scripts/build release
- save_cache: - save_cache:
key: cargo-{{ checksum "Cargo.lock" }} key: cargo-{{ checksum "Cargo.lock" }}
paths: paths:
- ~/.cargo - ~/.cargo
- run: make test - run: ./scripts/test
- run: - run:
command: ../.circleci/xserver.sh cargo run -- build command: ../.circleci/xserver.sh cargo run -- build
working_directory: ~/md-pdf/test-files working_directory: ~/md-pdf/test-files

View file

@ -1,47 +0,0 @@
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
build:
@cargo build
cp $(LIB_DIR)/* target/debug/
release:
@cargo build --release
cp $(LIB_DIR)/* target/release/
lib_path:
@rm -rf $(LIB_DIR)
@mkdir -p $(LIB_DIR)
@sudo rm -f /usr/lib/libsciter-gtk-64.so
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)
sciter: lib_path
wget https://sciter.com/sdk/sciter-sdk.zip -O $(LIB_DIR)/sciter.zip
unzip -j $(LIB_DIR)/sciter.zip "bin.gtk/libsciter-gtk-64.so" -d $(LIB_DIR)
sudo ln -sfP $(PWD)/$(LIB_DIR)/libsciter-gtk-64.so /usr/lib/libsciter-gtk-64.so
rm $(LIB_DIR)/sciter.zip
lib: pandoc wktox sciter
test:
cargo test
cargo test --release
.PHONY: build pandoc lib_path wktox

15
scripts/build Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
if [ "$1" == "release" ]; then
echo ">> Building Release"
cargo build --release
cp lib/* target/release/
else
cargo build
cp lib/* target/debug/
fi

35
scripts/lib Executable file
View file

@ -0,0 +1,35 @@
#!/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
CSL_DL=csl.zip
echo "> Cleaing old lib..."
rm -rf $LIB_DIR
mkdir -p $LIB_DIR
sudo rm -f /usr/lib/libsciter-gtk-64.so
echo "> Installing Pandoc..."
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 && cd -
echo "> Install WkHTMLtoPDF..."
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 && cd -
echo "> Install Sciter..."
wget https://sciter.com/sdk/sciter-sdk.zip -O $LIB_DIR/sciter.zip
unzip -j $LIB_DIR/sciter.zip "bin.gtk/libsciter-gtk-64.so" -d $LIB_DIR
sudo ln -sfP $PWD/$LIB_DIR/libsciter-gtk-64.so /usr/lib/libsciter-gtk-64.so
rm $LIB_DIR/sciter.zip

9
scripts/test Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
echo "> Running debug tests..."
cargo test
echo "> Running release tests..."
cargo test --release