Skip to content

Commit

Permalink
cleanup 'configure'
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddenalpha committed Oct 11, 2024
1 parent f3b8232 commit 323f8a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
30 changes: 6 additions & 24 deletions configure
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#!/bin/sh
set -e
if test -n "$BASH_VERSION"; then set -o posix; fi

Expand Down Expand Up @@ -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'
Expand All @@ -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.
Expand All @@ -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'
Expand All @@ -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):'
Expand All @@ -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'
Expand Down
9 changes: 2 additions & 7 deletions contrib/build-env-setup/setup
Original file line number Diff line number Diff line change
Expand Up @@ -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 . \
Expand All @@ -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
Expand Down

0 comments on commit 323f8a8

Please sign in to comment.