packages apache-log4j.spec
      Pages: < 1 >  DOWNLOAD      
%define        repodir    %{_javadir}/repository.jboss.com/apache-log4j/%{version}-brew
%define        repodirlib %{repodir}/lib
%define        repodirsrc %{repodir}/src
#%define        javahome   /usr/lib/jvm/java
Name:          apache-log4j
Version:       1.2.15
Release:       7mamba
Summary:       Java logging package
Group:         Graphical Desktop/Applications/Development
Vendor:        openmamba
Distribution:  openmamba
Packager:      Silvan Calarco <silvan.calarco@...>
URL:           http://logging.apache.org/log4j/
Source0:       ftp://cis.uniroma2.it/unix/packages/APACHE/logging/log4j/%{version}/apache-log4j-%{version}.tar.gz
#http://www.apache.org/dist/logging/log4j/%{version}/logging-log4j-%{version}.tar.gz
Source1:       java-log4j-chainsaw_128.png
Source2:       java-log4j-logfactor.png
Source3:       java-log4j-chainsaw.sh
Source4:       java-log4j-logfactor5.sh
Source5:       java-log4j.catalog
Source6:       java-component-info5.xml
Patch0:        apache-log4j-1.2.15-logfactor5-userdir.patch
Patch1:        apache-log4j-1.2.15-javadoc-xlink.patch
Patch2:        java-log4j-1.2.14-mx4j-tools.patch
Patch3:        apache-log4j-1.2.15-jmx-Agent.patch
License:       Apache License Version 2.0
BuildRequires: apache-ant
%if "%{stage1}" != "1"
BuildRequires: ant-contrib
BuildRequires: apache-ant-junit
BuildRequires: apache-ant-nodeps
BuildRequires: jakarta-oro
BuildRequires: java-junit3
#BuildRequires: java-mx4j
# com.sun.jdmk jmxtools 1.2.1
# com.sun.jmx jmxri 1.2.1
#BuildRequires: java-classpathx-jaf
#BuildRequires: java-openjdk
BuildRequires: java-snmptrapappender
BuildRequires: java-sun-jaf
BuildRequires: java-sun-jms
BuildRequires: java-sun-jmx-ri
BuildRequires: java-sun-jndi
#BuildRequires: java-classpathx-mail
BuildRequires: java-sun-mail-1.4-api
BuildRequires: xml-commons-apis
%endif
BuildRequires: jpackage-utils
BuildRequires: perl
Requires:      jpackage-utils
Requires:      xml-commons-apis
Obsoletes:     java-log4j
Provides:      java-log4j
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
%{name} is a tool to help the programmer output log statements to a variety of output targets.

%package javadoc
Group:          Documentation
Summary:        Javadoc for %{name}
Obsoletes:      java-log4j-javadoc
Provides:       java-log4j-javadoc

%description javadoc
%{name} is a tool to help the programmer output log statements to a variety of output targets.
This package contains javadoc for %{name}.

%package manual
Group:          Documentation
Summary:        Manual for %{name}
Obsoletes:      java-log4j-manual
Provides:       java-log4j-manual

%description manual
%{name} is a tool to help the programmer output log statements to a variety of output targets.
This package contains documentation for %{name}.

%package repolib
Group:         Development/Libraries/Java
Summary:       Artifacts to be uploaded to a repository library
Obsoletes:     apache-log4j-source
Provides:      apache-log4j-source

%description repolib
%{name} is a tool to help the programmer output log statements to a variety of output targets.
This package contains artifacts to be uploaded to a repository library.
This package is not meant to be installed but so its contents can be extracted through rpm2cpio

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
#%patch2 -p1
#%patch3 -p0

perl -pi -e 's/\r//g' LICENSE
perl -pi -e 's/\r//g' NOTICE

for j in $(find . -name "*.jar"); do 
       mv $j $j.no
done

find . \( -name "*.class" \) -exec rm -f {} \;

rm -rf docs/api

%build
export JAVA_HOME=%java_home
export CLASSPATH=$(build-classpath snmptrapappender junit-3.8.2 ant-1.7.1 ant/ant-nodeps ant/ant-junit)
ant \
  -Djavamail.jar=$(build-classpath sun-mail-api) \
  -Dactivation.jar=$(build-classpath sun-jaf) \
  -Djaxp.jaxp.jar.jar=$(build-classpath xercesImpl) \
  -Djmx.jar=$(build-classpath sun-jmxri) \
  -Djmx-extra.jar=$(build-classpath sun-jmxtools) \
  -Djms.jar=$(build-classpath jms) \
  -Djndi.jar=$(build-classpath jndi) \
  -Djavac.source=1.2 \
  -Djdk.javadoc=%{_javadocdir}/java \
  jar javadoc

# 	-Djmx.jar=$(build-classpath mx4j/mx4j) \
#	-Djmx-extra.jar=$(build-classpath mx4j/mx4j-tools) \

%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

mkdir -p %{buildroot}%{_javadir}
mkdir -p %{buildroot}%{_datadir}/maven2/poms

install -m 644 pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-log4j.pom
%add_to_maven_depmap log4j log4j %{version} JPP log4j

install -pm 644  dist/lib/log4j-%{version}.jar %{buildroot}%{_javadir}

(
  cd %{buildroot}%{_javadir}
  for jar in *-%{version}*; do
    ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`
  done
)

mkdir -p %{buildroot}%{_javadocdir}/log4j-%{version}
cp -a docs/api/* %{buildroot}%{_javadocdir}/log4j-%{version}
ln -s log4j-%{version} %{buildroot}%{_javadocdir}/log4j

rm -rf docs/api
ln -s %{_javadocdir}/log4j docs/api

mkdir -p %{buildroot}%{_bindir} \
         %{buildroot}%{_datadir}/applications \
         %{buildroot}%{_datadir}/pixmaps

install -pm 644 %{S:1} %{buildroot}%{_datadir}/pixmaps/chainsaw.png
install -pm 644 %{S:2} %{buildroot}%{_datadir}/pixmaps/logfactor5.png


install -pm 755 %{S:3} %{buildroot}%{_bindir}/chainsaw
install -pm 755 %{S:4} %{buildroot}%{_bindir}/logfactor5

cat > %{buildroot}%{_datadir}/applications/jpackage-chainsaw.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=Chainsaw
Comment=Log4j log viewer
Exec=%{_bindir}/chainsaw
Icon=%{_datadir}/pixmaps/chainsaw.png
Terminal=false
Type=Application
Categories=GNOME;Application;Development;X-JPackage;
EOF


cat > %{buildroot}%{_datadir}/applications/jpackage-logfactor5.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=LogFactor5
Comment=Graphical user interface for managing log4j log messages
Exec=%{_bindir}/logfactor5
Icon=%{_datadir}/pixmaps/logfactor5.png
Terminal=false
Type=Application
Categories=GNOME;Application;Development;X-JPackage;
EOF

# DTD and the SGML catalog (XML catalog handled in scriptlets)
mkdir -p %{buildroot}%{_datadir}/sgml/log4j
install -pm 644 src/main/resources/org/apache/log4j/xml/log4j.dtd %{buildroot}%{_datadir}/sgml/log4j
install -pm 644 %{S:5} %{buildroot}%{_datadir}/sgml/log4j/catalog

perl -p -i -e 's|/opt/perl5/bin/perl|%{__perl}|' contribs/KitchingSimon/udpserver.pl

mkdir -p %{buildroot}%{repodir}
mkdir -p %{buildroot}%{repodirlib}
install -m 644 %{SOURCE6} %{buildroot}%{repodir}/component-info.xml
tag=`echo log4j-%{version}-%{release} | sed 's|\.|_|g'`
sed -i "s/@NAME@/apache-log4j-component-info/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@ID@/log4j/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@TAG@/$tag/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@VERSION@/%{version}-brew/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@LICENSE@/%{license}/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s|@PROJECTHOME@|http://logging.apache.org/|g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@DESCRIPTION@/Java logging framework/g" \
	%{buildroot}%{repodir}/component-info.xml
sed -i "s/@ARTIFACTID1@/log4j.jar/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@ARTIFACTID2@/log4j-src.jar/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@COMPONENTREF@/snmptrapappender/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@VERSION_COMPONENTREF@/1.2.9.1-brew/g" %{buildroot}%{repodir}/component-info.xml
sed -i "s/@INCLUDEINPUT@/log4j.jar/g" %{buildroot}%{repodir}/component-info.xml
mkdir -p %{buildroot}%{repodirsrc}
install -m 644 %{SOURCE0} %{buildroot}%{repodirsrc}
install -m 644 %{SOURCE1} %{buildroot}%{repodirsrc}
install -m 644 %{SOURCE3} %{buildroot}%{repodirsrc}
cp %{PATCH0} %{buildroot}%{repodirsrc}
cp %{PATCH1} %{buildroot}%{repodirsrc}
cp %{PATCH2} %{buildroot}%{repodirsrc}
cp %{PATCH3} %{buildroot}%{repodirsrc}
cp %{buildroot}%{_javadir}/log4j-%{version}.jar %{buildroot}%{repodirlib}/log4j.jar
cp dist/lib/log4j-%{version}-sources.jar %{buildroot}%{repodirlib}/log4j-sources.jar

#%{_bindir}/rebuild-gcj-db

%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

%post
%update_maven_depmap
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
  %{_bindir}/install-catalog --add \
    %{_sysconfdir}/sgml/log4j-%{version}-%{release}.cat \
    %{_datadir}/sgml/log4j/catalog > /dev/null || :
fi
if [ -x %{_bindir}/xmlcatalog -a -w %{_sysconfdir}/xml/catalog ]; then
  %{_bindir}/xmlcatalog --noout --add system log4j.dtd \
    file://%{_datadir}/sgml/log4j/log4j.dtd %{_sysconfdir}/xml/catalog \
     > /dev/null || :
fi

%preun
if [ $1 -eq 0 ]; then
  if [ -x %{_bindir}/xmlcatalog -a -w %{_sysconfdir}/xml/catalog ]; then
      %{_bindir}/xmlcatalog --noout --del log4j.dtd \
      %{_sysconfdir}/xml/catalog > /dev/null || :
  fi
fi

%postun
%update_maven_depmap
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
  %{_bindir}/install-catalog --remove \
    %{_sysconfdir}/sgml/log4j-%{version}-%{release}.cat \
    %{_datadir}/sgml/log4j/catalog > /dev/null || :
fi

%files
%defattr(-,root,root)
%{_bindir}/chainsaw
%{_bindir}/logfactor5
%{_datadir}/pixmaps/*.png
%{_datadir}/applications/jpackage-*.desktop
%{_datadir}/sgml/log4j
%{_javadir}/log4j-%{version}.jar
%{_javadir}/log4j.jar
%{_datadir}/maven2/poms
%{_mavendepmapfragdir}
%doc BUILD-INFO.txt KEYS LICENSE NOTICE

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

%files manual
%defattr(-,root,root)
%doc docs/* contribs

%files repolib
%defattr(-,root,root)
%{repodir}

%changelog
* Sun Mar 06 2011 gil <puntogil@...> 1.2.15-7mamba
- rebuilt devel

* Wed Nov 25 2009 gil <puntogil@...> 1.2.15-6mamba
- rebuilt with java-sun-jmx-ri instead of java-mx4j

* Mon Nov 16 2009 gil <puntogil@...> 1.2.15-5mamba
- edit component-info.xml

* Mon Nov 16 2009 gil <puntogil@...> 1.2.15-4mamba
- added package repolib

* Sun Sep 13 2009 gil <puntogil@...> 1.2.15-3mamba
- rebuilt with new java-mx4j
- add java-snmptrapappender support

* Sat Apr 18 2009 gil <puntogil@...> 1.2.15-2mamba
- fixed some errors

* Sat Apr 18 2009 gil <puntogil@...> 1.2.15-1mamba
- update to 1.2.15
- renamed apache-log4j
- added package source

* Mon Mar 23 2009 gil <puntogil@...> 1.2.14-2mamba
- added java-mx4j support

* Sat Feb 28 2009 gil <puntogil@...> 1.2.14-1mamba
- package created by autospec