Eclipse plugin package guidelines

From ArchWiki
Revision as of 11:41, 24 June 2009 by Bardo (Talk | contribs) (created, some content)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

There are many ways to install working Eclipse plugins, especially since the introduction of the dropins directory in Eclipse 3.4, but some or them are messy, and having a standardized and consistent way of packaging is very important to lead to a clean system structure. It's not easy, however, to achieve this without the packager knowing every detail about how Eclipse plugins work. This page aims to define a standard and simple structure for Eclipse plugin PKGBUILDs, so that the filesystem structure can remain consistent between all plugins without having the packager to start again for every new package.

Eclipse plugin structure and installation

The typical Eclipse plugin contains two directories, features and plugins, and since Eclipse 3.3 they could only be placed in ""/usr/share/eclipse/"". The content of these two directories could be mixed with that of other plugins, but it created a mess and rendered the structure difficult to manage. It was also very difficult to tell at a glance which package contained which file.

This installation method is still supported in Eclipse 3.4, but the preferred one is now using the /usr/share/eclipse/dropins/ directory. Inside this directory can live an unlimited number of subdirectories, each one containing its own features and plugins subdirectories. This allows to keep a tidy and clean structure, and should be the standard packaging way.

Packaging

Sample PKGBUILD

pkgname=eclipse-mylyn
pkgver=3.0.3
pkgrel=1
pkgdesc="A task-focused interface for Eclipse"
arch=('i686' 'x86_64')
url="http://www.eclipse.org/mylyn/"
license=('EPL')
depends=('eclipse')
optdepends=('bugzilla: ticketing support')
source=(http://download.eclipse.org/tools/mylyn/update/mylyn-${pkgver}-e3.4.zip)
md5sums=('e98cd7ab3c5d5aeb7c32845844f85c22')

build() {
  _dest=${pkgdir}/usr/share/eclipse/dropins/${pkgname/eclipse-}/eclipse

  cd ${srcdir}

  # Features
  find features -type f -name *.jar | while read _feature ; do
    if [[ ${_feature} =~ (.*\.jar$) ]] ; then
      install -dm755 ${_dest}/${_feature%*.jar}
      cd ${_dest}/${_feature/.jar}
      jar xf ${srcdir}/${_feature} || return 1
    else
      install -Dm644 ${_feature} ${_dest}/${_feature}
    fi
  done

  # Plugins
  find plugins -type f | while read _plugin ; do
    install -Dm644 ${_plugin} ${_dest}/${_plugin}
  done
}