summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 95b2bc42ae9aacc7d4b2ecd484a54e5125e8c83f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Maintainer: dracorp aka Piotr Rogoza <piotr.r.public@gmail.com>

pkgname=vim-vjde
pkgver=2.6.18
_scriptid=17026
pkgrel=6
pkgdesc='Just a Development Environment for VIM'
arch=('i686' 'x86_64')
url='http://www.vim.org/scripts/script.php?script_id=1213'
license=('GPL')
groups=('vim-plugins')
depends=(
vim-runtime
java-environment
)
optdepends=(
'ctags: to replace readtags'
'jdk: to install java-runtime and java-environment'
'jre: to install java-runtime'
)
install='vimdoc.install'
source=("$pkgname-$pkgver.tgz::http://www.vim.org/scripts/download_script.php?src_id=${_scriptid}")
sha256sums=('fa6169dfff44ce68e96b45b2a495177ae8c9913757d20e69a16e520cdf4b6930')
_fix_files() {
  local orig_file=$1
  if [ ! -w "$orig_file" -o ! -s "$orig_file" ]; then
    return
  fi

  # remove 'carriage return'
  sed -e 's/\r//g' -i $orig_file

  # change encoding
  iconv -c -f gbk -t utf8 $orig_file > ${orig_file}.fix && \
    mv ${orig_file}.fix ${orig_file} || return 1
}
export -f _fix_files
package() {
  _vim_dir='/usr/share/vim/vimfiles'

  # compile readtags
  cd "$srcdir"/src
  gcc -o ../plugin/vjde/readtags -DREADTAGS_MAIN readtags.c

  cd "$srcdir"
#  rm -rf "$srcdir"/src
  find $srcdir \( -iname '*.exe' -o -iname '*.dll' \) -exec rm -f '{}' ';'

  # install files
  install -dm755 "$pkgdir"/${_vim_dir}
  install -dm755 "$pkgdir"/usr/bin

  tar -c ./  \
    --exclude $pkgname-$pkgver.tgz \
    --exclude src \
    | tar -xC "$pkgdir"/${_vim_dir}

  mv "$pkgdir"/${_vim_dir}/plugin/vjde/readtags \
    ${pkgdir}/usr/bin
  ln -s /usr/bin/readtags \
    "$pkgdir"/${_vim_dir}/plugin/vjde

  # fixing files
  find "$pkgdir"/${_vim_dir} -type f -a ! -name '*.class' -a ! -name '*.jar' -exec bash -c '_fix_files {}' ';'
}