From d9baa40786e279ad7455473c9cd5f91a960d3d7f Mon Sep 17 00:00:00 2001 From: Rahul Sundaram Date: Thu, 2 Feb 2012 09:45:56 +0530 Subject: [PATCH] initial commit --- .gitignore | 1 + libwebp.spec | 120 +++++++++++++++++++++++++++++++++++++++ libwebp_jni_example.java | 27 +++++++++ sources | 1 + 4 files changed, 149 insertions(+) create mode 100644 libwebp.spec create mode 100644 libwebp_jni_example.java diff --git a/.gitignore b/.gitignore index e69de29..5f3d14f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/libwebp-0.1.3.tar.gz diff --git a/libwebp.spec b/libwebp.spec new file mode 100644 index 0000000..0354228 --- /dev/null +++ b/libwebp.spec @@ -0,0 +1,120 @@ +Name: libwebp +Version: 0.1.3 +Release: 1%{?dist} +Group: Development/Libraries +URL: http://webmproject.org/ +Summary: Library and tools for the WebP graphics format +# Additional IPR is licensed as well. See PATENTS file for details +License: BSD +Source0: http://webp.googlecode.com/files/%{name}-%{version}.tar.gz +Source1: libwebp_jni_example.java +BuildRequires: libjpeg-devel libpng-devel libtool swig +BuildRequires: java-devel +BuildRequires: jpackage-utils + +%description +WebP is an image format that does lossy compression of digital +photographic images. WebP consists of a codec based on VP8, and a +container based on RIFF. Webmasters, web developers and browser +developers can use WebP to compress, archive and distribute digital +images more efficiently. + +%package tools +Group: Development/Tools +Summary: The WebP command line tools + +%description tools +WebP is an image format that does lossy compression of digital +photographic images. WebP consists of a codec based on VP8, and a +container based on RIFF. Webmasters, web developers and browser +developers can use WebP to compress, archive and distribute digital +images more efficiently. + +%package devel +Group: Development/Libraries +Summary: Development files for libwebp, a library for the WebP format +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +WebP is an image format that does lossy compression of digital +photographic images. WebP consists of a codec based on VP8, and a +container based on RIFF. Webmasters, web developers and browser +developers can use WebP to compress, archive and distribute digital +images more efficiently. + +%package java +Group: Development/Libraries +Summary: Java bindings for libwebp, a library for the WebP format +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: java +Requires: jpackage-utils + +%description java +Java bindings for libwebp. + +%prep +%setup -q + +%build +mkdir -p m4 +./autogen.sh +%configure --disable-static +make %{?_smp_mflags} + +# swig generated Java bindings +cp %{SOURCE1} . +cd swig +rm -rf libwebp.jar libwebp_java_wrap.c +mkdir -p java/com/google/webp +swig -ignoremissing -I../src -java \ + -package com.google.webp \ + -outdir java/com/google/webp \ + -o libwebp_java_wrap.c libwebp.i + +gcc %{optflags} -shared -fPIC -fno-strict-aliasing \ + -I/usr/lib/jvm/java/include \ + -I/usr/lib/jvm/java/include/linux \ + -I../src \ + -L../src/.libs -lwebp libwebp_java_wrap.c \ + -o libwebp_jni.so + +cd java +javac com/google/webp/libwebp.java +jar cvf ../libwebp.jar com/google/webp/*.class + +%install +make install DESTDIR=%{buildroot} +find "%{buildroot}/%{_libdir}" -type f -name "*.la" -delete + +# swig generated Java bindings +mkdir -p %{buildroot}/%{_libdir}/%{name}-java +cp swig/*.jar swig/*.so %{buildroot}/%{_libdir}/%{name}-java/ + +%post -n %{name} -p /sbin/ldconfig + +%postun -n %{name} -p /sbin/ldconfig + +%files tools +%{_bindir}/* +%{_mandir}/man*/* + +%files -n %{name} +%doc README PATENTS COPYING NEWS AUTHORS +%{_libdir}/%{name}*.so.* + +%files devel +%{_libdir}/%{name}*.so +%{_includedir}/* +%{_libdir}/pkgconfig/* + +%files java +%doc libwebp_jni_example.java +%{_libdir}/%{name}-java/ + +%changelog +* Thu Feb 02 2012 Rahul Sundaram - 0.1.3-1 +- Several spec improvements by Scott Tsai + +* Wed May 25 2011 Rahul Sundaram - 0.1.2-1 +- Initial spec. Based on openSUSE one + diff --git a/libwebp_jni_example.java b/libwebp_jni_example.java new file mode 100644 index 0000000..d28d9b8 --- /dev/null +++ b/libwebp_jni_example.java @@ -0,0 +1,27 @@ +import com.google.webp.libwebp; + +import java.lang.reflect.Method; + +public class libwebp_jni_example { + static { + try { + System.load("/usr/lib64/libwebp-java/libwebp_jni.so"); + } catch (UnsatisfiedLinkError e) { + System.load("/usr/lib/libwebp-java/libwebp_jni.so"); + } + } + + /** + * usage: java -cp libwebp.jar:. libwebp_jni_example + */ + public static void main(String argv[]) { + final int version = libwebp.WebPGetDecoderVersion(); + System.out.println("libwebp version: " + Integer.toHexString(version)); + + System.out.println("libwebp methods:"); + final Method[] libwebpMethods = libwebp.class.getDeclaredMethods(); + for (int i = 0; i < libwebpMethods.length; i++) { + System.out.println(libwebpMethods[i]); + } + } +} diff --git a/sources b/sources index e69de29..6afae86 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +254d4670e14e9ed881f0536b006ab336 libwebp-0.1.3.tar.gz