diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b117cb0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,113 @@ +name: ci +on: [push] +jobs: + + build-test: + name: Build and Test + runs-on: ubuntu-latest + container: ${{ matrix.image }} + + strategy: + matrix: + include: + - image: alpine:latest + vim-ycm-owner: detwiler + vim-ycm-ref: llvm-10 + - image: fedora:latest + vim-ycm-owner: ycm-core + vim-ycm-ref: master + - image: ubuntu:rolling + vim-ycm-owner: ycm-core + vim-ycm-ref: master + + env: + USER: ${{ github.repository_owner }} + VIM_YCM_OWNER: ${{ matrix.vim-ycm-owner }} + VIM_YCM_REF: ${{ matrix.vim-ycm-ref }} + DEBIAN_FRONTEND: noninteractive + + steps: + - name: Upgrade Packages + run: | + os_id=`sed -ne 's/^ID=//p' /etc/os-release` + case $os_id in + alpine) apk update && apk upgrade && apk add git;; + fedora) dnf -y upgrade && dnf -y install git-core which;; + ubuntu) apt-get -y update && apt-get -y upgrade && apt-get -y install git;; + esac + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install Prerequisites + run: build-aux/install-prereqs + + - name: Bootstrap + run: ./bootstrap + env: + ENVCONF_BOOTSTRAP_INSTALL_REQS: true + + - name: Configure + run: ./configure --prefix=$RUNNER_TEMP/.local --sysconfdir=$RUNNER_TEMP/.config + + - name: Build + run: make + + - name: Test + run: make distcheck + + - name: Install + run: make install + + - name: Integration Test + run: | + vim -es -u $RUNNER_TEMP/.config/vim/vimrc -i NONE -c PlugInstall -c qa + find $RUNNER_TEMP/.config/vim/plugged/YouCompleteMe -name 'ycm_core.so' | grep . + + - name: Configure Version + run: echo "PROJECT_VERSION=`cat .version`" >>$GITHUB_ENV + + - name: Upload Distribution Artifact + uses: actions/upload-artifact@v2 + with: + name: distribution-tarball + path: | + envconf-${{ env.PROJECT_VERSION }}.tar.gz + .version + + create-release: + name: Create Release + runs-on: ubuntu-latest + needs: build-test + if: startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Download Distribution Artifact + uses: actions/download-artifact@v2 + with: + name: distribution-tarball + + - name: Configure Version + run: echo "PROJECT_VERSION=`cat .version`" >>$GITHUB_ENV + + - name: Create Release + id: create-release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ env.PROJECT_VERSION }} + release_name: Release ${{ env.PROJECT_VERSION }} + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: envconf-${{ env.PROJECT_VERSION }}.tar.gz + asset_name: envconf-${{ env.PROJECT_VERSION }}.tar.gz + asset_content_type: application/gzip diff --git a/.gitmodules b/.gitmodules index 15660cd..80b4f8d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,10 @@ [submodule "gnulib"] path = .gnulib url = https://github.com/coreutils/gnulib.git + branch = master + shallow = true [submodule "quickhatch-autotools"] path = .qh-at url = https://github.com/quickhatch/quickhatch-autotools.git + branch = master + shallow = true diff --git a/.gnulib b/.gnulib index 613ab49..43ee1a6 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 613ab49eb43a5961b948041ca3c51d968b22067e +Subproject commit 43ee1a6bf4025071193ac8fe5f702d85e58b756f diff --git a/.qh-at b/.qh-at index cea07f8..cdb606b 160000 --- a/.qh-at +++ b/.qh-at @@ -1 +1 @@ -Subproject commit cea07f8fbfaf864edc7ef91d933a648f285b7dc6 +Subproject commit cdb606b7bb6a7d38b6078928309574b756b687c6 diff --git a/Makefile.am b/Makefile.am index 966fe55..19b3609 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,8 @@ DISTCLEANFILES = $(gvg_version) \ $(pkg_release) EXTRA_DIST = $(gvg_version) \ - m4/gnulib-cache.m4 + m4/gnulib-cache.m4 \ + README.md AM_DISTCHECK_CONFIGURE_FLAGS = HOME=$(top_distdir) diff --git a/README b/README deleted file mode 100644 index 4d05f8b..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -envconf - environment configuration diff --git a/README.md b/README.md new file mode 100644 index 0000000..54f587b --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +[![ci](https://github.com/detwiler/envconf/workflows/ci/badge.svg)](https://github.com/detwiler/envconf/actions) + +# envconf +Environment Configuration diff --git a/bootstrap b/bootstrap index 25920e9..5f1b1b7 100755 --- a/bootstrap +++ b/bootstrap @@ -1,10 +1,10 @@ #! /bin/sh # Print a version string. -scriptversion=2017-09-19.08; # UTC +scriptversion=2020-11-18.17; # UTC # Bootstrap this package from checked-out sources. -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2020 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -47,6 +47,8 @@ PERL="${PERL-perl}" me=$0 +default_gnulib_url=git://git.sv.gnu.org/gnulib + usage() { cat </dev/null; then - echo "$0: getting gnulib files..." - git submodule init -- "$gnulib_path" || exit $? - git submodule update -- "$gnulib_path" || exit $? + case ${GNULIB_SRCDIR--} in + -) + # Note that $use_git is necessarily true in this case. + if git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + git submodule init -- "$gnulib_path" || exit $? + git submodule update -- "$gnulib_path" || exit $? - elif [ ! -d "$gnulib_path" ]; then - echo "$0: getting gnulib files..." + elif [ ! -d "$gnulib_path" ]; then + echo "$0: getting gnulib files..." - trap cleanup_gnulib 1 2 13 15 + trap cleanup_gnulib 1 2 13 15 - shallow= - git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' - git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" || - cleanup_gnulib + shallow= + if test -z "$GNULIB_REVISION"; then + git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + fi + git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ + || cleanup_gnulib - trap - 1 2 13 15 - fi - GNULIB_SRCDIR=$gnulib_path - ;; -*) - # Use GNULIB_SRCDIR directly or as a reference. - if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ - git_modules_config submodule.gnulib.url >/dev/null; then - echo "$0: getting gnulib files..." - if git submodule -h|grep -- --reference > /dev/null; then - # Prefer the one-liner available in git 1.6.4 or newer. - git submodule update --init --reference "$GNULIB_SRCDIR" \ - "$gnulib_path" || exit $? - else - # This fallback allows at least git 1.5.5. - if test -f "$gnulib_path"/gnulib-tool; then - # Since file already exists, assume submodule init already complete. - git submodule update -- "$gnulib_path" || exit $? + trap - 1 2 13 15 + fi + GNULIB_SRCDIR=$gnulib_path + ;; + *) + # Use GNULIB_SRCDIR directly or as a reference. + if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ + git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + if git submodule -h|grep -- --reference > /dev/null; then + # Prefer the one-liner available in git 1.6.4 or newer. + git submodule update --init --reference "$GNULIB_SRCDIR" \ + "$gnulib_path" || exit $? else - # Older git can't clone into an empty directory. - rmdir "$gnulib_path" 2>/dev/null - git clone --reference "$GNULIB_SRCDIR" \ - "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ - && git submodule init -- "$gnulib_path" \ - && git submodule update -- "$gnulib_path" \ - || exit $? + # This fallback allows at least git 1.5.5. + if test -f "$gnulib_path"/gnulib-tool; then + # Since file already exists, assume submodule init already complete. + git submodule update -- "$gnulib_path" || exit $? + else + # Older git can't clone into an empty directory. + rmdir "$gnulib_path" 2>/dev/null + git clone --reference "$GNULIB_SRCDIR" \ + "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ + && git submodule init -- "$gnulib_path" \ + && git submodule update -- "$gnulib_path" \ + || exit $? + fi fi + GNULIB_SRCDIR=$gnulib_path fi - GNULIB_SRCDIR=$gnulib_path + ;; + esac + + if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \ + && ! git_modules_config submodule.gnulib.url >/dev/null; then + (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib fi - ;; -esac -# $GNULIB_SRCDIR now points to the version of gnulib to use, and -# we no longer need to use git or $gnulib_path below here. + # $GNULIB_SRCDIR now points to the version of gnulib to use, and + # we no longer need to use git or $gnulib_path below here. + + if $bootstrap_sync; then + cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { + echo "$0: updating bootstrap and restarting..." + case $(sh -c 'echo "$1"' -- a) in + a) ignored=--;; + *) ignored=ignored;; + esac + exec sh -c \ + 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ + $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ + "$0" "$@" --no-bootstrap-sync + } + fi -if $bootstrap_sync; then - cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { - echo "$0: updating bootstrap and restarting..." - case $(sh -c 'echo "$1"' -- a) in - a) ignored=--;; - *) ignored=ignored;; - esac - exec sh -c \ - 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ - $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ - "$0" "$@" --no-bootstrap-sync - } + gnulib_tool=$GNULIB_SRCDIR/gnulib-tool + <$gnulib_tool || exit $? fi -gnulib_tool=$GNULIB_SRCDIR/gnulib-tool -<$gnulib_tool || exit $? - # Get translations. download_po_files() { subdir=$1 domain=$2 echo "$me: getting translations into $subdir for $domain..." - cmd=$(printf "$po_download_command_format" "$domain" "$subdir") - eval "$cmd" && return - # Fallback to HTTPS. - cmd=$(printf "$po_download_command_format2" "$subdir" "$domain") + cmd=$(printf "$po_download_command_format" "$subdir" "$domain") eval "$cmd" } @@ -898,36 +946,47 @@ fi # Import from gnulib. -gnulib_tool_options="\ - --import\ - --no-changelog\ - --aux-dir $build_aux\ - --doc-base $doc_base\ - --lib $gnulib_name\ - --m4-base $m4_base/\ - --source-base $source_base/\ - --tests-base $tests_base\ - --local-dir $local_gl_dir\ - $gnulib_tool_option_extras\ -" -if test $use_libtool = 1; then - case "$gnulib_tool_options " in - *' --libtool '*) ;; - *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; - esac -fi -echo "$0: $gnulib_tool $gnulib_tool_options --import ..." -$gnulib_tool $gnulib_tool_options --import $gnulib_modules \ - || die "gnulib-tool failed" +if $use_gnulib; then + gnulib_tool_options="\ + --no-changelog\ + --aux-dir=$build_aux\ + --doc-base=$doc_base\ + --lib=$gnulib_name\ + --m4-base=$m4_base/\ + --source-base=$source_base/\ + --tests-base=$tests_base\ + --local-dir=$local_gl_dir\ + $gnulib_tool_option_extras\ + " + if test $use_libtool = 1; then + case "$gnulib_tool_options " in + *' --libtool '*) ;; + *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; + esac + fi + echo "$0: $gnulib_tool $gnulib_tool_options --import ..." + $gnulib_tool $gnulib_tool_options --import $gnulib_modules \ + || die "gnulib-tool failed" -for file in $gnulib_files; do - symlink_to_dir "$GNULIB_SRCDIR" $file \ - || die "failed to symlink $file" -done + for file in $gnulib_files; do + symlink_to_dir "$GNULIB_SRCDIR" $file \ + || die "failed to symlink $file" + done +fi bootstrap_post_import_hook \ || die "bootstrap_post_import_hook failed" +# Don't proceed if there are uninitialized submodules. In particular, +# the next step will remove dangling links, which might be links into +# uninitialized submodules. +# +# Uninitialized submodules are listed with an initial dash. +if $use_git && git submodule | grep '^-' >/dev/null; then + die "some git submodules are not initialized. " \ + "Run 'git submodule update --init' and bootstrap again." +fi + # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some # gnulib-populated directories. Such .m4 files would cause aclocal to fail. # The following requires GNU find 4.2.3 or newer. Considering the usual @@ -1020,7 +1079,7 @@ bootstrap_epilogue echo "$0: done. Now you can run './configure'." # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff --git a/bootstrap.conf b/bootstrap.conf index 58ed3c5..9eb7997 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -31,44 +31,6 @@ gnulib_modules=" vc-list-files " -# Additional xgettext options to use. Use "\\\newline" to break lines. -XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\ - --from-code=UTF-8\\\ - --flag=asprintf:2:c-format --flag=vasprintf:2:c-format\\\ - --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\ - --flag=wrapf:1:c-format\\\ -' - -# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]" -# appears in configure.ac, exclude some unnecessary files. -# Without grep's -E option (not portable enough, pre-configure), -# the following test is ugly. Also, this depends on the existence -# of configure.ac, not the obsolescent-named configure.in. But if -# you're using this infrastructure, you should care about such things. - -gettext_external=0 -grep '^[ ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null && - gettext_external=1 -grep '^[ ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null && - gettext_external=1 - -if test $gettext_external = 1; then - # Gettext supplies these files, but we don't need them since - # we don't have an intl subdirectory. - excluded_files=' - m4/glibc2.m4 - m4/intdiv0.m4 - m4/lcmessage.m4 - m4/lock.m4 - m4/printf-posix.m4 - m4/size_max.m4 - m4/uintmax_t.m4 - m4/ulonglong.m4 - m4/visibility.m4 - m4/xsize.m4 - ' -fi - # gnulib overrides; leave build_aux and m4_base set to bootstrap defaults gnulib_name=libgnu source_base=.libgnu/gnu @@ -78,14 +40,14 @@ tests_base=.libgnu/tests # bootstrap overrides checkout_only_file= -# Build prerequisites +# Build requirements buildreq="\ -autoconf 2.63 -automake 1.12 -bzip2 - -git 1.7 -gzip - -tar - +autoconf 2.64 +automake 1.12 +git 2.10 +gzip - +join - +tar - " # non-gnulib submodules @@ -104,4 +66,6 @@ bootstrap_post_import_hook() test "x$sm_path" = x && die "Could not determine submodule path for $sm" git submodule update --init $sm_path || return 1 done + + test -z ${ENVCONF_BOOTSTRAP_INSTALL_REQS+x} || build-aux/install-reqs } # bootstrap_post_import_hook diff --git a/build-aux/install-prereqs b/build-aux/install-prereqs new file mode 100755 index 0000000..1c30194 --- /dev/null +++ b/build-aux/install-prereqs @@ -0,0 +1,25 @@ +#! /bin/sh + +OS_RELEASE_FILE=${OS_RELEASE_FILE:-/etc/os-release} +SUDO=`which sudo` + +pkgs_common=' +autoconf +automake +coreutils +git +gzip +tar +' + +test -r $OS_RELEASE_FILE || exit + +os_id=`sed -ne 's/^ID=//p' $OS_RELEASE_FILE` + +test -n $os_id || exit + +case $os_id in + alpine) $SUDO apk add $pkgs_common;; + fedora) $SUDO dnf --assumeyes install $pkgs_common;; + ubuntu) $SUDO apt-get --assume-yes install $pkgs_common;; +esac diff --git a/build-aux/install-reqs b/build-aux/install-reqs new file mode 100755 index 0000000..56f2907 --- /dev/null +++ b/build-aux/install-reqs @@ -0,0 +1,53 @@ +#! /bin/sh + +OS_RELEASE_FILE=${OS_RELEASE_FILE:-/etc/os-release} +SUDO=`which sudo` + +pkgs_common=' +cmake +clang +curl +findutils +gcc +grep +make +' + +pkgs_alpine=' +aws-cli +clang-extra-tools +ctags +g++ +python3-dev +vim +' + +pkgs_fedora=' +awscli +clang-tools-extra +ctags +gcc-c++ +python3-devel +vim-enhanced +' + +pkgs_ubuntu=' +awscli +clangd +exuberant-ctags +g++ +python3-dev +vim +' + +test -r $OS_RELEASE_FILE || exit + +os_id=`sed -ne 's/^ID=//p' $OS_RELEASE_FILE` + +test -n $os_id || exit + +case $os_id in + alpine) $SUDO apk add $pkgs_common $pkgs_alpine;; + fedora) $SUDO dnf --assumeyes install $pkgs_common $pkgs_fedora;; + ubuntu) $SUDO apt-get --assume-yes install $pkgs_common $pkgs_ubuntu;; +esac diff --git a/configure.ac b/configure.ac index 262d31a..c72d7b9 100644 --- a/configure.ac +++ b/configure.ac @@ -5,12 +5,12 @@ AC_INIT([envconf], [m4_esyscmd([build-aux/git-version-gen .tarball-version])], [mike@detwiler.io]) -AC_PREREQ([2.63]) +AC_PREREQ([2.64]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([data/bash/common/bashrc.in]) -AM_INIT_AUTOMAKE([-Wall -Wno-portability -Werror dist-bzip2]) +AM_INIT_AUTOMAKE([-Wall -Wno-portability -Werror foreign]) AM_SILENT_RULES([yes]) ## determine host os ## @@ -51,16 +51,17 @@ AC_PROG_SED ## aws-cli ## -AC_CHECK_PROG([have_aws_cli], [aws], [yes]) -AM_CONDITIONAL([HAVE_AWS_CLI], [test "x$have_aws_cli" = xyes]) - -QH_VAR_ENSURE([AWS_CONFIG_DIR], - [path to aws-cli configuration directory], - [$HOME/.aws]) - -QH_VAR_ENSURE([AWS_SHARED_CREDENTIALS_FILE], - [path to aws-cli shared credentials file], - [$AWS_CONFIG_DIR/credentials]) +QH_ARG_ENABLE([aws_cli], [yes]) +AM_CONDITIONAL([ENABLE_AWS_CLI], [test "x$enable_aws_cli" = xyes]) +AM_COND_IF([ENABLE_AWS_CLI], + [QH_REQUIRE_PROG([AWS], [aws], [path to aws]) + QH_VAR_ENSURE([AWS_CONFIG_DIR], + [path to aws-cli configuration directory], + [$HOME/.aws]) + QH_VAR_ENSURE([AWS_SHARED_CREDENTIALS_FILE], + [path to aws-cli shared credentials file], + [$AWS_CONFIG_DIR/credentials])]) +AM_CONDITIONAL([HAVE_AWS_CLI], [test "x$AWS" != x]) ## bash ## @@ -100,12 +101,30 @@ QH_VAR_ENSURE([PS1_GIT_COLOR], [bash prompt git status color], [32]) QH_VAR_ENSURE([PS1_PWD_COLOR], [bash prompt pwd color], [0]) QH_VAR_ENSURE([PS1_AWS_COLOR], [bash prompt aws profile color], [33]) -## clangd (for YouCompleteMe) ## -AC_ARG_VAR([CLANGD], [path to clangd]) -AC_PATH_PROG([CLANGD], [clangd]) +## python ## + +AM_PATH_PYTHON([3.0], [], + [AC_MSG_ERROR([could not find python version >= 3.0])]) + +AC_CACHE_CHECK([for Windows native Python 3], + [ac_cv_path_WIN_PY3], + [AC_PATH_PROGS_FEATURE_CHECK([WIN_PY3], + [python python3], + [if $ac_path_WIN_PY3 -c 'import sys; print(sys.version)' | $GREP '^3.*MSC' &>/dev/null; then + ac_cv_path_WIN_PY3=$ac_path_WIN_PY3 + ac_path_WIN_PY3_found=: + fi])]) +AM_CONDITIONAL([HAVE_WIN_PY3], [test "x$ac_cv_path_WIN_PY3" != x]) +AM_COND_IF([HAVE_WIN_PY3], + [AC_SUBST([WIN_PY3_BASEDIR], [`dirname $ac_cv_path_WIN_PY3`]) + AC_SUBST([WIN_PY3_SCRIPTDIR], [$WIN_PY3_BASEDIR/Scripts]) + AC_CONFIG_FILES([data/bash/common/win-python-pathmung])]) ## conan ## +QH_REQUIRE_PROG([CLANG], [clang], [path to clang]) +QH_REQUIRE_PROG([GCC], [gcc], [path to gcc]) + QH_VAR_ENSURE([CONAN_CLANG_VERSIONS], [colon-separated list of Clang major versions for conan-package-tools], [9]) @@ -114,7 +133,7 @@ QH_VAR_ENSURE([CONAN_GCC_VERSIONS], [9]) QH_VAR_ENSURE([CONAN_PIP_COMMAND], [Name of Python3 version of the pip command], - [pip3]) + ["'$PYTHON -m pip'"]) QH_VAR_ENSURE([CONAN_USERNAME], [User name required by conan-package-tools], [$USER]) @@ -167,6 +186,7 @@ AM_CONDITIONAL([HAVE_PINENTRY_MAC], [test "x$PINENTRY_MAC" != xno]) ## git ## +QH_REQUIRE_PROG([GIT], [git], [path to git]) QH_VAR_ENSURE([GIT_AUTHOR_NAME], [human-readable name for git author], [`getent passwd $USER | cut -d: -f5`]) @@ -241,25 +261,6 @@ AM_COND_IF([HOST_OS_DARWIN], [/usr/local]) AC_CONFIG_FILES([data/bash/common/homebrew-pathmung])]) -## python ## - -AM_PATH_PYTHON([3.0], [], - [AC_MSG_ERROR([could not find python version >= 3.0])]) - -AC_CACHE_CHECK([for Windows native Python 3], - [ac_cv_path_WIN_PY3], - [AC_PATH_PROGS_FEATURE_CHECK([WIN_PY3], - [python python3], - [if $ac_path_WIN_PY3 -c 'import sys; print(sys.version)' | $GREP '^3.*MSC' &>/dev/null; then - ac_cv_path_WIN_PY3=$ac_path_WIN_PY3 - ac_path_WIN_PY3_found=: - fi])]) -AM_CONDITIONAL([HAVE_WIN_PY3], [test "x$ac_cv_path_WIN_PY3" != x]) -AM_COND_IF([HAVE_WIN_PY3], - [AC_SUBST([WIN_PY3_BASEDIR], [`dirname $ac_cv_path_WIN_PY3`]) - AC_SUBST([WIN_PY3_SCRIPTDIR], [$WIN_PY3_BASEDIR/Scripts]) - AC_CONFIG_FILES([data/bash/common/win-python-pathmung])]) - ## systemd ## # check for systemd-path @@ -274,14 +275,18 @@ AC_SUBST_FILE([XDG_BASEDIR_FILE]) ## vim ## -AC_ARG_VAR([EDITOR], [default text editor]) -AC_CHECK_PROG([EDITOR], [vim], [vim], [vi]) -AM_CONDITIONAL([HAVE_VIM], [test "x$EDITOR" = xvim]) -AM_COND_IF([HAVE_VIM], [AC_CONFIG_FILES([data/vim/gvimrc])]) +QH_REQUIRE_PROG([VIM], [vim], [path to vim]) +AC_CHECK_PROGS([GVIM], [gvim]) +AM_CONDITIONAL([HAVE_GVIM], [test "x$GVIM" = xgvim]) +AM_COND_IF([HAVE_GVIM], [AC_CONFIG_FILES([data/vim/gvimrc])]) + +# vim-plug requirements +QH_REQUIRE_PROG([CURL], [curl], [path to curl]) -QH_VAR_ENSURE([VIMRC_EXAMPLE_PATH], - [path to vimrc_example.vim], - [`(rpm -ql vim-common 2>/dev/null | $GREP '/vimrc_example.vim') || echo /dev/null`]) +# YouCompleteMe requirements +QH_REQUIRE_PROG([CLANGD], [clangd], [path to clangd]) +QH_REQUIRE_PROG([CMAKE], [cmake], [path to cmake]) +QH_REQUIRE_PROG([GCXX], [g++], [path to g++]) QH_VAR_ENSURE([VIM_CMAKE_BUILD_DIR], [vim-cmake plugin build directory], @@ -308,6 +313,8 @@ AM_COND_IF([HOST_OS_DARWIN], [GVIM_FONT_SEPARATOR='\ ']) AC_SUBST([GVIM_FONT_SEPARATOR]) +## configure output files + AC_CONFIG_FILES([Makefile data/Makefile data/autoconf/Makefile @@ -320,6 +327,7 @@ AC_CONFIG_FILES([Makefile data/bash/common/bashrc.d/aws-functions.sh data/bash/common/bashrc.d/ls.sh data/bash/common/bashrc.d/ps1.sh + data/bash/common/bashrc.d/vi.sh data/bash/common/profile.d/Makefile data/bash/common/profile.d/conan.sh data/bash/common/profile.d/editor.sh @@ -334,5 +342,4 @@ AC_CONFIG_FILES([Makefile data/vim/cmake.vim data/vim/ycm.vim ]) - AC_OUTPUT diff --git a/data/Makefile.am b/data/Makefile.am index 6e9a8a7..005bc1b 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -6,12 +6,9 @@ SUBDIRS = autoconf \ gnupg \ man \ readline \ - ruby + ruby \ + vim if HAVE_DIRCOLORS SUBDIRS += dircolors endif - -if HAVE_VIM -SUBDIRS += vim -endif diff --git a/data/bash/common/bashrc.d/.gitignore b/data/bash/common/bashrc.d/.gitignore index 496f49f..b564ed3 100644 --- a/data/bash/common/bashrc.d/.gitignore +++ b/data/bash/common/bashrc.d/.gitignore @@ -9,3 +9,4 @@ grep.sh ls.sh proxy.sh ps1.sh +vi.sh diff --git a/data/bash/common/bashrc.d/Makefile.am b/data/bash/common/bashrc.d/Makefile.am index abb2e31..ed15efc 100644 --- a/data/bash/common/bashrc.d/Makefile.am +++ b/data/bash/common/bashrc.d/Makefile.am @@ -37,16 +37,12 @@ if HAVE_EXUBERANT_CTAGS static_data += $(ctags) endif -if HAVE_VIM -static_data += $(vi) -endif - dist_bashrc_DATA = $(static_data) # data/scripts generated by configure (source file automatically distributed) conf_data = $(aws_functions) \ - $(ls) - + $(ls) \ + $(vi) if !HOST_OS_MINGW conf_data += $(ps1) diff --git a/data/bash/common/bashrc.d/vi.sh b/data/bash/common/bashrc.d/vi.sh deleted file mode 100644 index c903be6..0000000 --- a/data/bash/common/bashrc.d/vi.sh +++ /dev/null @@ -1 +0,0 @@ -alias vi=vim diff --git a/data/bash/common/bashrc.d/vi.sh.in b/data/bash/common/bashrc.d/vi.sh.in new file mode 100644 index 0000000..620c3d0 --- /dev/null +++ b/data/bash/common/bashrc.d/vi.sh.in @@ -0,0 +1 @@ +alias vi=@VIM@ diff --git a/data/bash/common/profile.d/editor.sh.in b/data/bash/common/profile.d/editor.sh.in index b991a43..4fc75c5 100644 --- a/data/bash/common/profile.d/editor.sh.in +++ b/data/bash/common/profile.d/editor.sh.in @@ -1,6 +1,5 @@ # editor settings -export EDITOR=@EDITOR@ - +export EDITOR=@VIM@ export VISUAL=$EDITOR export GIT_EDITOR=$EDITOR diff --git a/data/vim/Makefile.am b/data/vim/Makefile.am index b012067..02794b7 100644 --- a/data/vim/Makefile.am +++ b/data/vim/Makefile.am @@ -42,31 +42,19 @@ vimconf_DATA += $(vimconf_make_data) make_output = $(vimconf_make_data) \ $(vim_make_data) -# vimrc has no input source file to distribute -make_sources = $(addsuffix .in,$(vimconf_make_data)) +make_sources = $(addsuffix .in,$(make_output)) # explicit source file distribution EXTRA_DIST = $(make_sources) CLEANFILES = $(make_output) -$(vimrc): @VIMRC_EXAMPLE_PATH@ Makefile - $(AM_V_GEN) \ - ( \ - printf 'source %s/%s\n' $(vimconfdir) $(init); \ - cat $<; \ - printf '\n'; \ - printf 'source %s/%s\n' $(vimconfdir) $(cmake); \ - printf 'source %s/%s\n' $(vimconfdir) $(ycm); \ - printf 'source %s/%s\n' $(vimconfdir) $(vim_plug); \ - printf 'source %s/%s\n' $(vimconfdir) $(option); \ - printf 'source %s/%s\n' $(vimconfdir) $(map); \ - ) >$@-t && mv $@-t $@ - # sed command to build data/scripts -EDIT = -e 's:@PYTHON[@]:$(PYTHON):g' \ - -e 's:@vimdir[@]:$(vimdir):g' \ +EDIT = -e 's:@CURL[@]:$(CURL):g' \ + -e 's:@PYTHON[@]:$(PYTHON):g' \ -e 's:@vimautoloaddir[@]:$(vimautoloaddir):g' \ + -e 's:@vimconfdir[@]:$(vimconfdir):g' \ + -e 's:@vimdir[@]:$(vimdir):g' \ -e 's:@vimpluggeddir[@]:$(vimpluggeddir):g' \ -e 's:@VIM_YCM_OWNER[@]:$(VIM_YCM_OWNER):g' \ -e 's:@VIM_YCM_REF[@]:$(VIM_YCM_REF):g' diff --git a/data/vim/vim-plug.vim.in b/data/vim/vim-plug.vim.in index 805113d..4e10741 100644 --- a/data/vim/vim-plug.vim.in +++ b/data/vim/vim-plug.vim.in @@ -4,7 +4,7 @@ " Install vim-plug if not found if empty(glob('@vimautoloaddir@/plug.vim')) - silent !curl -sfLo @vimautoloaddir@/plug.vim --create-dirs + silent !@CURL@ -sfLo @vimautoloaddir@/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim endif diff --git a/data/vim/vimrc.in b/data/vim/vimrc.in new file mode 100644 index 0000000..d3c0376 --- /dev/null +++ b/data/vim/vimrc.in @@ -0,0 +1,9 @@ +" vim: set ft=vim : + +source @vimconfdir@/init.vim +source $VIMRUNTIME/vimrc_example.vim +source @vimconfdir@/cmake.vim +source @vimconfdir@/ycm.vim +source @vimconfdir@/vim-plug.vim +source @vimconfdir@/option.vim +source @vimconfdir@/map.vim diff --git a/m4/.gitignore b/m4/.gitignore index 7b51acd..4f60957 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -3,3 +3,4 @@ /gnulib-common.m4 /gnulib-comp.m4 /gnulib-tool.m4 +/zzgnulib.m4