From e9b540780d60f58fbe162b80c85653d78ab1906a Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Thu, 20 Oct 2022 19:24:54 +0200 Subject: Enhance docker-build doc for debian - Older OS release for better portability - Add hint about musl libc - Use apt-get over apt cmd to fix api warnings --- configure | 3 ++- contrib/build-using-docker/Dockerfile | 2 +- contrib/build-using-docker/README.md | 25 +++++++++++++++++-------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/configure b/configure index fb6253b..e15b0b7 100755 --- a/configure +++ b/configure @@ -83,7 +83,8 @@ printMakefile () { printf '%s' ' -Wno-error=unused-function -Wno-error=unused-label' printf '%s' ' -Wno-error=unused-variable -Wno-error=unused-parameter' printf '%s' ' -Wno-error=unused-const-variable' - printf '%s' ' -Werror=implicit-fallthrough=1' + # Not supported by debian 9 and older + #printf '%s' ' -Werror=implicit-fallthrough=1' printf '%s' ' -Wno-error=unused-but-set-variable' printf '%s' ' -Wno-unused-function -Wno-unused-parameter' printf '%s\n' ' -DPROJECT_VERSION=$(PROJECT_VERSION)' diff --git a/contrib/build-using-docker/Dockerfile b/contrib/build-using-docker/Dockerfile index 00c1132..47b14f5 100644 --- a/contrib/build-using-docker/Dockerfile +++ b/contrib/build-using-docker/Dockerfile @@ -18,7 +18,7 @@ RUN true \ && $PKGADD $PKGS_TO_ADD \ && git clone --depth 42 --branch "${GIT_TAG:?}" https://github.com/hiddenalpha/bulk-ln.git . \ && git config advice.detachedHead false \ - && if test -n "$GIT_TAG"; then git checkout "$GIT_TAG"; fi \ + && git checkout "$GIT_TAG" \ && ./configure $CONFIGURE_OPTS \ && make clean && make && make install \ && find . -not -wholename './dist*' -delete \ diff --git a/contrib/build-using-docker/README.md b/contrib/build-using-docker/README.md index 63b7182..ec571e0 100644 --- a/contrib/build-using-docker/README.md +++ b/contrib/build-using-docker/README.md @@ -8,10 +8,18 @@ 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. +WARN: Default configuration uses an alpine base image that means build will + dynamically link to musl libc and so won't run on most other systems. + This is because for a quick-n-dirty walktrough about what this tool does + this is ways enough. Consult "Other targets" further down and configure a + base image that fits your needs. -## Setup variable to reduce annoying repetitions + +## Setup basic stuff to reduce annoyance ```sh +mkdir /tmp/some-empty-dir +cd /tmp/some-empty-dir IMG=bulk-ln-showcase:latest ``` @@ -44,17 +52,18 @@ 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. +example to compile for debian we could use example command as below. + +To build for other systems it should be enough to adjust below command. ```sh curl -sSL http://git.hiddenalpha.ch/bulk-ln.git/plain/contrib/build-using-docker/Dockerfile | sudo docker build . -f - -t "${IMG:?}" \ - --build-arg PARENT_IMAGE=debian:buster-20220622-slim \ + --build-arg PARENT_IMAGE=debian:9-slim \ --build-arg PKGS_TO_ADD="curl gcc git make libc-dev ca-certificates tar" \ --build-arg PKGS_TO_DEL="curl gcc git make libc-dev" \ - --build-arg PKGINIT="apt update" \ - --build-arg PKGADD="apt install -y --no-install-recommends" \ - --build-arg PKGDEL="apt purge -y" \ - --build-arg PKGCLEAN="apt clean" + --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" ``` -- cgit v1.1