summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fankhauser (@tux-six)2022-07-20 13:47:58 +0200
committerAndreas Fankhauser (@tux-six)2022-07-20 13:47:58 +0200
commit4748d472f73f67a6dcaac5947dba94bf09bc7164 (patch)
treeea7d71fa3a13553f587d33d7eb8901925b8d3b71
parent8715622ee3a0c0daa74934e5a349bd47c7fd23bd (diff)
downloadDeflateAndInflate-4748d472f73f67a6dcaac5947dba94bf09bc7164.zip
DeflateAndInflate-4748d472f73f67a6dcaac5947dba94bf09bc7164.tar.gz
Add doc how to build inside docker
(wip @ f04b084b3f2ae726544be599ae394a0a600ec8c8)
-rw-r--r--README.md9
-rwxr-xr-xconfigure5
-rw-r--r--contrib/build-using-docker/Dockerfile12
-rw-r--r--contrib/build-using-docker/README.md60
4 files changed, 78 insertions, 8 deletions
diff --git a/README.md b/README.md
index 7b64d36..c97bbed 100644
--- a/README.md
+++ b/README.md
@@ -2,4 +2,13 @@
Pure DeflateInflate executables
===============================
+Deflate and inflate commandline frontend for zlib.
+
+
+## Build / Install
+
+Use well-known configure/make/install proceduce.
+
+Alternatively `contrib/build-using-docker/README.md` provides an
+isolated and easier to reproduce build environment via docker.
diff --git a/configure b/configure
index 2c17949..7156777 100755
--- a/configure
+++ b/configure
@@ -48,6 +48,7 @@ printMakefile () {
printf '%s\n' 'RIMRAF=rm -rf'
printf '%s\n' 'MKDIRS=mkdir -p'
printf '%s\n' 'COPYTO=cp -t'
+ printf '%s\n' 'NDEBUG=1'
printf '\n'
printf '%s\n' "PREFIX=$prefix"
@@ -84,8 +85,8 @@ printMakefile () {
printf '%s\n' 'ifndef NDEBUG'
printf '%s\n' ' CFLAGS := $(CFLAGS) -ggdb -O0 -g3'
printf '%s\n' 'else'
- printf '%s\n' ' CFLAGS := $(CFLAGS) -ffunction-sections -fdata-sections -Os -s "-DNDEBUG=1"'
- printf '%s\n' ' LDFLAGS := $(LDFLAGS) -Wl,--gc-sections,--as-needed -s'
+ printf '%s\n' ' CFLAGS := $(CFLAGS) -ffunction-sections -fdata-sections -Os "-DNDEBUG=1"'
+ printf '%s\n' ' LDFLAGS := $(LDFLAGS) -Wl,--gc-sections,--as-needed'
printf '%s\n' 'endif'
printf '\n'
diff --git a/contrib/build-using-docker/Dockerfile b/contrib/build-using-docker/Dockerfile
index aaca6ad..c226a8a 100644
--- a/contrib/build-using-docker/Dockerfile
+++ b/contrib/build-using-docker/Dockerfile
@@ -4,7 +4,8 @@ FROM $PARENT_IMAGE
ARG GIT_TAG=
ARG CONFIGURE_OPTS=
-ARG PKGS_TO_INSTALL="curl gcc git make musl-dev tar zlib-dev"
+ARG PKGS_TO_ADD="curl gcc git make musl-dev tar zlib-dev"
+ARG PKGS_TO_DEL="curl gcc git make musl-dev tar zlib-dev"
ARG PKGINIT=true
ARG PKGADD="apk add"
ARG PKGDEL="apk del"
@@ -14,15 +15,14 @@ WORKDIR /work
RUN true \
&& $PKGINIT \
- && $PKGADD $PKGS_TO_INSTALL \
- && git clone http://git.hiddenalpha.ch/DeflateAndInflate.git . \
- && git config advice.detachedHead false \
- && if test -n "$GIT_TAG"; then git checkout "$GIT_TAG"; fi \
+ && $PKGADD $PKGS_TO_ADD \
+ && BR=$(if test -n "$GIT_TAG"; then echo " --branch $GIT_TAG"; else echo ""; fi) \
+ && git clone --depth 42 $BR https://github.com/hiddenalpha/DeflateAndInflate.git . \
&& ./configure $CONFIGURE_OPTS \
&& make clean && make && make install \
&& find . -not -wholename './dist*' -delete \
&& find /work -exec chown 1000:1000 {} + \
- && $PKGDEL $PKGS_TO_INSTALL \
+ && $PKGDEL $PKGS_TO_DEL \
&& $PKGCLEAN \
&& true
diff --git a/contrib/build-using-docker/README.md b/contrib/build-using-docker/README.md
new file mode 100644
index 0000000..971c2e6
--- /dev/null
+++ b/contrib/build-using-docker/README.md
@@ -0,0 +1,60 @@
+
+Showcase how to build and install
+=================================
+
+Sometimes happy developers (like me) have no choice but using horribly
+restricted systems where setting up tools to run even something as simple as
+configure/make/install becomes a nightmare. I found it to be easier to have a
+Dockerfile to build on a totally unrelated machine (but where I have the needed
+privileges) and then just copy-paste the built result over to where I need it.
+
+
+## Setup variable to reduce annoying repetitions
+
+```sh
+IMG=deflateandinflate-showcase:latest
+```
+
+## Make and install dockerimage
+
+```sh
+curl -sSL https://github.com/hiddenalpha/DeflateAndInflate/raw/master/contrib/build-using-docker/Dockerfile | sudo docker build . -f - -t "${IMG:?}"
+```
+
+## Grab distribution archive
+
+Most probably we wanna get the distribution archive. We can copy it out the
+dockerimage to our host using:
+
+```sh
+sudo docker run --rm -i "${IMG:?}" sh -c 'true && cd dist && tar c *' | tar x
+```
+
+
+## Play around
+
+Or if we wanna browse the image or play around with the built utility we could
+launch a shell. Once in the shell, try `deflate --help` and/or `inflate --help`.
+
+```sh
+sudo docker run --rm -ti "${IMG:?}" sh
+```
+
+
+## Other targets
+
+The dockerfile is parameterized and should work for other systems too. For
+example to compile for debian we could use command like below. May set *IMG*
+differently if you need to keep multiple images.
+
+```sh
+curl -sSL https://github.com/hiddenalpha/DeflateAndInflate/raw/master/contrib/build-using-docker/Dockerfile | sudo docker build . -f - -t "${IMG:?}" \
+ --build-arg PARENT_IMAGE=debian:buster-20220622-slim \
+ --build-arg PKGS_TO_ADD="curl gcc git make libc-dev ca-certificates tar zlib1g-dev" \
+ --build-arg PKGS_TO_DEL="curl gcc git make libc-dev zlib1g-dev" \
+ --build-arg PKGINIT="apt-get update" \
+ --build-arg PKGADD="apt-get install -y --no-install-recommends" \
+ --build-arg PKGDEL="apt-get purge -y" \
+ --build-arg PKGCLEAN="apt-get clean"
+```
+