Blob Blame History Raw
%global eclipse_base     %{_libdir}/eclipse
%global eclipse_dropin   %{_datadir}/eclipse/dropins

# Note: Use the tag in get-mdt-ocl.sh as the context qualifier because it's
#       later than the tags of the individual plugins.
%global contextQualifier v200906151742

Name:      eclipse-mdt-ocl
Version:   1.3.0
Release:   2%{?dist}
Summary:   Implementation of the OCL OMG metamodel for Eclipse
Group:     System Environment/Libraries
License:   EPL
URL:       http://www.eclipse.org/modeling/mdt/ocl

# source tarball and the script used to generate it from upstream's source control
# script usage:
# $ sh get-mdt-ocl.sh
Source0:   mdt-ocl-%{version}.tar.gz
Source1:   get-mdt-ocl.sh

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:        noarch

BuildRequires:    java-devel
BuildRequires:    jpackage-utils
BuildRequires:    eclipse-pde >= 1:3.5.0
BuildRequires:    eclipse-emf >= 2.5.0
BuildRequires:    eclipse-mdt-uml2 >= 3.0.0
BuildRequires:    lpg-java-compat = 1.1.0
Requires:         java
Requires:         jpackage-utils
Requires:         eclipse-platform >= 1:3.5.0
Requires:         eclipse-emf >= 2.5.0
Requires:         eclipse-mdt-uml2 >= 3.0.0
Requires:         lpg-java-compat = 1.1.0

%description
OCL is an implementation of the Object Constraint Language (OCL) OMG standard
for EMF-based models. The objectives of the OCL component are to provide APIs
for parsing and evaluating OCL constraints and queries on EMF models, an Ecore
implementation of the OCL abstract syntax model, including support for
serialization of parsed OCL expressions, a Visitor API for analyzing/
transforming the AST model of OCL expressions and an extensibility API for
clients to customize the parsing and evaluation environments used by the
parser.

#TODO - sdk/examples subpackages?

%prep
%setup -q -n mdt-ocl-%{version}

# make sure upstream hasn't sneaked in any jars we don't know about
JARS=""
for j in `find -name "*.jar"`; do
  if [ ! -L $j ]; then
    JARS="$JARS $j"
  fi
done
if [ ! -z "$JARS" ]; then
   echo "These jars should be deleted and symlinked to system jars: $JARS"
   exit 1
fi

mkdir orbitDeps
pushd orbitDeps
ln -s $(build-classpath lpgjavaruntime) net.sourceforge.lpg.lpgjavaruntime_1.1.0.jar
popd

# remove spurious exec permissions from docs
find -wholename "*/rootfiles/*" | xargs chmod -x

%build
# build mdt-ocl features
%{eclipse_base}/buildscripts/pdebuild -f org.eclipse.ocl \
  -d "emf uml2" -o `pwd`/orbitDeps -a "-DforceContextQualifier=%{contextQualifier}"
%{eclipse_base}/buildscripts/pdebuild -f org.eclipse.ocl.uml \
  -d "emf uml2" -o `pwd`/orbitDeps -a "-DforceContextQualifier=%{contextQualifier}"
%{eclipse_base}/buildscripts/pdebuild -f org.eclipse.emf.ocl \
  -d "emf uml2" -o `pwd`/orbitDeps -a "-DforceContextQualifier=%{contextQualifier}"

%install
rm -rf %{buildroot}
install -d -m 755 %{buildroot}%{eclipse_dropin}
unzip -q -n -d %{buildroot}%{eclipse_dropin}/mdt-ocl build/rpmBuild/org.eclipse.ocl.zip
unzip -q -n -d %{buildroot}%{eclipse_dropin}/mdt-ocl build/rpmBuild/org.eclipse.ocl.uml.zip
unzip -q -n -d %{buildroot}%{eclipse_dropin}/mdt-ocl build/rpmBuild/org.eclipse.emf.ocl.zip

# use system bundles
pushd %{buildroot}%{eclipse_dropin}/mdt-ocl/eclipse/plugins
rm net.sourceforge.lpg.lpgjavaruntime_*.jar
ln -s ../../../../../../..$(build-classpath lpgjavaruntime) \
  net.sourceforge.lpg.lpgjavaruntime_1.1.0.jar
popd

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{eclipse_dropin}/mdt-ocl
%doc org.eclipse.ocl-feature/rootfiles/*

%changelog
* Sun Nov 22 2009 Mat Booth <fedora@matbooth.co.uk> 1.3.0-2
- Use build-classpath when symlinking to dependent bundles.
- Don't pretty-print the package description.

* Tue Nov 8 2009 Mat Booth <fedora@matbooth.co.uk> 1.3.0-1
- New OCL spec file based on eclipse-gef.