diff --git a/x11-packages/vim-gtk/build.sh b/x11-packages/vim-gtk/build.sh new file mode 100644 index 000000000..c94b5f79e --- /dev/null +++ b/x11-packages/vim-gtk/build.sh @@ -0,0 +1,68 @@ +TERMUX_PKG_HOMEPAGE=https://www.vim.org +TERMUX_PKG_DESCRIPTION="Vi IMproved - enhanced vi editor" +TERMUX_PKG_LICENSE="VIM License" + +# vim should only be updated every 50 releases on multiples of 50. +TERMUX_PKG_VERSION=8.1.1350 +TERMUX_PKG_SRCURL=https://github.com/vim/vim/archive/v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=4a398e3914a8f822a489857e60c905d4593003a982e2b2655d1f893e0124c0ab +TERMUX_PKG_DEPENDS="gtk3, libice, libiconv, libsm, ncurses, python" +TERMUX_PKG_CONFLICTS="vim, vim-python, vim-runtime" +TERMUX_PKG_BUILD_IN_SRC="yes" + +# Basic. +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +vim_cv_getcwd_broken=no +vim_cv_memmove_handles_overlap=yes +vim_cv_stat_ignores_slash=no +vim_cv_terminfo=yes +vim_cv_tgetent=zero +vim_cv_toupper_broken=no +vim_cv_tty_group=world +--enable-gui=gtk3 +--enable-multibyte +--with-features=huge +--with-tlib=ncursesw +--enable-cscope +" + +# Python support. +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" +vi_cv_path_python3_pfx=$TERMUX_PREFIX +vi_cv_var_python3_version=3.7 +--enable-python3interp +--with-python3-config-dir=$TERMUX_PREFIX/lib/python3.7/config-3.7m/ +" + +TERMUX_PKG_RM_AFTER_INSTALL=" +share/man/man1/evim.1 +share/vim/vim81/spell/en.ascii* +share/vim/vim81/print +share/vim/vim81/tools +" + +TERMUX_PKG_CONFFILES="share/vim/vimrc" + +termux_step_pre_configure() { + CPPFLAGS+=" -I${TERMUX_PREFIX}/include/python3.7m" +} + +termux_step_pre_configure() { + make distclean + + # Remove eventually existing symlinks from previous builds so that they get re-created + for b in rview rvim ex view vimdiff; do rm -f $TERMUX_PREFIX/bin/$b; done + rm -f $TERMUX_PREFIX/share/man/man1/view.1 +} + +termux_step_post_make_install() { + cp $TERMUX_PKG_BUILDER_DIR/vimrc $TERMUX_PREFIX/share/vim/vimrc + + # Remove most tutor files: + cp $TERMUX_PREFIX/share/vim/vim81/tutor/{tutor,tutor.vim,tutor.utf-8} $TERMUX_PKG_TMPDIR/ + rm -f $TERMUX_PREFIX/share/vim/vim81/tutor/* + cp $TERMUX_PKG_TMPDIR/{tutor,tutor.vim,tutor.utf-8} $TERMUX_PREFIX/share/vim/vim81/tutor/ + + cd $TERMUX_PREFIX/bin + ln -f -s vim vi +} diff --git a/x11-packages/vim-gtk/option.c.patch b/x11-packages/vim-gtk/option.c.patch new file mode 100644 index 000000000..0bd3e3ffc --- /dev/null +++ b/x11-packages/vim-gtk/option.c.patch @@ -0,0 +1,12 @@ +diff -u -r ../vim-8.0.1750/src/option.c ./src/option.c +--- ../vim-8.0.1750/src/option.c 2018-04-23 21:29:48.000000000 +0200 ++++ ./src/option.c 2018-04-26 22:18:46.227593576 +0200 +@@ -3413,7 +3413,7 @@ + # ifdef MACOS_X + p = (char_u *)"/private/tmp"; + # else +- p = (char_u *)"/tmp"; ++ p = (char_u *)"@TERMUX_PREFIX@/tmp"; + # endif + else + # endif diff --git a/x11-packages/vim-gtk/os_unix.h.patch b/x11-packages/vim-gtk/os_unix.h.patch new file mode 100644 index 000000000..e0576a7bd --- /dev/null +++ b/x11-packages/vim-gtk/os_unix.h.patch @@ -0,0 +1,12 @@ +diff -u -r ../vim-7.4.1049/src/os_unix.h ./src/os_unix.h +--- ../vim-7.4.1049/src/os_unix.h 2016-01-04 06:45:29.000000000 -0500 ++++ ./src/os_unix.h 2016-01-04 11:23:21.698790120 -0500 +@@ -368,7 +368,7 @@ + # ifdef VMS + # define DFLT_DIR "./,sys$login:,tmp:" + # else +-# define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" /* default for 'directory' */ ++# define DFLT_DIR ".,~/tmp,@TERMUX_PREFIX@/var/tmp,@TERMUX_PREFIX@/tmp" /* default for 'directory' */ + # endif + #endif + diff --git a/x11-packages/vim-gtk/src-auto-configure.patch b/x11-packages/vim-gtk/src-auto-configure.patch new file mode 100644 index 000000000..da7a75912 --- /dev/null +++ b/x11-packages/vim-gtk/src-auto-configure.patch @@ -0,0 +1,11 @@ +diff -u -r ../vim-8.0.0675/src/auto/configure ./src/auto/configure +--- ../vim-8.0.0675/src/auto/configure 2017-06-25 16:03:37.000000000 +0000 ++++ ./src/auto/configure 2017-07-07 12:34:53.459850309 +0000 +@@ -11426,6 +11426,7 @@ + $as_echo_n "checking for tgetent()... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ ++#include + + int + main () diff --git a/x11-packages/vim-gtk/src-if_cscope.c.patch b/x11-packages/vim-gtk/src-if_cscope.c.patch new file mode 100644 index 000000000..375ae96f2 --- /dev/null +++ b/x11-packages/vim-gtk/src-if_cscope.c.patch @@ -0,0 +1,12 @@ +diff -uNr vim-8.1.0050/src/if_cscope.c vim-8.1.0050.mod/src/if_cscope.c +--- vim-8.1.0050/src/if_cscope.c 2018-06-12 21:25:52.000000000 +0300 ++++ vim-8.1.0050.mod/src/if_cscope.c 2018-06-19 20:32:38.661663690 +0300 +@@ -962,7 +962,7 @@ + PERROR(_("cs_create_connection setpgid failed")); + # endif + # endif +- if (execl("/bin/sh", "sh", "-c", cmd, (char *)NULL) == -1) ++ if (execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", cmd, (char *)NULL) == -1) + PERROR(_("cs_create_connection exec failed")); + + exit(127); diff --git a/x11-packages/vim-gtk/vimrc b/x11-packages/vim-gtk/vimrc new file mode 100644 index 000000000..9ffc57c51 --- /dev/null +++ b/x11-packages/vim-gtk/vimrc @@ -0,0 +1,108 @@ +" Ensure that <> notation works for the mappings that follow +set nocompatible + +" Scroll only one line for mouse wheel events to get smooth scrolling on touch screens +map +imap +map +imap + +" As of version 8, vim enables the mouse by default - but only if no ~/.vimrc +" is found. Enable that unconditionally for Termux as it's useful with touch: +set mouse=a + +" sensible.vim - Defaults everyone can agree on +" Maintainer: Tim Pope +" Version: 1.2 + +if exists('g:loaded_sensible') || &compatible + finish +else + let g:loaded_sensible = 'yes' +endif + +if has('autocmd') + filetype plugin indent on +endif +if has('syntax') && !exists('g:syntax_on') + syntax enable +endif + +" Use :help 'option' to see the documentation for the given option. + +set autoindent +set backspace=indent,eol,start +set complete-=i +set smarttab + +set nrformats-=octal + +if !has('nvim') && &ttimeoutlen == -1 + set ttimeout + set ttimeoutlen=100 +endif + +set incsearch +" Use to clear the highlighting of :set hlsearch. +if maparg('', 'n') ==# '' + nnoremap :nohlsearch=has('diff')?'diffupdate':'' +endif + +set laststatus=2 +set ruler +set wildmenu + +if !&scrolloff + set scrolloff=1 +endif +if !&sidescrolloff + set sidescrolloff=5 +endif +set display+=lastline + +if &encoding ==# 'latin1' && has('gui_running') + set encoding=utf-8 +endif + +if &listchars ==# 'eol:$' + set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ +endif + +if v:version > 703 || v:version == 703 && has("patch541") + set formatoptions+=j " Delete comment character when joining commented lines +endif + +if has('path_extra') + setglobal tags-=./tags tags-=./tags; tags^=./tags; +endif + +if &shell =~# 'fish$' && (v:version < 704 || v:version == 704 && !has('patch276')) + set shell=/data/data/com.termux/files/usr/bin/env\ bash +endif + +set autoread + +if &history < 1000 + set history=1000 +endif +if &tabpagemax < 50 + set tabpagemax=50 +endif +if !empty(&viminfo) + set viminfo^=! +endif +set sessionoptions-=options + +" Allow color schemes to do bright colors without forcing bold. +if &t_Co == 8 && $TERM !~# '^linux\|^Eterm' + set t_Co=16 +endif + +" Load matchit.vim, but only if the user hasn't installed a newer version. +if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' + runtime! macros/matchit.vim +endif + +inoremap u + +" vim:set ft=vim et sw=2: diff --git a/x11-packages/vim-gtk/vimtutor.patch b/x11-packages/vim-gtk/vimtutor.patch new file mode 100644 index 000000000..67577a66e --- /dev/null +++ b/x11-packages/vim-gtk/vimtutor.patch @@ -0,0 +1,12 @@ +diff -u -r ../cache/vim-hg/src/vimtutor ./src/vimtutor +--- ../cache/vim-hg/src/vimtutor 2014-05-30 17:16:01.677978089 +0200 ++++ ./src/vimtutor 2014-06-15 23:36:24.545163147 +0200 +@@ -24,7 +24,7 @@ + export xx + + # We need a temp file for the copy. First try using a standard command. +-tmp="${TMPDIR-/tmp}" ++tmp="${TMPDIR-@TERMUX_PREFIX@/tmp}" + TUTORCOPY=`mktemp $tmp/tutorXXXXXX || tempfile -p tutor || echo none` + + # If the standard commands failed then create a directory to put the copy in. diff --git a/x11-packages/vim-gtk/vterm_internal.h.patch b/x11-packages/vim-gtk/vterm_internal.h.patch new file mode 100644 index 000000000..b4b21c110 --- /dev/null +++ b/x11-packages/vim-gtk/vterm_internal.h.patch @@ -0,0 +1,11 @@ +--- ../cache/vim-8.0.0979/src/libvterm/src/vterm_internal.h 2017-08-20 18:21:23.000000000 +0000 ++++ ./src/libvterm/src/vterm_internal.h 2017-08-21 03:25:48.637450794 +0000 +@@ -1,7 +1,7 @@ + #ifndef __VTERM_INTERNAL_H__ + #define __VTERM_INTERNAL_H__ + +-#include "vterm.h" ++#include "../include/vterm.h" + + #include +