From ba04951291a1242f946c728c3d8eaf76d6cd747a Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 17 Jun 2021 12:13:14 +0300 Subject: [PATCH] Simplify CI and make it easy to get a standalone build The number of options that needed to be set to get a proper standalone build is fairly large. Given that it was already repeated twice in different CI contexts it occurred to me the whole batch of settings should just be one preset so that people can build their own standalone version easily from the source tarball if they want. --- .github/workflows/release.yml | 18 +++++------------- .github/workflows/test.yml | 12 ++---------- configure.ac | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 410bba16..dce92192 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,20 +16,12 @@ jobs: run: | echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV ./bootstrap.sh - ./configure \ - --without-man-page \ - --disable-tests \ - --without-bash-completion-dir \ - --without-zsh-completion-dir \ - --program-suffix=-standalone.sh \ - --with-deployment=standalone \ - --bindir=/ \ - COMM=comm GIT=git GREP=grep SED=sed SHELL=/bin/sh - make DESTDIR=. install-exec + ./configure --with-standalone --bindir=/ + make DESTDIR=. install-exec - name: Upload standalone script artifact uses: actions/upload-artifact@v2 with: - name: vcsh-standalone + name: standalone-deployment path: vcsh-standalone.sh ghrelase: @@ -61,7 +53,7 @@ jobs: - name: Download standalone script artifact uses: actions/download-artifact@v2 with: - name: vcsh-standalone + name: standalone-deployment - name: Publish Release uses: softprops/action-gh-release@v1 with: @@ -69,6 +61,6 @@ jobs: files: | vcsh-${{ env.VERSION }}.zip vcsh-${{ env.VERSION }}.tar.xz - standalone/vcsh-standalone.sh + vcsh-standalone.sh env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 21efb5d6..874beb75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,20 +17,12 @@ jobs: - name: Configure standalone script run: | ./bootstrap.sh - ./configure - --without-man-page \ - --disable-tests \ - --without-bash-completion-dir \ - --without-zsh-completion-dir \ - --with-deployment=standalone \ - --program-suffix=-standalone.sh \ - --bindir=/ \ - COMM=comm GIT=git GREP=grep SED=sed SHELL=/bin/sh + ./configure --with-standalone --bindir=/ make DESTDIR=. install-exec - name: Post standalone script artifact uses: actions/upload-artifact@v2 with: - name: vcsh-standalone + name: standalone-deployment path: vcsh-standalone.sh test: diff --git a/configure.ac b/configure.ac index 5f767a35..051de655 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,23 @@ AC_DEFUN([AX_PROGVAR], [ test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) ]) +AC_ARG_WITH([standalone], + AS_HELP_STRING([--with-standalone], + [Use configuration presets for a standalone script deployment @<:@default=no@:>@]), + [COMM=comm GIT=git GREP=grep SED=sed SHELL=/bin/sh + with_deployment=standalone + with_man_page=no + enable_tests=no + with_bash_completion_dir=no + with_zsh_completion_dir=no + program_suffix=-standalone.sh + # By this point program_suffix has already been processed so we have to redo what configure did + # Code copied from approx L2670-2671 + program_transform_name="s&\$&$program_suffix&;$program_transform_name" + program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + ], + []) + AC_PROG_AWK AC_PROG_GREP AC_PROG_SED