diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e660fd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bin/ diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..fa69541 --- /dev/null +++ b/compile.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +CHECKOUT="${1:-1.4.18}" + +docker build -t tnef-builder docker + +mkdir -p bin + +docker run -it --rm --name tnef-builder -v "$(pwd)/bin":/dist -- tnef-builder "${CHECKOUT}" "/dist" diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..5cf35b2 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,9 @@ +FROM debian:buster + +RUN apt-get update ; apt-get install -y --no-install-suggests packaging-dev + +ADD ./entrypoint.sh /bin/entrypoint.sh + +WORKDIR /code + +ENTRYPOINT ["/bin/entrypoint.sh"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..a9d9a09 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +CHECKOUT="${1:-}" +DESTINATION="${2:-.}" + +if [[ "$(ls -Uba1 | wc -l)" -le 2 ]]; then + echo "Cloning tnef repository" + git clone -q -- https://github.com/verdammelt/tnef /code + if [[ -n "${CHECKOUT}" ]]; then + echo "Checking out ${CHECKOUT}" + git checkout -q "${CHECKOUT}" + fi +fi + +autoreconf +./configure +make --quiet check + +if [[ -d "${DESTINATION}" ]]; then + DESTFILE="${DESTINATION}/tnef-$(git describe --dirty --tags)-$(lsb_release -sc)-$(dpkg --print-architecture)" + echo "Result in $(readlink -f ${DESTFILE})" + cp -- src/tnef "${DESTFILE}" +fi