#!/bin/bash

VERSION=$1

rm -rf qcustomplot-*.tar.?z* QCustomPlot-*.tar.?z*

wget https://gitlab.com/DerManu/QCustomPlot/-/archive/v$VERSION/QCustomPlot-v$VERSION.tar.gz
wget https://www.qcustomplot.com/release/${VERSION}fixed/QCustomPlot-source.tar.gz

tar xf QCustomPlot-v$VERSION.tar.gz
tar xf QCustomPlot-source.tar.gz

mv qcustomplot-source/qcustomplot.{cpp,h} QCustomPlot-v$VERSION/

rm -rf qcustomplot-source

mv QCustomPlot-v$VERSION qcustomplot-$VERSION

tar -cf qcustomplot-$VERSION.tar qcustomplot-$VERSION
plzip -9 qcustomplot-$VERSION.tar

rm -rf qcustomplot-$VERSION
rm -f QCustomPlot-v$VERSION.tar.gz
rm -f QCustomPlot-source.tar.gz
