From 619471e765226f3c4b762f408fd1623fb5d29b9a Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 30 Sep 2023 14:01:28 +0200 Subject: Cleanup --- Makefile | 4 ++-- contrib/build-env-setup/README.md | 37 ++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index e90aef9..114de79 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ dist: clean link @mkdir -p build dist @rm -rf build/dist-* @echo - @bash -c 'if [[ -n `git status --porcelain` ]]; then echo "[ERROR] Worktree not clean as it should be (see: git status)"; exit 1; fi' + @sh -c 'if test -n `git status --porcelain`; then echo "[ERROR] Worktree not clean as it should be (see: git status)"; exit 1; fi' # Source bundle. git archive --format=tar "--prefix=dist-src/" HEAD | tar -C build -x @echo @@ -116,7 +116,7 @@ dist: clean link @echo "\n[\033[34mINFO \033[0m] DONE: Artifacts created and placed in 'dist'." @# Dependency Bundle. $(eval PCKROOT := build/dist-rt) - @bash -c 'if [ ".exe" = "$(BINEXT)" ]; then \ + @sh -c 'if test ".exe" = "$(BINEXT)"; then \ rm -rf ./$(PCKROOT); \ mkdir -p ./$(PCKROOT)/bin; \ cp external/$(TOOLCHAIN)/rt/bin/libarchive-13.dll $(PCKROOT)/bin/; \ diff --git a/contrib/build-env-setup/README.md b/contrib/build-env-setup/README.md index 1467f73..064f6f8 100644 --- a/contrib/build-env-setup/README.md +++ b/contrib/build-env-setup/README.md @@ -78,15 +78,11 @@ true \ && PKGINIT=true \ && PKGADD="$SUDO apk add" \ && PKGDEL="$SUDO apk del" \ - && PKGCLEAN="$SUDO apk clean" \ + && PKGCLEAN="$SUDO apk cache clean || true" \ && HOST=x86_64-w64-mingw32 \ && true - -## make, install - -As soon environ is configured, we can trigger the build: - +### Setup build env true \ && GIT_TAG="master" \ && LIBARCHIVE_VERSION="3.6.2" \ @@ -94,7 +90,6 @@ true \ && CJSON_VERSION="1.7.15" \ && PCRE_VERSION="8.45" \ \ - && WORKDIR="/home/${USER}/work" \ && CACHE_DIR="/var/tmp" \ && INSTALL_ROOT="/usr/${HOST:-local}" \ && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ @@ -203,24 +198,32 @@ true \ && rm -rf "pcre-${PCRE_VERSION:?}" \ && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${PCRE_BINTGZ:?}" \ );fi \ - && printf '\n Build project itself\n\n' \ + && ${PKGDEL:?} $PKGS_TO_DEL && ${PKGCLEAN:?} \ + && true + +### Make +true \ + && WORKDIR="/home/${USER:?}/work" \ + \ + && printf '\n Build GateleenResclone\n\n' \ && mkdir -p "${WORKDIR:?}" && cd "${WORKDIR:?}" \ && git clone --depth 42 --branch "${GIT_TAG:?}" https://github.com/hiddenalpha/GateleenResclone.git . \ && git config advice.detachedHead false \ && git checkout --detach "${GIT_TAG:?}" \ - && if test -n "$HOST"; then true \ + && if echo $HOST|grep -q '\-mingw'; then true \ && HORSCHT="TOOLCHAIN=mingw CC=$HOST-cc LD=$HOST-ld AR=$HOST-ar BINEXT=.exe LIBSEXT=.lib" \ - && sed -i -E 's;^CFLAGS \?=(.*)?$;CFLAGS ?= -DPCRE_STATIC=1 -DCURL_STATICLIB=1 \1;' Makefile \ - && sed -i -E 's;-larchive;/usr/x86_64-w64-mingw32/lib/libarchive.a;' Makefile \ - && sed -i -E 's;(-Wl,-Bdynamic);\1 -lws2_32 -lbcrypt;' Makefile \ + && tmpfile="$(mktemp "/tmp/XXXXXXXXXXXXXXXX")" \ + && mv Makefile "${tmpfile:?}" && cat "${tmpfile:?}" \ + | sed -E 's;^CFLAGS \?=(.*)?$;CFLAGS ?= -DPCRE_STATIC=1 -DCURL_STATICLIB=1 \1;' \ + | sed -E 's;-larchive;/usr/x86_64-w64-mingw32/lib/libarchive.a;' \ + | sed -E 's;(-Wl,-Bdynamic);\1 -lws2_32 -lbcrypt;' \ + | grep -v 'Worktree not clean as it should be' \ + > Makefile \ + && rm "${tmpfile:?}" \ ;fi \ && make clean $HORSCHT && make -e -j$(nproc) $HORSCHT \ - && find . -not -wholename './dist*' -delete \ - && ${PKGDEL:?} $PKGS_TO_DEL && ${PKGCLEAN:?} \ && dirOfDistBundle="$(realpath dist)" \ - && printf '\n SUCCESS :) Distribution bundle is ready in:\n\n %s\n\n Tip: Before pulling out your hair about how to get that archive out of\n your qemu VM. STOP kluding around with silly tools and learn how\n basic tools do the job perfectly fine:\n\n ssh %s@localhost -p2222 -- sh -c '\''true && cd "%s" && tar c *'\'' | tar x\n\n' "${dirOfDistBundle:?}" "$USER" "${dirOfDistBundle:?}" \ + && printf '\n SUCCESS :) Distribution bundle is ready in:\n\n %s\n\n Tip: Before pulling out your hair about how to get that archive out of\n your qemu VM. STOP kluding around with silly tools and learn how\n basic tools do the job perfectly fine. So go to your host and run:\n\n ssh %s@localhost -p2222 -- sh -c '\''true && cd "%s" && tar c *'\'' | tar x\n\n' "${dirOfDistBundle:?}" "$USER" "${dirOfDistBundle:?}" \ && true - - -- cgit v1.1