[packages/java-snappy] build without maven (so no network access needed)
glen
glen at pld-linux.org
Tue Apr 2 22:13:32 CEST 2013
commit 5f1528f4e87e30a9a96a39795a3c0e16bde90c66
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Tue Apr 2 23:13:10 2013 +0300
build without maven (so no network access needed)
java-snappy.spec | 52 +++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 45 insertions(+), 7 deletions(-)
---
diff --git a/java-snappy.spec b/java-snappy.spec
index e07aad5..5ffbd42 100644
--- a/java-snappy.spec
+++ b/java-snappy.spec
@@ -1,22 +1,30 @@
+# TODO
+# - recompile org/xerial/snappy/native/*
+#
+# Conditional build:
+%bcond_with javadoc # don't build javadoc
+
%define srcname snappy
%include /usr/lib/rpm/macros.java
Summary: Fast compressor/decompresser
Name: java-%{srcname}
Version: 1.0.4.1
-Release: 0.1
-License: ASL 2.0
+Release: 1
+License: Apache v2.0
Group: Libraries/Java
# hg clone --insecure -r snappy-java-1.0.4.1 https://code.google.com/p/snappy-java/
# cd snappy-java && hg archive -p snappy-java-1.0.4.1/ -X 'lib/*.jar' -t tgz ../snappy-java-1.0.4.1-CLEAN.tgz
Source0: snappy-java-%{version}-CLEAN.tgz
# Source0-md5: 53d74de12e54772299b03db495c21004
URL: http://code.google.com/p/snappy-java
+BuildRequires: java-osgi-core >= 4.3
BuildRequires: jdk
BuildRequires: jpackage-utils
-BuildRequires: maven >= 2.0
BuildRequires: rpm-javaprov
BuildRequires: rpmbuild(macros) >= 1.300
+Requires: java-osgi-core >= 4.3
Requires: jpackage-utils
+Requires: jre
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -34,20 +42,45 @@ This package contains the API documentation for %{name}.
%prep
%setup -q -n snappy-java-%{version}
+find -name '*.class' -print -delete
+
%build
-mvn -Dmaven.test.skip=true install javadoc:aggregate
+install -d target
+topdir=${PWD:-$(pwd)}
+
+required_jars="osgi.core"
+CLASSPATH=$(build-classpath $required_jars)
+export CLASSPATH
+
+cd src/main/java
+%javac -cp $CLASSPATH $(find -name '*.java')
+
+# create jar
+%jar cf $topdir/target/%{srcname}-%{version}.jar $(find -name '*.class') \
+ org/xerial/snappy/VERSION
+
+cd ../resources
+%jar uf $topdir/target/%{srcname}-%{version}.jar \
+ org/xerial/snappy/*.bytecode \
+ org/xerial/snappy/native/** \
%install
rm -rf $RPM_BUILD_ROOT
# JAR
install -d $RPM_BUILD_ROOT%{_javadir}
-cp -p target/snappy-java-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
+cp -p target/%{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{srcname}-%{version}.jar
+ln -s %{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{srcname}.jar
+
+# upstream name
+ln -s %{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/snappy-java-%{version}.jar
+ln -s snappy-java-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/snappy-java.jar
-# APIDOCS
+%if %{with javadoc}
install -d $RPM_BUILD_ROOT%{_javadocdir}/%{srcname}-%{version}
cp -a target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{srcname}-%{version}
ln -s %{srcname}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{srcname} # ghost symlink
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
@@ -58,9 +91,14 @@ ln -nfs %{srcname}-%{version} %{_javadocdir}/%{srcname}
%files
%defattr(644,root,root,755)
%doc LICENSE README NOTICE
-%{_javadir}/*.jar
+%{_javadir}/%{srcname}-%{version}.jar
+%{_javadir}/%{srcname}.jar
+%{_javadir}/snappy-java-%{version}.jar
+%{_javadir}/snappy-java.jar
+%if %{witht javadoc}
%files javadoc
%defattr(644,root,root,755)
%{_javadocdir}/%{srcname}-%{version}
%ghost %{_javadocdir}/%{srcname}
+%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/java-snappy.git/commitdiff/5f1528f4e87e30a9a96a39795a3c0e16bde90c66
More information about the pld-cvs-commit
mailing list