File jcip-annotations.spec of Package jcip-annotations

#
# spec file for package jcip-annotations (Version 1.0)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define section   free

Name:           jcip-annotations
Version:        1.0
Release:        1
Summary:        Java Concurrency in Practice
License:        Creative Commons Attribution License
Group:          Development/Libraries/Java
Url:            http://www.jcip.net/
Source0:        http://www.jcip.net/jcip-annotations-src.jar
Source1:        http://repo1.maven.org/maven/livetribe/maven/m2/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.pom

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

BuildRequires:  jpackage-utils >= 1.7.5
BuildRequires:  java-devel = 1.5.0

Requires:       java >= 1.5.0
Requires(post):    jpackage-utils >= 1.7.4
Requires(postun):  jpackage-utils >= 1.7.4

%description
Class, field, and method level annotations for describing thread-safety
policies.

%package javadoc
License:        Creative Commons Attribution License
Summary:        Javadoc for %{name}
Group:          Development/Documentation

%description javadoc
Class, field, and method level annotations for describing thread-safety
policies.


%prep
%setup -q -c
mkdir -p target/site/apidocs/
mkdir -p target/classes/
mkdir -p src/main/java/
mv net src/main/java

%build
export JAVA_HOME=%{_jvmdir}/java-1.5.0

export JFLAGS=
%if %defined suse_version
export JFLAGS=-C
%endif

$JAVA_HOME/bin/javac ${JFLAGS} -d target/classes $(find src/main/java -name "*.java")
$JAVA_HOME/bin/javadoc -d target/site/apidocs -sourcepath src/main/java net.jcip.annotations
for f in $(find aQute/ -type f -not -name "*.class"); do
    cp $f target/classes/$f
done
pushd target/classes
$JAVA_HOME/bin/jar cmf ../../META-INF/MANIFEST.MF ../%{name}-%{version}.jar *
popd

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 target/%{name}-%{version}.jar \
  $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
%add_to_maven_depmap net.jcip jcip-annotations %{version} JPP %{name}
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)

# pom
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-%{name}.pom

# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink

%clean
rm -rf $RPM_BUILD_ROOT

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(-,root,root,-)
%{_javadir}/*
%{_datadir}/maven2
%config %{_mavendepmapfragdir}

%files javadoc
%defattr(-,root,root,-)
%doc %{_javadocdir}/%{name}-%{version}
%doc %{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by