Skip to content

Commit

Permalink
Issue #131: CentOS 7 Support
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Detwiler <mike@detwiler.io>
  • Loading branch information
detwiler committed Dec 10, 2022
1 parent 0b053eb commit 50217ee
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if !ENABLE_VIM_CMAKE
AM_DISTCHECK_CONFIGURE_FLAGS += --disable-vim-cmake
endif

AM_DISTCHECK_CONFIGURE_FLAGS += --disable-ycm
AM_DISTCHECK_CONFIGURE_FLAGS += --disable-vim-plug-install

$(gvg_version):
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
Expand Down
18 changes: 13 additions & 5 deletions build-aux/install-buildreqs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,24 @@ case $ID in
;;
centos)
case $VERSION_ID in
7)
repo_pkgs='centos-release-scl epel-release'
enable_repos=
pkgs_centos=rh-git227
$SUDO yum --assumeyes install dnf
;;
8)
extra_repos=powertools
repo_pkgs='epel-release epel-next-release'
enable_repos=powertools
;;
9)
extra_repos=crb
repo_pkgs='epel-release epel-next-release'
enable_repos=crb
;;
esac
$SUDO dnf --assumeyes config-manager --set-enabled $extra_repos
$SUDO dnf --assumeyes --refresh install epel-release epel-next-release
$SUDO dnf --assumeyes --refresh install --allowerasing $pkgs_common
test "x$enable_repos" != x && $SUDO dnf --assumeyes config-manager --set-enabled $enable_repos
$SUDO dnf --assumeyes --refresh install $repo_pkgs
$SUDO dnf --assumeyes --refresh install --allowerasing $pkgs_common $pkgs_centos
;;
debian|ubuntu)
$SUDO apt-get --assume-yes update
Expand Down
21 changes: 15 additions & 6 deletions build-aux/install-reqs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ vim

pkgs_centos='
awscli
clang-tools-extra
clang
ctags
gcc-c++
platform-python-devel
python3-pip
vim-enhanced
'
Expand Down Expand Up @@ -77,15 +76,25 @@ case $ID in
;;
centos)
case $VERSION_ID in
7)
repo_pkgs=epel-release
enable_repos=
pkgs_centos="$pkgs_centos python3-devel"
$SUDO yum --assumeyes install dnf
;;
8)
extra_repos=powertools
repo_pkgs='epel-release epel-next-release'
enable_repos=powertools
pkgs_centos="$pkgs_centos clang-tools-extra platform-python-devel"
;;
9)
extra_repos=crb
repo_pkgs='epel-release epel-next-release'
enable_repos=crb
pkgs_centos="$pkgs_centos clang-tools-extra platform-python-devel"
;;
esac
$SUDO dnf --assumeyes config-manager --set-enabled $extra_repos
$SUDO dnf --assumeyes --refresh install epel-release epel-next-release
test "x$enable_repos" != x && $SUDO dnf --assumeyes config-manager --set-enabled $enable_repos
$SUDO dnf --assumeyes --refresh install $repo_pkgs
$SUDO dnf --assumeyes --refresh install --allowerasing $pkgs_common $pkgs_centos
;;
debian|ubuntu)
Expand Down
15 changes: 8 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ QH_REQUIRE_PROG([VIM], [vim vi], [path to vim])
QH_ARG_ENABLE([ycm], [yes])
AM_CONDITIONAL([ENABLE_YCM], [test "x$enable_ycm" = xyes])
AM_COND_IF([ENABLE_YCM],
[QH_REQUIRE_PROG([CLANGD], [clangd clangd-10], [path to clangd])
QH_REQUIRE_PROG([CMAKE], [cmake], [path to cmake])
[QH_REQUIRE_PROG([CMAKE], [cmake], [path to cmake])
QH_REQUIRE_PROG([GCXX], [g++], [path to g++])
EC_VIM_YCM_OWNER([VIM_YCM_OWNER], [GitHub owner for YouCompleteMe])
EC_VIM_YCM_REF([VIM_YCM_REF], [Git reference for YouCompleteMe])
Expand All @@ -345,13 +344,12 @@ AM_COND_IF([ENABLE_YCM],
VIMRC_YCM_FILE=/dev/null])
AC_SUBST_FILE([VIMRC_YCM_FILE])

# At present, all platforms that do not use the upstream ycm-core distribution
# of YouCompleteMe are cases where we need to use the system clangd binary.
# This approach will need to be revised if that changes in the future.
AM_CONDITIONAL([VIM_YCM_SYSTEM_CLANGD], [test "x$VIM_YCM_OWNER" != xycm-core])
AM_CONDITIONAL([VIM_YCM_SYSTEM_CLANGD],
[test "x$VIM_YCM_OWNER" = "xdetwiler" && test "x$VIM_YCM_REF" != "xvim-7.4.143"])
AM_COND_IF([ENABLE_YCM],
[AM_COND_IF([VIM_YCM_SYSTEM_CLANGD],
[YCM_CLANGD_BINARY_PATH_FILE=data/vim/ycm-clangd-binary-path
[QH_REQUIRE_PROG([CLANGD], [clangd clangd-10], [path to clangd])
YCM_CLANGD_BINARY_PATH_FILE=data/vim/ycm-clangd-binary-path
AC_CONFIG_FILES([data/vim/ycm-clangd-binary-path])],
[YCM_CLANGD_BINARY_PATH_FILE=/dev/null])
AC_SUBST_FILE([YCM_CLANGD_BINARY_PATH_FILE])
Expand All @@ -372,9 +370,12 @@ AM_COND_IF([ENABLE_VIM_CMAKE],
VIMRC_CMAKE_FILE=data/vim/vimrc-cmake],
[VIM_PLUG_CMAKE_FILE=/dev/null
VIMRC_CMAKE_FILE=/dev/null])
AC_SUBST_FILE([VIM_PLUG_CMAKE_FILE])
AC_SUBST_FILE([VIMRC_CMAKE_FILE])

# vim-plug requirements
QH_ARG_ENABLE([vim_plug_install], [yes])
AM_CONDITIONAL([ENABLE_VIM_PLUG_INSTALL], [test "x$enable_vim_plug_install" = xyes])
QH_REQUIRE_PROG([CURL], [curl], [path to curl])
AC_SUBST_FILE([VIM_PLUG_YCM_FILE])

Expand Down
2 changes: 1 addition & 1 deletion data/vim/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ vim-plug-uninstall:
$(AM_V_GEN)rm -rf $(DESTDIR)$(vimautoloaddir) && \
rm -rf $(DESTDIR)$(vimpluggeddir)

if ENABLE_YCM
if ENABLE_VIM_PLUG_INSTALL
install-data-hook: vim-plug-install
uninstall-hook: vim-plug-uninstall
endif
4 changes: 3 additions & 1 deletion data/vim/init.vim.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

set runtimepath^=@vimdir@
set runtimepath+=@vimdir@/after
set viminfofile=@vimdir@/viminfo
if has('viminfofile')
set viminfofile=@vimdir@/viminfo
endif
set directory^=@vimdir@/swap//
set backupdir^=@vimdir@/backup//
set undodir^=@vimdir@/undo//
4 changes: 3 additions & 1 deletion m4/envconf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ AS_VAR_SET_IF([$1],
AS_CASE([$ID],
[alpine], [AS_VAR_SET([$1], [detwiler])],
[centos], [AS_CASE([$VERSION_ID],
[8], [AS_VAR_SET([$1], [detwiler])],
[7|8], [AS_VAR_SET([$1], [detwiler])],
[AS_VAR_SET([$1], [ycm-core])])],
[ubuntu], [AS_CASE([$VERSION_ID],
[18.04], [AS_VAR_SET([$1], [detwiler])],
Expand Down Expand Up @@ -52,6 +52,7 @@ AS_VAR_SET_IF([$1],
[3.15*], [AS_VAR_SET([$1], [llvm-12])],
[AS_VAR_SET([$1], [master])])],
[centos], [AS_CASE([$VERSION_ID],
[7], [AS_VAR_SET([$1], [vim-7.4.143])],
[8], [AS_VAR_SET([$1], [vim-7.4.1578])],
[AS_VAR_SET([$1], [master])])],
[ubuntu], [AS_CASE([$VERSION_ID],
Expand Down Expand Up @@ -84,6 +85,7 @@ AS_VAR_SET_IF([$1],
[3.14*], [AS_VAR_SET([$1], [--clangd-completer])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[centos], [AS_CASE([$VERSION_ID],
[7], [AS_VAR_SET([$1], [--clang-completer])],
[8], [AS_VAR_SET([$1], [--clangd-completer])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[ubuntu], [AS_CASE([$VERSION_ID],
Expand Down

0 comments on commit 50217ee

Please sign in to comment.