From 323f8a8805e6cbda1d69a65ab6b6725d26a265dd Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 12 Oct 2024 00:48:59 +0200 Subject: cleanup 'configure' --- configure | 30 ++++++------------------------ contrib/build-env-setup/setup | 9 ++------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/configure b/configure index e15b0b7..ba4317f 100755 --- a/configure +++ b/configure @@ -1,4 +1,4 @@ - +#!/bin/sh set -e if test -n "$BASH_VERSION"; then set -o posix; fi @@ -56,6 +56,7 @@ printMakefile () { printf '%s\n' '# when calling configure again.' printf '\n' printf '%s\n' 'CC=gcc' + printf '%s\n' 'LD=gcc' printf '%s\n' 'TAR=tar' printf '%s\n' 'MKDIRS=mkdir -p' printf '%s\n' 'RIMRAF=rm -rf' @@ -64,7 +65,6 @@ printMakefile () { printf '%s\n' "EXEC_PREFIX=$exec_prefix" printf '%s\n' "EXEC_SUFFIX=$exec_suffix" printf '%s\n' "BINDIR=$bindir" - printf '%s\n' "NDEBUG=1" # If PROJECT_VERSION set, use it. # If not, try generate via git describe. @@ -78,27 +78,9 @@ printMakefile () { printf '%s\n' ' echo "$$ret")' printf '\n' - printf '%s' 'CFLAGS= --std=c99' - printf '%s' ' -Wall -Wextra -Werror -fmax-errors=3' - 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' - # 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)' - printf '%s\n' '' - printf '%s\n' 'LDFLAGS= -Wl,--no-demangle,--fatal-warnings' - printf '%s\n' '' - printf '%s\n' 'INCDIRS= -Isrc/bulk_ln -Isrc/common' + printf '%s' 'CFLAGS= --std=c99 -Wall -Wextra -Werror -Isrc/bulk_ln -Isrc/common -Os -DPROJECT_VERSION=$(PROJECT_VERSION)' printf '%s\n' '' - 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 "-DNDEBUG=1"' - printf '%s\n' ' LDFLAGS := $(LDFLAGS) -Wl,--gc-sections,--as-needed' - printf '%s\n' 'endif' + printf '%s\n' 'LDFLAGS= -Wl,--fatal-warnings,--gc-sections,--as-needed -s' if test "$verbose" = "0"; then printf '\n' @@ -122,7 +104,7 @@ printMakefile () { printf '%s\n' 'build/obj/%.o: src/%.c' printf '%s\n' ' echo " CC $@"' printf '%s\n' ' $(MKDIRS) "$(shell T=$@; echo $${T%/*})"' - printf '%s\n' ' $(CC) -c -o $@ $^ $(CFLAGS) $(INCDIRS)' + printf '%s\n' ' $(CC) -c -o $@ $^ $(CFLAGS)' printf '\n' printf '%s' 'build/bin/bulk-ln$(EXEC_SUFFIX):' @@ -132,7 +114,7 @@ printMakefile () { printf '\n' # commands printf '%s\n' ' echo " LN $@"' printf '%s\n' ' $(MKDIRS) "$(shell T=$@; echo $${T%/*})"' - printf '%s\n' ' $(CC) -o $@ $(LDFLAGS) $^ $(LIBSDIR)' + printf '%s\n' ' $(LD) -o $@ $(LDFLAGS) $^' printf '\n' printf '%s\n' '.PHONY: dist' diff --git a/contrib/build-env-setup/setup b/contrib/build-env-setup/setup index b9f0f28..f5f51ce 100644 --- a/contrib/build-env-setup/setup +++ b/contrib/build-env-setup/setup @@ -7,15 +7,12 @@ exit 1 true \ && GIT_TAG="master" \ && CONFIGURE_OPTS= \ + && WORKDIR="${HOME:?}/work" \ && PKGS_TO_ADD="ca-certificates curl gcc git make libc-dev tar" \ - && PKGS_TO_DEL="curl gcc git make libc-dev" \ && SUDO=sudo \ && PKGINIT="$SUDO apt update" \ && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGDEL="$SUDO apt purge -y" \ - && PKGCLEAN="$SUDO apt clean" \ - && WORKDIR="${HOME:?}/work" \ - && true \ + && `# prepare` \ && mkdir -p "${WORKDIR:?}" && cd "${WORKDIR:?}" \ && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ && git clone --depth 42 --branch "${GIT_TAG:?}" https://github.com/hiddenalpha/bulk-ln.git . \ @@ -24,8 +21,6 @@ true \ && ./configure $CONFIGURE_OPTS \ && make clean && make -j$(nproc) \ && $SUDO make install \ - && 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 -p%d -T '\''true && cd "%s" && tar c *'\'' | tar x\n\n BTW: In addition bulk-ln got installed and is ready-to-use.\n\n' "${dirOfDistBundle:?}" "$USER" "$(env|grep SSH_CLIENT|cut -d' ' -f3)" "${dirOfDistBundle:?}" \ && true -- cgit v1.1