1 %global _docdir %{_defaultdocdir}/%{name}-%{version} 2 %define _prefix @CMAKE_INSTALL_PREFIX@ 3 %define _bindir @CMAKE_INSTALL_FULL_BINDIR@ 4 %define _datarootdir @CMAKE_INSTALL_FULL_DATAROOTDIR@ 5 %define _includedir @CMAKE_INSTALL_FULL_INCLUDEDIR@ 6 %define _javadir @CMAKE_INSTALL_FULL_JAVADIR@ 7 %define _mandir @CMAKE_INSTALL_FULL_MANDIR@ 8 %define _enable_static @ENABLE_STATIC@ 9 %define _enable_shared @ENABLE_SHARED@ 10 %define _with_turbojpeg @WITH_TURBOJPEG@ 11 %define _with_java @WITH_JAVA@ 12 13 %if "%{?__isa_bits:1}" == "1" 14 %define _bits %{__isa_bits} 15 %else 16 # RPM < 4.6 17 %if "%{_lib}" == "lib64" 18 %define _bits 64 19 %else 20 %define _bits 32 21 %endif 22 %endif 23 24 #-->%if 1 25 %if "%{_bits}" == "64" 26 %define _libdir %{_exec_prefix}/lib64 27 %else 28 %if "%{_prefix}" == "/opt/libjpeg-turbo" 29 %define _libdir %{_exec_prefix}/lib32 30 %endif 31 %endif 32 #-->%else 33 %define _libdir @CMAKE_INSTALL_FULL_LIBDIR@ 34 #-->%endif 35 36 Summary: A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs 37 Name: @PKGNAME@ 38 Version: @VERSION@ 39 Vendor: @PKGVENDOR@ 40 URL: @PKGURL@ 41 Group: System Environment/Libraries 42 #-->Source0: http://prdownloads.sourceforge.net/@CMAKE_PROJECT_NAME@/@CMAKE_PROJECT_NAME@-%{version}.tar.gz 43 Release: @BUILD@ 44 License: BSD-style 45 BuildRoot: %{_blddir}/%{name}-buildroot-%{version}-%{release} 46 Requires: /sbin/ldconfig 47 %if "%{_bits}" == "64" 48 Provides: %{name} = %{version}-%{release}, @CMAKE_PROJECT_NAME@ = %{version}-%{release}, libturbojpeg.so()(64bit) 49 %else 50 Provides: %{name} = %{version}-%{release}, @CMAKE_PROJECT_NAME@ = %{version}-%{release}, libturbojpeg.so 51 %endif 52 53 %description 54 libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, 55 AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression 56 on x86, x86-64, ARM, and PowerPC systems, as well as progressive JPEG 57 compression on x86 and x86-64 systems. On such systems, libjpeg-turbo is 58 generally 2-6x as fast as libjpeg, all else being equal. On other types of 59 systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by 60 virtue of its highly-optimized Huffman coding routines. In many cases, the 61 performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs. 62 63 libjpeg-turbo implements both the traditional libjpeg API as well as the less 64 powerful but more straightforward TurboJPEG API. libjpeg-turbo also features 65 colorspace extensions that allow it to compress from/decompress to 32-bit and 66 big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java 67 interface. 68 69 libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated 70 derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and 71 VirtualGL projects made numerous enhancements to the codec in 2009, and in 72 early 2010, libjpeg-turbo spun off into an independent project, with the goal 73 of making high-speed JPEG compression/decompression technology available to a 74 broader range of users and developers. 75 76 #-->%prep 77 #-->%setup -q -n @CMAKE_PROJECT_NAME@-%{version} 78 79 #-->%build 80 #-->cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ \ 81 #--> -DBUILD=%{release} \ 82 #--> -DCMAKE_INSTALL_BINDIR=%{_bindir} \ 83 #--> -DCMAKE_INSTALL_DATAROOTDIR=%{_datarootdir} \ 84 #--> -DCMAKE_INSTALL_DOCDIR=%{_docdir} \ 85 #--> -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \ 86 #--> -DCMAKE_INSTALL_JAVADIR=%{_javadir} \ 87 #--> -DCMAKE_INSTALL_LIBDIR=%{_libdir} \ 88 #--> -DCMAKE_INSTALL_MANDIR=%{_mandir} \ 89 #--> -DCMAKE_INSTALL_PREFIX=%{_prefix} \ 90 #--> -DCMAKE_POSITION_INDEPENDENT_CODE=@CMAKE_POSITION_INDEPENDENT_CODE@ \ 91 #--> -DENABLE_SHARED=@ENABLE_SHARED@ -DENABLE_STATIC=@ENABLE_STATIC@ \ 92 #--> -DSO_MAJOR_VERSION=@SO_MAJOR_VERSION@ \ 93 #--> -DSO_MINOR_VERSION=@SO_MINOR_VERSION@ \ 94 #--> -DJPEG_LIB_VERSION=@JPEG_LIB_VERSION@ \ 95 #--> -DREQUIRE_SIMD=@REQUIRE_SIMD@ \ 96 #--> -DWITH_12BIT=@WITH_12BIT@ -DWITH_ARITH_DEC=@WITH_ARITH_DEC@ \ 97 #--> -DWITH_ARITH_ENC=@WITH_ARITH_ENC@ -DWITH_JAVA=@WITH_JAVA@ \ 98 #--> -DWITH_JPEG7=@WITH_JPEG7@ -DWITH_JPEG8=@WITH_JPEG8@ \ 99 #--> -DWITH_MEM_SRCDST=@WITH_MEM_SRCDST@ -DWITH_SIMD=@WITH_SIMD@ \ 100 #--> -DWITH_TURBOJPEG=@WITH_TURBOJPEG@ . 101 #-->make DESTDIR=$RPM_BUILD_ROOT 102 103 %install 104 105 rm -rf $RPM_BUILD_ROOT 106 make install DESTDIR=$RPM_BUILD_ROOT 107 /sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir} 108 109 #-->%if 0 110 111 # This is only needed to support in-tree RPM generation via 'make rpm'. When 112 # building from a SRPM, we control where things are installed via CMake 113 # variables. 114 115 safedirmove () 116 { 117 if [ "$1" = "$2" ]; then 118 return 0 119 fi 120 if [ "$1" = "" -o ! -d "$1" ]; then 121 echo safedirmove: source dir $1 is not valid 122 return 1 123 fi 124 if [ "$2" = "" -o -e "$2" ]; then 125 echo safedirmove: dest dir $2 is not valid 126 return 1 127 fi 128 if [ "$3" = "" -o -e "$3" ]; then 129 echo safedirmove: tmp dir $3 is not valid 130 return 1 131 fi 132 mkdir -p $3 133 mv $1/* $3/ 134 rmdir $1 135 mkdir -p $2 136 mv $3/* $2/ 137 rmdir $3 138 return 0 139 } 140 141 LJT_DOCDIR=@CMAKE_INSTALL_FULL_DOCDIR@ 142 if [ ! "$LJT_DOCDIR" = "%{_docdir}" ]; then 143 safedirmove $RPM_BUILD_ROOT/$LJT_DOCDIR $RPM_BUILD_ROOT/%{_docdir} $RPM_BUILD_ROOT/__tmpdoc 144 fi 145 146 #-->%endif 147 148 LJT_DOCDIR=@CMAKE_INSTALL_FULL_DOCDIR@ 149 if [ "%{_prefix}" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a "$LJT_DOCDIR" = "@CMAKE_INSTALL_DEFAULT_PREFIX@/doc" ]; then 150 ln -fs %{_docdir} $RPM_BUILD_ROOT/$LJT_DOCDIR 151 fi 152 153 %post -p /sbin/ldconfig 154 155 %postun -p /sbin/ldconfig 156 157 %clean 158 rm -rf $RPM_BUILD_ROOT 159 160 %files 161 %defattr(-,root,root) 162 %dir %{_docdir} 163 %doc %{_docdir}/* 164 %dir %{_prefix} 165 %if "%{_prefix}" == "@CMAKE_INSTALL_DEFAULT_PREFIX@" && "%{_docdir}" != "%{_prefix}/doc" 166 %{_prefix}/doc 167 %endif 168 %dir %{_bindir} 169 %{_bindir}/cjpeg 170 %{_bindir}/djpeg 171 %{_bindir}/jpegtran 172 %if "%{_with_turbojpeg}" == "1" 173 %{_bindir}/tjbench 174 %endif 175 %{_bindir}/rdjpgcom 176 %{_bindir}/wrjpgcom 177 %dir %{_libdir} 178 %if "%{_enable_shared}" == "1" 179 %{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@.@SO_AGE@.@SO_MINOR_VERSION@ 180 %{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@ 181 %{_libdir}/libjpeg.so 182 %endif 183 %if "%{_enable_static}" == "1" 184 %{_libdir}/libjpeg.a 185 %endif 186 %dir %{_libdir}/pkgconfig 187 %{_libdir}/pkgconfig/libjpeg.pc 188 %if "%{_with_turbojpeg}" == "1" 189 %if "%{_enable_shared}" == "1" || "%{_with_java}" == "1" 190 %{_libdir}/libturbojpeg.so.@TURBOJPEG_SO_VERSION@ 191 %{_libdir}/libturbojpeg.so.@TURBOJPEG_SO_MAJOR_VERSION@ 192 %{_libdir}/libturbojpeg.so 193 %endif 194 %if "%{_enable_static}" == "1" 195 %{_libdir}/libturbojpeg.a 196 %endif 197 %{_libdir}/pkgconfig/libturbojpeg.pc 198 %endif 199 %dir %{_includedir} 200 %{_includedir}/jconfig.h 201 %{_includedir}/jerror.h 202 %{_includedir}/jmorecfg.h 203 %{_includedir}/jpeglib.h 204 %if "%{_with_turbojpeg}" == "1" 205 %{_includedir}/turbojpeg.h 206 %endif 207 %dir %{_mandir} 208 %dir %{_mandir}/man1 209 %{_mandir}/man1/cjpeg.1* 210 %{_mandir}/man1/djpeg.1* 211 %{_mandir}/man1/jpegtran.1* 212 %{_mandir}/man1/rdjpgcom.1* 213 %{_mandir}/man1/wrjpgcom.1* 214 %if "%{_prefix}" != "%{_datarootdir}" 215 %dir %{_datarootdir} 216 %endif 217 %if "%{_with_java}" == "1" 218 %dir %{_javadir} 219 %{_javadir}/turbojpeg.jar 220 %endif 221 %changelog 222