summaryrefslogtreecommitdiff
path: root/pcr/eclim/PKGBUILD
blob: 158704ad1c4d77ea7264dd6f84bddc01b8be5f10 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Maintainer (AUR): Jingbei Li <i@jingbei.li>
# Contributor (AUR): Andrea Fagiani <andfagiani_at_gmail_dot_com>
# Contributor (AUR): solarus <in01-archlinux at tunna.org>
# Maintainer: Aurélien DESBRIÈRES <aurelien@hackers.camp>

pkgname=eclim
pkgver=2.8.0
pkgrel=3
pkgdesc="Brings Eclipse functionality to Vim"
url="http://eclim.org/"
license=('GPL3')
arch=(i686 x86_64)
makedepends=('apache-ant' 'eclipse' 'groovy' 'java-environment=10' 'libnsl' 'python2-sphinx' 'python2-docutils' 'vim')
optdepends=('eclipse-dltk-core')
conflicts=('eclim-git')
install=$pkgname.install
source=("https://github.com/ervandew/eclim/releases/download/$pkgver/${pkgname}_$pkgver.tar.gz")
md5sums=('aae873ee270d6c7b21a6ff3bec3f08ad')

prepare() {
  cd $srcdir/${pkgname}_$pkgver

  # fix build, thanks to mikezackles
  sed -e "s/'sphinx-build'/'sphinx-build2'/g" \
    -e 's|${user.home}/\.|${vim.files}/|g' \
    -e "s|File(getVariable('eclipse')|File('/usr/lib/eclipse/'|g" \
    -e '68,88d' \
    -i ant/build.gant

  export ANT_HOME=/usr/share/ant
  export PATH=$PATH:$ANT_HOME/bin
  export JAVA_HOME=/usr/lib/jvm/java-10-openjdk
  export ANT_OPTS="--add-modules java.xml.bind"

  chmod +x org.eclim/nailgun/configure bin/sphinx

  # Sphinx 1.6 => 1.7 compatibility issue
  sed 's|sphinx.util.compat|docutils.parsers.rst|' -i doc/extension/plantuml.py

  # ant/build.gant syntax error
  sed '68,71d' -i ant/build.gant

  # https://github.com/ervandew/eclim/issues/601
  find -name "*.java" -exec sed -i -e 's/StubUtility2/StubUtility2Core/' \
    -e 's/corext.codemanipulation.StubUtility;/core.manipulation.StubUtility;/' {} +
}

build() {
  cd $srcdir/${pkgname}_$pkgver

  # recompiling nailgun to make sure the executable is compliant with our architecture
  cd org.eclim/nailgun
  ./configure
  make

  cd ../..

  ant -lib /usr/share/groovy/lib \
      -Declipse.home=/usr/lib/eclipse \
      -Dvim.files=/usr/share/vim/vimfiles \
      -Dfile.encoding=utf-8 \
      build
}

package() {
  depends=('eclipse' 'java-environment' 'libnsl' 'vim')

  cd $srcdir/${pkgname}_$pkgver

  mkdir -p $pkgdir/usr/lib/eclipse
  mkdir -p $pkgdir/usr/share/vim/vimfiles

  ant -lib /usr/share/groovy/lib \
      -Declipse.home=/usr/lib/eclipse \
      -Dvim.files=$pkgdir/usr/share/vim/vimfiles \
      docs vimdocs

  ant -lib /usr/share/groovy/lib \
      -Declipse.home=$pkgdir/usr/lib/eclipse \
      -Dvim.files=$pkgdir/usr/share/vim/vimfiles \
      deploy

  # copy eclim docs
  mkdir -p $pkgdir/usr/share/doc/
  cp -r build/doc/site $pkgdir/usr/share/doc/eclim

  # fix eclim paths
  sed -e "s|$pkgdir||g" \
    -i $pkgdir/usr/share/vim/vimfiles/eclim/plugin/eclim.vim \
    -i $pkgdir/usr/lib/eclipse/plugins/org.eclim_$pkgver/bin/eclimd \
    -i $pkgdir/usr/lib/eclipse/plugins/org.eclim_$pkgver/plugin.properties

  # delete doctrees
  rm -fr $pkgdir/usr/share/doc/eclim/.doctrees

  # delete Windows stuff
  for i in $(find $pkgdir -regex ".*bat\|.*cmd\|.*exe"); do  rm -f $i ; done

  rm $pkgdir/usr/lib/eclipse/plugins/org.eclim_${pkgver}/nailgun/config.status
}