From 39b7f8d9aae573403092951a83a08afe206a557b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 4 Dec 2008 09:06:22 -0600
Subject: update vi and add gvim

---
 abs/core-testing/vi/PKGBUILD            |  2 +-
 abs/extra-testing/gvim/PKGBUILD         | 83 +++++++++++++++++++++++++++++++++
 abs/extra-testing/gvim/fetch_patches.sh | 60 ++++++++++++++++++++++++
 abs/extra-testing/gvim/gvim.desktop     | 42 +++++++++++++++++
 abs/extra-testing/gvim/gvim.install     | 24 ++++++++++
 abs/extra-testing/vim/PKGBUILD          |  2 +-
 6 files changed, 211 insertions(+), 2 deletions(-)
 create mode 100644 abs/extra-testing/gvim/PKGBUILD
 create mode 100644 abs/extra-testing/gvim/fetch_patches.sh
 create mode 100644 abs/extra-testing/gvim/gvim.desktop
 create mode 100644 abs/extra-testing/gvim/gvim.install

diff --git a/abs/core-testing/vi/PKGBUILD b/abs/core-testing/vi/PKGBUILD
index 3bfc4db..5d6d984 100644
--- a/abs/core-testing/vi/PKGBUILD
+++ b/abs/core-testing/vi/PKGBUILD
@@ -3,7 +3,7 @@
 
 pkgname=vi
 _srcver=7.2
-_patchlevel=30
+_patchlevel=65
 pkgver=${_srcver}.${_patchlevel}
 pkgrel=1
 pkgdesc="a highly configurable, improved version of the vi text editor (basic version)"
diff --git a/abs/extra-testing/gvim/PKGBUILD b/abs/extra-testing/gvim/PKGBUILD
new file mode 100644
index 0000000..9e165bd
--- /dev/null
+++ b/abs/extra-testing/gvim/PKGBUILD
@@ -0,0 +1,83 @@
+# $Id: PKGBUILD 17439 2008-10-29 19:05:16Z tobias $
+# Maintainer: tobias [ tobias at archlinux org ]
+
+pkgname=gvim
+_srcver=7.2
+_patchlevel=65
+pkgver=${_srcver}.${_patchlevel}
+pkgrel=1
+pkgdesc="the vim text editor with advanced features enabled, such as a gui mode"
+arch=(i686 x86_64)
+license=('custom:vim')
+url="http://www.vim.org"
+depends=("vim>=${pkgver}" 'perl' 'python' 'acl' 'libxt' 'gtk2' )
+makedepends=('pkgconfig')
+backup=(etc/gvimrc)
+conflicts=('gvim-devel')
+provides=('gvim-devel')
+install=${pkgname}.install
+source=(ftp://ftp.vim.org/pub/vim/unix/vim-${_srcver}.tar.bz2 \
+        ftp://ftp.vim.org/pub/vim/extra/vim-${_srcver}-extra.tar.gz \
+        ftp://ftp.vim.org/pub/vim/extra/vim-${_srcver}-lang.tar.gz \
+        ${pkgname}.desktop fetch_patches.sh)
+md5sums=('f0901284b338e448bfd79ccca0041254' '35e04482f07c57221c9a751aaa3b8dac' \
+         'd8884786979e0e520c112faf2e176f05' '2be104c0372dd6dae19cb7968c03cd4f' \
+         'a3b03cd44b8ed78a99850d4cbfaafe55')
+
+build()
+{
+  # patch party
+  # pull in patches from vim.org (or the src cache alternatively)
+  . ${startdir}/src/fetch_patches.sh
+  get_patches || return 1
+  cd ${startdir}/src/vim$(echo ${_srcver} | sed "s/\.//")
+   # define the place for the global (g)vimrc file (set to /etc/vimrc)
+  sed -i 's|^.*\(#define SYS_.*VIMRC_FILE.*"\) .*$|\1|' src/feature.h
+  ./configure --prefix=/usr --localstatedir=/var/lib/vim --mandir=/usr/share/man \
+    --with-compiledby=ArchLinux --with-features=big \
+    --with-x=yes --disable-gpm --with-x=yes --enable-gui=gtk2 \
+    --with-global-runtime=/usr/share/vim --with-vim-name=gvim \
+    --enable-multibyte --enable-cscope \
+    --enable-perlinterp --enable-pythoninterp 
+  make || return 1
+  # install everything first ...
+  make VIMRCLOC=/etc DESTDIR=${startdir}/pkg VIMRTDIR= install
+
+   # ... and clean up what vim already has for us
+   # move the binary and fix the (g)* related symlinks
+  find ${startdir}/pkg/usr/bin -type l 2> /dev/null | while read symlink; do
+    rm ${symlink}
+  done
+  cd ${startdir}/pkg/usr/bin
+  rm -f gvimtutor xxd
+  ln -s gvim evim
+  ln -s gvim egview
+  ln -s gvim gview
+  ln -s gvim gvimdiff
+  ln -s gvim rgview
+  ln -s gvim rgvim
+
+   # delete the manpages/symlinks provided by vi package
+  find ${startdir}/pkg/usr/share/man -type d -name 'man1' 2> /dev/null | \
+   while read mandir; do
+    cd ${mandir}
+    rm -f *.1
+    ln -s evi.1.gz evim.1.gz
+    ln -s vi.1.gz egview.1.gz
+    ln -s vi.1.gz gview.1.gz
+    ln -s vi.1.gz gvim.1.gz
+    ln -s vimdiff.1.gz gvimdiff.1.gz
+    ln -s vi.1.gz rgvim.1.gz
+    ln -s vi.1.gz rgview.1.gz
+  done
+
+  install -Dm644 ${startdir}/pkg/usr/share/vim/gvimrc_example.vim \
+    ${startdir}/pkg/etc/gvimrc
+   # clean all settings and controls -  served by vi package
+  rm -rf ${startdir}/pkg/usr/share/vim
+   # freedesktop links
+  install -D -m644 ${startdir}/src/${pkgname}.desktop \
+    ${startdir}/pkg/usr/share/applications/gvim.desktop
+  install -D -m644 ${startdir}/src/vim$(echo ${_srcver} | sed "s/\.//")/runtime/vim48x48.png \
+    ${startdir}/pkg/usr/share/pixmaps/gvim.png
+}
diff --git a/abs/extra-testing/gvim/fetch_patches.sh b/abs/extra-testing/gvim/fetch_patches.sh
new file mode 100644
index 0000000..03e16e2
--- /dev/null
+++ b/abs/extra-testing/gvim/fetch_patches.sh
@@ -0,0 +1,60 @@
+# the external logic for pulling in patches
+
+get_patches() {
+  _patchdir=${startdir}/src/patches
+  cd ${startdir}/src/vim$(echo ${_srcver} | sed "s/\.//")
+  if [ -d ${_patchdir} ]; then
+    rm -rf ${_patchdir}
+    echo -e "\tremove patches from old build"
+  fi
+  mkdir ${_patchdir} && cd ${_patchdir}
+  _rpath=ftp://ftp.vim.org/pub/vim/patches/${_srcver}
+
+  # change IFS to loop line-by-line
+  _OLDIFS=$IFS
+  IFS="
+"
+  echo -e "\tfetching checksumfile for patches"
+  wget ${_rpath}/MD5SUMS >/dev/null 2>&1
+
+  downloads=0
+  for _line in $(/bin/cat MD5SUMS); do
+    downloads=$((${downloads} + 1))
+    _md5=$(echo $_line | cut -d ' ' -f1)
+    _file=$(echo $_line | cut -d ' ' -f3)
+    if [ -f ${SRCDEST}/vim-${_srcver}/${_file} ]; then
+      echo -e "\thaving patch file:${_file}"
+      cp ${SRCDEST}/vim-${_srcver}/${_file} ./
+    else
+      echo -n -e "\t... fetching patch file: ${_file} ..."
+      wget ${_rpath}/${_file} >/dev/null 2>&1
+      if [ -w ${SRCDEST} ]; then
+        if [ ! -d ${SRCDEST}/vim-${_srcver} ]; then
+          mkdir -p ${SRCDEST}/vim-${_srcver}
+        fi
+        cp ${_file} ${SRCDEST}/vim-${_srcver}/
+        echo " done!"
+      fi
+    fi
+
+    if [ $(echo "${_md5}  ${_file}" | md5sum --status -c -) ]; then
+      echo ${_file} md5sums do not match
+      return 1
+    fi
+  done
+
+  ########
+
+  if [ ${downloads} != ${_patchlevel} ]; then
+    echo -e "Number of patches does not match the patchlevel!\nEdit the PKGBUILD accordingly!"
+    return 1
+  fi
+  IFS=$_OLDIFS
+  rm MD5SUMS
+  cd ${startdir}/src/vim$(echo ${_srcver} | sed "s/\.//")
+  for _patch in $(/bin/ls ${_patchdir}); do
+    patch -Np0 -i ${_patchdir}/${_patch} || return 1
+  done
+  rm -rf ${_patchdir}
+  return 0
+}
diff --git a/abs/extra-testing/gvim/gvim.desktop b/abs/extra-testing/gvim/gvim.desktop
new file mode 100644
index 0000000..8c99660
--- /dev/null
+++ b/abs/extra-testing/gvim/gvim.desktop
@@ -0,0 +1,42 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Name=gVim
+Name[eo]=VIM-fasado
+Name[sv]=gVim
+Name[xx]=xx
+Comment=GTK2 enhanced vim text editor
+Comment[ar]=محرر نصوص
+Comment[bg]=Текст Редактор
+Comment[de]=Texteditor
+Comment[el]=Διορθωτής Κειμένου
+Comment[eo]=Tekstredaktilo
+Comment[et]=Tekstiredaktor
+Comment[eu]=Testu Editorea
+Comment[fi]=Tekstieditori
+Comment[he]=עורך טקסט
+Comment[is]=Textaritill
+Comment[ja]=テキストエディタ
+Comment[lt]=Teksto redaktorius
+Comment[mt]=Editur tat-test
+Comment[pt_BR]=Editor de Texto
+Comment[ro]=Editor de text
+Comment[ru]=редактор
+Comment[sk]=Textový editor
+Comment[sl]=Urejevalnik besedil
+Comment[ta]=¯¨Ã ¦¾¡ÌôÀ¡Ç÷
+Comment[tr]=Metin Düzenleyici
+Comment[uk]=Редактор текстів
+Comment[vi]=Trình soạn văn bản
+Comment[xx]=xx
+Comment[zh_CN]=文本编辑器
+Comment[zh_TW]=文字編輯器
+GenericName=Text Editor
+Type=Application
+TryExec=gvim
+Exec=gvim
+Icon=gvim
+Terminal=false
+X-MultipleArgs=false
+Categories=GTK;Application;Utility;TextEditor;
+MimeType=application/mathml+xml;application/xhtml+xml;application/x-perl;application/x-python;application/x-shellscript;audio/x-mpegurl;audio/x-scpls;image/svg+xml;message/news;message/rfc822;text/calendar;text/css;text/english;text/html;text/mrml;text/plain;text/rdf;text/rss;text/rtf;text/sgml;text/vnd.wap.wml;text/x-adasrc;text/x-bibtex;text/x-chdr;text/x-c++hdr;text/x-csrc;text/x-c++src;text/x-c;text/x-objc;text/x-csv;text/x-diff;text/x-java;text/x-katefilelist;text/x-latex;text/x-log;text/x-lyx;text/x-makefile;text/xmcd;text/xml;text/x-moc;text/x-mswinurl;text/x-objcsrc;text/x-pascal;text/x-perl;text/x-php;text/x-php-source;text/x-python;text/x-tcl;text/x-tex;text/x-vcalendar;text/x-vcard;text/x-xslfo;text/x-xslt;
diff --git a/abs/extra-testing/gvim/gvim.install b/abs/extra-testing/gvim/gvim.install
new file mode 100644
index 0000000..f49c345
--- /dev/null
+++ b/abs/extra-testing/gvim/gvim.install
@@ -0,0 +1,24 @@
+post_install() {
+  echo "Updating desktop and mime database..."
+  update-desktop-database -q
+  echo -n "Updating vim help tags..."
+  usr/bin/vim --noplugins -u NONE -U NONE \
+    --cmd ":helptags usr/share/vim/doc" --cmd ":q" > /dev/null 2>&1
+  echo "done."
+}
+
+post_upgrade() {
+  post_install $1
+}
+
+post_remove() {
+  echo -n "Updating desktop and mime database..."
+  update-desktop-database
+  echo "done."
+}
+
+op=$1
+shift
+[ "$(type -t "$op")" = "function" ] && $op "$@"
+
+# vim:set ts=2 sw=2 et ft=sh:
diff --git a/abs/extra-testing/vim/PKGBUILD b/abs/extra-testing/vim/PKGBUILD
index b54c9ba..d0355fc 100644
--- a/abs/extra-testing/vim/PKGBUILD
+++ b/abs/extra-testing/vim/PKGBUILD
@@ -3,7 +3,7 @@
 
 pkgname=vim
 _srcver=7.2
-_patchlevel=30
+_patchlevel=65
 pkgver=${_srcver}.${_patchlevel}
 pkgrel=1.5
 pkgdesc="a highly configurable, improved version of the vi text editor"
-- 
cgit v0.12