diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4395705 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libwebp-0.3.0.tar.gz diff --git a/.libwebp.metadata b/.libwebp.metadata new file mode 100644 index 0000000..e833479 --- /dev/null +++ b/.libwebp.metadata @@ -0,0 +1 @@ +a20acf2f180d3eae77e24a63371b01fa412fa2f1 SOURCES/libwebp-0.3.0.tar.gz diff --git a/SOURCES/libwebp-0.3.0-endian-check.patch b/SOURCES/libwebp-0.3.0-endian-check.patch new file mode 100644 index 0000000..acde69c --- /dev/null +++ b/SOURCES/libwebp-0.3.0-endian-check.patch @@ -0,0 +1,73 @@ +--- libwebp-0.3.0/examples/tiffdec.c.orig 2013-03-29 22:55:16.000000000 +0000 ++++ libwebp-0.3.0/examples/tiffdec.c 2014-08-19 00:06:28.972859672 +0100 +@@ -95,7 +95,7 @@ + pic->width = width; + pic->height = height; + // TIFF data is ABGR +-#ifdef __BIG_ENDIAN__ ++#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + TIFFSwabArrayOfLong(raster, width * height); + #endif + ok = keep_alpha +--- libwebp-0.3.0/src/dec/vp8.c.orig 2013-03-29 22:55:16.000000000 +0000 ++++ libwebp-0.3.0/src/dec/vp8.c 2014-08-19 00:06:28.972859672 +0100 +@@ -540,7 +540,7 @@ + + // Macro to pack four LSB of four bytes into four bits. + #if defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || \ +- defined(__BIG_ENDIAN__) ++ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + #define PACK_CST 0x08040201U + #else + #define PACK_CST 0x01020408U +--- libwebp-0.3.0/src/dsp/lossless.c.orig 2014-08-19 00:06:28.973859689 +0100 ++++ libwebp-0.3.0/src/dsp/lossless.c 2014-08-19 00:09:58.349573103 +0100 +@@ -1255,7 +1255,7 @@ + uint32_t argb = *src++; + + #if !defined(WEBP_REFERENCE_IMPLEMENTATION) +-#if !defined(__BIG_ENDIAN__) && (defined(__i386__) || defined(__x86_64__)) ++#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) && (defined(__i386__) || defined(__x86_64__)) + __asm__ volatile("bswap %0" : "=r"(argb) : "0"(argb)); + *(uint32_t*)dst = argb; + #elif !defined(__BIG_ENDIAN__) && defined(_MSC_VER) +--- libwebp-0.3.0/src/utils/bit_reader.h.orig 2013-03-29 22:55:16.000000000 +0000 ++++ libwebp-0.3.0/src/utils/bit_reader.h 2014-08-19 00:06:28.973859689 +0100 +@@ -155,7 +155,7 @@ + bit_t bits; + lbit_t in_bits = *(lbit_t*)br->buf_; + br->buf_ += (BITS) >> 3; +-#if !defined(__BIG_ENDIAN__) ++#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) + #if (BITS > 32) + // gcc 4.3 has builtin functions for swap32/swap64 + #if defined(__GNUC__) && \ +@@ -192,7 +192,7 @@ + #else // BITS == 8 + bits = (bit_t)in_bits; + #endif +-#else // BIG_ENDIAN ++#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + bits = (bit_t)in_bits; + #endif + #ifndef USE_RIGHT_JUSTIFY +--- libwebp-0.3.0/src/utils/bit_writer.c.orig 2013-03-29 22:55:16.000000000 +0000 ++++ libwebp-0.3.0/src/utils/bit_writer.c 2014-08-19 00:06:28.973859689 +0100 +@@ -236,7 +236,7 @@ + + void VP8LWriteBits(VP8LBitWriter* const bw, int n_bits, uint32_t bits) { + if (n_bits < 1) return; +-#if !defined(__BIG_ENDIAN__) ++#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) + // Technically, this branch of the code can write up to 25 bits at a time, + // but in prefix encoding, the maximum number of bits written is 18 at a time. + { +@@ -246,7 +246,7 @@ + *(uint32_t*)p = v; + bw->bit_pos_ += n_bits; + } +-#else // BIG_ENDIAN ++#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + { + uint8_t* p = &bw->buf_[bw->bit_pos_ >> 3]; + const int bits_reserved_in_first_byte = bw->bit_pos_ & 7; diff --git a/SOURCES/libwebp-0.3.0-endian-check2.patch b/SOURCES/libwebp-0.3.0-endian-check2.patch new file mode 100644 index 0000000..15e2a33 --- /dev/null +++ b/SOURCES/libwebp-0.3.0-endian-check2.patch @@ -0,0 +1,13 @@ +diff -Naur libwebp-0.3.0.orig/src/dec/vp8.c libwebp-0.3.0/src/dec/vp8.c +--- libwebp-0.3.0.orig/src/dec/vp8.c 2014-10-13 17:06:58.000000000 +0200 ++++ libwebp-0.3.0/src/dec/vp8.c 2014-10-13 17:06:18.000000000 +0200 +@@ -539,8 +539,7 @@ + {{0, 0, 1, 1}}, {{1, 0, 1, 1}}, {{0, 1, 1, 1}}, {{1, 1, 1, 1}} }; + + // Macro to pack four LSB of four bytes into four bits. +-#if defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || \ +- (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) ++#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + #define PACK_CST 0x08040201U + #else + #define PACK_CST 0x01020408U diff --git a/SOURCES/libwebp_jni_example.java b/SOURCES/libwebp_jni_example.java new file mode 100644 index 0000000..d28d9b8 --- /dev/null +++ b/SOURCES/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/SPECS/libwebp.spec b/SPECS/libwebp.spec new file mode 100644 index 0000000..e2e2d69 --- /dev/null +++ b/SPECS/libwebp.spec @@ -0,0 +1,173 @@ +%global _hardened_build 1 +Name: libwebp +Version: 0.3.0 +Release: 7%{?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 +Patch0: libwebp-0.3.0-endian-check.patch +Patch1: libwebp-0.3.0-endian-check2.patch +BuildRequires: libjpeg-devel libpng-devel libtool swig +BuildRequires: giflib-devel +BuildRequires: libtiff-devel +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 +Requires: %{name}%{?_isa} = %{version}-%{release} + +%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 +%patch0 -p1 -b .endian +%patch1 -p1 -b .endian2 + +%build +mkdir -p m4 +./autogen.sh +# enable libwebpmux since gif2webp depends on it +%configure --disable-static --enable-libwebpmux +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 \ + -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 +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}/cwebp +%{_bindir}/dwebp +%{_bindir}/gif2webp +%{_bindir}/webpmux +%{_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 +* Tue Feb 21 2017 Martin Stransky - 0.3.0-7 +- Added libwebp dependency to libwebp-tools + +* Tue Feb 21 2017 Martin Stransky - 0.3.0-6 +- Rebuilt + +* Mon Oct 13 2014 Jaromir Capik - 0.3.0-5 +- Removing __PPC__ macro conflicting with __BYTE_ORDER__ endian check (#1127230) +- Resolves: rhbz#1127230 + +* Mon Aug 18 2014 Peter Robinson 0.3.0-4 +- Fix ppc64le build + +* Fri Jan 24 2014 Daniel Mach - 0.3.0-3 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 0.3.0-2 +- Mass rebuild 2013-12-27 + +* Mon May 13 2013 Rahul Sundaram - 0.3.0-1 +- upstream release 0.3.0 +- enable gif2webp +- add build requires on giflib-devel and libtiff-devel +- use make_install and hardened macros +- list binaries explicitly + +* Thu Feb 14 2013 Fedora Release Engineering - 0.2.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Fri Jan 18 2013 Adam Tkac - 0.2.1-2 +- rebuild due to "jpeg8-ABI" feature drop + +* Thu Dec 27 2012 Rahul Sundaram - 0.2.1-1 +- new upstream release 0.2.1 + +* Fri Dec 21 2012 Adam Tkac - 0.1.3-3 +- rebuild against new libjpeg + +* Thu Jul 19 2012 Fedora Release Engineering - 0.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* 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 +