rpm.spec.in 6.7 KB

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