[jchardet] Build with maven and provide maven metadata
Stanislav Ochotnicky
sochotni at fedoraproject.org
Tue May 3 14:21:08 UTC 2011
commit 1bee41ca08cbb6dd203b6aa0fc4e150617bb72a7
Author: Stanislav Ochotnicky <sochotnicky at redhat.com>
Date: Tue May 3 15:54:30 2011 +0200
Build with maven and provide maven metadata
- Add javadoc subpackage
jchardet-1.0.pom | 39 +++++++++++++++++++++++++++++++
jchardet.spec | 66 +++++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 94 insertions(+), 11 deletions(-)
---
diff --git a/jchardet-1.0.pom b/jchardet-1.0.pom
new file mode 100644
index 0000000..fdcc4d6
--- /dev/null
+++ b/jchardet-1.0.pom
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>net.sourceforge.jchardet</groupId>
+ <artifactId>jchardet</artifactId>
+ <name>Java port of Mozilla charset detector</name>
+ <version>1.0</version>
+ <description>Java port of Mozilla&#39;s automatic charset detection algorithm.
+ See... <a href=\"http://www.mozilla.org/projects/intl/chardet.html\">
+ http://www.mozilla.org/projects/intl/chardet.html </a>for
+ the details of the orginal code and Author.</description>
+ <url>http://maven.apache.org</url>
+ <licenses>
+ <license>
+ <name>Mozilla Public License 1.1 (MPL 1.1)</name>
+ <url>http://www.mozilla.org/MPL/MPL-1.1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <connection>scm:cvs:pserver:anonymous at jchardet.cvs.sourceforge.net:/cvsroot/jchardet</connection>
+ <url>http://jchardet.cvs.sourceforge.net/jchardet/</url>
+ </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <distributionManagement>
+ <status>deployed</status>
+ </distributionManagement>
+</project>
diff --git a/jchardet.spec b/jchardet.spec
index b42fbd1..207bd01 100644
--- a/jchardet.spec
+++ b/jchardet.spec
@@ -1,20 +1,23 @@
Name: jchardet
Version: 1.1
-Release: 1%{?dist}
-Summary: Automatic charset detection algorithm
+Release: 2%{?dist}
+Summary: Java port of Mozilla's automatic character set detection algorithm
Group: Development/Libraries
License: MPLv1.1
URL: http://jchardet.sourceforge.net/
Source0: http://download.sourceforge.net/jchardet/%{version}/jchardet-%{version}.zip
+Source1: http://repo1.maven.org/maven2/net/sourceforge/%{name}/%{name}/1.0/%{name}-1.0.pom
BuildArch: noarch
+BuildRequires: maven
+BuildRequires: maven-compiler-plugin
BuildRequires: jpackage-utils
-BuildRequires: java-devel
-BuildRequires: ant
Requires: jpackage-utils
Requires: java
+Requires(post): jpackage-utils
+Requires(postun): jpackage-utils
%description
jchardet is a java port of the source from Mozilla's automatic charset
@@ -23,29 +26,70 @@ here is the java port of that code. The original source in C++ can be found
from http://lxr.mozilla.org/mozilla/source/intl/chardet/. More information can
be found at http://www.mozilla.org/projects/intl/chardet.html.
+%package javadoc
+Summary: API documentation for %{name}
+Group: Documentation
+Requires: jpackage-utils
+
+%description javadoc
+%{summary}.
%prep
%setup -q
find -name '*.class' -exec rm -f '{}' \;
find -name '*.jar' -exec rm -f '{}' \;
+cp %{SOURCE1} pom.xml
+# fix up the provided version
+sed -i 's:<version>1.0</version>:<version>1.1</version>:' pom.xml
-%build
-ant
+# remove distributionManagement.status from pom (maven stops build
+# when it's there)
+sed -i '/<distributionManagement>/,/<\/distributionManagement>/ d' pom.xml
+
+# create proper dir structure
+mkdir -p src/main/java/org/mozilla/intl/chardet
+mv src/*java src/main/java/org/mozilla/intl/chardet
+%build
+mvn-rpmbuild install javadoc:aggregate
%install
-mkdir -p $RPM_BUILD_ROOT%{_javadir}
-cp -p dist/lib/chardet.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
-ln -s %{name}.jar $RPM_BUILD_ROOT%{_javadir}/chardet.jar
+# jars
+install -d -m 755 %{buildroot}%{_javadir}
+install -d -m 755 %{buildroot}%{_mavenpomdir}
+install -m 644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
+install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
+
+%add_to_maven_depmap net.sourceforge.jchardet %{name} %{version} JPP %{name}
+
+# javadoc
+install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
+cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
+
+%post
+%update_maven_depmap
+
+%postun
+%update_maven_depmap
%files
-%defattr(-,root,root,-)
-%{_javadir}/*
%doc LICENSE
+%{_mavendepmapfragdir}/%{name}
+%{_mavenpomdir}/JPP-%{name}.pom
+%{_javadir}/%{name}.jar
+
+
+%files javadoc
+%doc LICENSE
+%{_javadocdir}/%{name}
%changelog
+* Fri Apr 29 2011 Stanislav Ochotnicky <sochotnicky at redhat.com> - 1.1-2
+- Build with maven and provide maven metadata
+- Add javadoc subpackage
+
* Fri Apr 22 2011 Orion Poplawski <orion at cora.nwra.com> - 1.1-1
- Initial package
More information about the scm-commits
mailing list