File cmion-main.spec of Package cmion-main

Name:           cmion-main
Version:        0.0.201309221742
Release:        1
Summary:        cmion (main)
License:        GPL
Source:         %{name}-%{version}.tar.gz
BuildRequires:  ant
BuildRequires:  xmlenc ion-meta ion-core ion-sync-collections
Group:          Development/Languages/Java
Vendor:         INESC ID Lisboa
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Requires:  	xmlenc ion-meta ion-core ion-sync-collections

cmion (main)

%package        javadoc
Summary:        Javadoc for %{name}
Group:          Development/Languages/Java
Requires(post): %{__rm}
Requires(post): /bin/ln
Requires(postun): %{__rm}

%description    javadoc
Javadoc for %{name}.

%package  lirec
License:        GPL-3.0
Group:          Productivity/Scientific/Other
Summary:        cmion-main-lirec

%description lirec
cmion-main-lirec (level 2 and 3) 


# remove all the stuff we'll build ourselves
find . \( -name "*.jar" -o -name "*.class" \) -exec %__rm -f {} \;

%ant -Dversion.major=%{version} -Dversion.minor=0 all

%__rm -rf %{buildroot}

# jars
%__mkdir_p %{buildroot}%{_javadir}
%__cp -a build/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)

# javadoc
%__mkdir_p %{buildroot}%{_javadocdir}/%{name}-%{version}
%__cp -a build/javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{version}
(cd %{buildroot}%{_javadocdir} && %__ln_s %{name}-%{version} %{name})

%__mkdir_p %{buildroot}%{_datadir}
%__cp -a ./src/cmion/* %{buildroot}%{_datadir}
%__cp -a ./cmion.doc %{buildroot}%{_datadir}

find .%{_javadir} -print | sed 's,^\.,\%attr(-\,root\,root) ,'  > $RPM_BUILD_DIR/files.list
find .%{_datadir}/architecture -print | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/files.list
echo .%{_datadir}/cmion.doc | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/files.list
find .%{_datadir}/storage -print|  sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/files.list
find .%{_datadir}/util -print|  sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/files.list
find .%{_datadir}/level2 -print|  sed 's,^\.,\%attr(-\,root\,root) ,' > $RPM_BUILD_DIR/files-lirec.list
find .%{_datadir}/level3 -print|  sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/files-lirec.list

%__rm -rf %{buildroot}



%post javadoc
%__rm -f %{_javadocdir}/%{name}
%__ln_s %{name}-%{version} %{_javadocdir}/%{name}

%postun javadoc
if [ $1 -eq 0 ]; then
  %__rm -f %{_javadocdir}/%{name}

%files -f ../files.list

%files javadoc
%dir %{_javadocdir}/%{name}-%{version}
%ghost %{_javadocdir}/%{name}

%files lirec -f ../files-lirec.list