--- /dev/null
+# This file is included from the top-level CMakeLists.txt. We just store it
+# here to avoid cluttering up that file.
+
+set(PKGNAME ${CMAKE_PROJECT_NAME} CACHE STRING
+ "Distribution package name (default: ${CMAKE_PROJECT_NAME})")
+set(PKGVENDOR "The ${CMAKE_PROJECT_NAME} Project" CACHE STRING
+ "Vendor name to be included in distribution package descriptions (default: The ${CMAKE_PROJECT_NAME} Project)")
+set(PKGURL "http://www.${CMAKE_PROJECT_NAME}.org" CACHE STRING
+ "URL of project web site to be included in distribution package descriptions (default: http://www.${CMAKE_PROJECT_NAME}.org)")
+set(PKGEMAIL "information@${CMAKE_PROJECT_NAME}.org" CACHE STRING
+ "E-mail of project maintainer to be included in distribution package descriptions (default: information@${CMAKE_PROJECT_NAME}.org")
+set(PKGID "com.${CMAKE_PROJECT_NAME}.${PKGNAME}" CACHE STRING
+ "Globally unique package identifier (reverse DNS notation) (default: com.${CMAKE_PROJECT_NAME}.${PKGNAME})")
+
+
+###############################################################################
+# Linux RPM and DEB
+###############################################################################
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+
+set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR})
+if(CPU_TYPE STREQUAL "x86_64")
+ set(DEBARCH amd64)
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7*")
+ set(DEBARCH armhf)
+elseif(CPU_TYPE STREQUAL "arm64")
+ set(DEBARCH ${CPU_TYPE})
+elseif(CPU_TYPE STREQUAL "arm")
+ set(DEBARCH armel)
+elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "ppc64le")
+ set(DEBARCH ppc64el)
++elseif(CPU_TYPE STREQUAL "powerpc" AND BITS EQUAL 32)
++ set(RPMARCH ppc)
++ set(DEBARCH ppc)
+else()
+ set(DEBARCH ${CMAKE_SYSTEM_PROCESSOR})
+endif()
+message(STATUS "RPM architecture = ${RPMARCH}, DEB architecture = ${DEBARCH}")
+
+# Re-set CMAKE_POSITION_INDEPENDENT_CODE so that the RPM spec file works
+# properly
+boolean_number(CMAKE_POSITION_INDEPENDENT_CODE)
+
+configure_file(release/makerpm.in pkgscripts/makerpm)
+configure_file(release/rpm.spec.in pkgscripts/rpm.spec @ONLY)
+
+add_custom_target(rpm sh pkgscripts/makerpm
+ SOURCES pkgscripts/makerpm)
+
+configure_file(release/makesrpm.in pkgscripts/makesrpm)
+
+add_custom_target(srpm sh pkgscripts/makesrpm
+ SOURCES pkgscripts/makesrpm
+ DEPENDS dist)
+
+configure_file(release/makedpkg.in pkgscripts/makedpkg)
+configure_file(release/deb-control.in pkgscripts/deb-control)
+
+add_custom_target(deb sh pkgscripts/makedpkg
+ SOURCES pkgscripts/makedpkg)
+
+endif() # Linux
+
+
+###############################################################################
+# Windows installer (NullSoft Installer)
+###############################################################################
+
+if(WIN32)
+
+if(MSVC)
+ set(INST_PLATFORM "Visual C++")
+ set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
+ set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
+elseif(MINGW)
+ set(INST_PLATFORM GCC)
+ set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
+ set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
+ set(INST_DEFS -DGCC)
+endif()
+
+if(BITS EQUAL 64)
+ set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
+ set(INST_NAME ${INST_NAME}64)
+ set(INST_REG_NAME ${INST_DIR}64)
+ set(INST_DEFS ${INST_DEFS} -DWIN64)
+endif()
+
+if(WITH_JAVA)
+ set(INST_DEFS ${INST_DEFS} -DJAVA)
+endif()
+
+if(MSVC_IDE)
+ set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
+else()
+ set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
+endif()
+
+string(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
+
+configure_file(release/installer.nsi.in installer.nsi @ONLY)
+
+if(WITH_JAVA)
+ set(JAVA_DEPEND turbojpeg-java)
+endif()
+add_custom_target(installer
+ makensis -nocd ${INST_DEFS} installer.nsi
+ DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
+ cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
+ SOURCES installer.nsi)
+
+endif() # WIN32
+
+
+###############################################################################
+# Cygwin Package
+###############################################################################
+
+if(CYGWIN)
+
+configure_file(release/makecygwinpkg.in pkgscripts/makecygwinpkg)
+
+add_custom_target(cygwinpkg sh pkgscripts/makecygwinpkg)
+
+endif() # CYGWIN
+
+
+###############################################################################
+# Mac DMG
+###############################################################################
+
+if(APPLE)
+
+set(DEFAULT_OSX_32BIT_BUILD ${CMAKE_SOURCE_DIR}/osxx86)
+set(OSX_32BIT_BUILD ${DEFAULT_OSX_32BIT_BUILD} CACHE PATH
+ "Directory containing 32-bit (i386) Mac build to include in universal binaries (default: ${DEFAULT_OSX_32BIT_BUILD})")
+set(DEFAULT_IOS_ARMV7_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7)
+set(IOS_ARMV7_BUILD ${DEFAULT_IOS_ARMV7_BUILD} CACHE PATH
+ "Directory containing ARMv7 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7_BUILD})")
+set(DEFAULT_IOS_ARMV7S_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7s)
+set(IOS_ARMV7S_BUILD ${DEFAULT_IOS_ARMV7S_BUILD} CACHE PATH
+ "Directory containing ARMv7s iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7S_BUILD})")
+set(DEFAULT_IOS_ARMV8_BUILD ${CMAKE_SOURCE_DIR}/iosarmv8)
+set(IOS_ARMV8_BUILD ${DEFAULT_IOS_ARMV8_BUILD} CACHE PATH
+ "Directory containing ARMv8 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV8_BUILD})")
+
+configure_file(release/makemacpkg.in pkgscripts/makemacpkg)
+configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
+configure_file(release/uninstall.in pkgscripts/uninstall)
+
+add_custom_target(dmg sh pkgscripts/makemacpkg
+ SOURCES pkgscripts/makemacpkg)
+
+add_custom_target(udmg sh pkgscripts/makemacpkg universal
+ SOURCES pkgscripts/makemacpkg)
+
+endif() # APPLE
+
+
+###############################################################################
+# Generic
+###############################################################################
+
+add_custom_target(dist
+ COMMAND git archive --prefix=${CMAKE_PROJECT_NAME}-${VERSION}/ HEAD |
+ gzip > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}.tar.gz
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+configure_file(release/maketarball.in pkgscripts/maketarball)
+
+add_custom_target(tarball sh pkgscripts/maketarball
+ SOURCES pkgscripts/maketarball)
+
+configure_file(release/libjpeg.pc.in pkgscripts/libjpeg.pc @ONLY)
+
+configure_file(release/libturbojpeg.pc.in pkgscripts/libturbojpeg.pc @ONLY)
--- /dev/null
- %ifarch x86_64
+%define _prefix @CMAKE_INSTALL_PREFIX@
+%define _bindir @CMAKE_INSTALL_FULL_BINDIR@
+%define _datarootdir @CMAKE_INSTALL_FULL_DATAROOTDIR@
+%define _docdir %{_defaultdocdir}/%{name}-%{version}
+%define _includedir @CMAKE_INSTALL_FULL_INCLUDEDIR@
+%define _javadir @CMAKE_INSTALL_FULL_JAVADIR@
+%define _libdir @CMAKE_INSTALL_FULL_LIBDIR@
+%define _mandir @CMAKE_INSTALL_FULL_MANDIR@
+%define _enable_static @ENABLE_STATIC@
+%define _enable_shared @ENABLE_SHARED@
+%define _with_turbojpeg @WITH_TURBOJPEG@
+%define _with_java @WITH_JAVA@
+
++%if "%{?__isa_bits:1}" == "1"
++%define _bits %{__isa_bits}
++%else
++# RPM < 4.6
++%if "%{_lib}" == "lib64"
++%define _bits 64
++%else
++%define _bits 32
++%endif
++%endif
++
+Summary: A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs
+Name: @PKGNAME@
+Version: @VERSION@
+Vendor: @PKGVENDOR@
+URL: @PKGURL@
+Group: System Environment/Libraries
+#-->Source0: http://prdownloads.sourceforge.net/@CMAKE_PROJECT_NAME@/@CMAKE_PROJECT_NAME@-%{version}.tar.gz
+Release: @BUILD@
+License: BSD-style
+BuildRoot: %{_blddir}/%{name}-buildroot-%{version}-%{release}
+Prereq: /sbin/ldconfig
++%if "%{_bits}" == "64"
+Provides: %{name} = %{version}-%{release}, @CMAKE_PROJECT_NAME@ = %{version}-%{release}, libturbojpeg.so()(64bit)
+%else
+Provides: %{name} = %{version}-%{release}, @CMAKE_PROJECT_NAME@ = %{version}-%{release}, libturbojpeg.so
+%endif
+
+%description
+libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
+AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
+on x86, x86-64, ARM, and PowerPC systems. On such systems, libjpeg-turbo is
+generally 2-6x as fast as libjpeg, all else being equal. On other types of
+systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
+virtue of its highly-optimized Huffman coding routines. In many cases, the
+performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.
+
+libjpeg-turbo implements both the traditional libjpeg API as well as the less
+powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
+colorspace extensions that allow it to compress from/decompress to 32-bit and
+big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java
+interface.
+
+libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated
+derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and
+VirtualGL projects made numerous enhancements to the codec in 2009, and in
+early 2010, libjpeg-turbo spun off into an independent project, with the goal
+of making high-speed JPEG compression/decompression technology available to a
+broader range of users and developers.
+
+#-->%prep
+#-->%setup -q -n @CMAKE_PROJECT_NAME@-%{version}
+
+#-->%build
+#-->cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ \
+#--> -DBUILD=%{release} \
+#--> -DCMAKE_INSTALL_BINDIR=%{_bindir} \
+#--> -DCMAKE_INSTALL_DATAROOTDIR=%{_datarootdir} \
+#--> -DCMAKE_INSTALL_DOCDIR=%{_docdir} \
+#--> -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
+#--> -DCMAKE_INSTALL_JAVADIR=%{_javadir} \
+#--> -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
+#--> -DCMAKE_INSTALL_MANDIR=%{_mandir} \
+#--> -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+#--> -DCMAKE_POSITION_INDEPENDENT_CODE=@CMAKE_POSITION_INDEPENDENT_CODE@ \
+#--> -DENABLE_SHARED=@ENABLE_SHARED@ -DENABLE_STATIC=@ENABLE_STATIC@ \
+#--> -DSO_MAJOR_VERSION=@SO_MAJOR_VERSION@ \
+#--> -DSO_MINOR_VERSION=@SO_MINOR_VERSION@ \
+#--> -DJPEG_LIB_VERSION=@JPEG_LIB_VERSION@ \
+#--> -DREQUIRE_SIMD=@REQUIRE_SIMD@ \
+#--> -DWITH_12BIT=@WITH_12BIT@ -DWITH_ARITH_DEC=@WITH_ARITH_DEC@ \
+#--> -DWITH_ARITH_ENC=@WITH_ARITH_ENC@ -DWITH_JAVA=@WITH_JAVA@ \
+#--> -DWITH_JPEG7=@WITH_JPEG7@ -DWITH_JPEG8=@WITH_JPEG8@ \
+#--> -DWITH_MEM_SRCDST=@WITH_MEM_SRCDST@ -DWITH_SIMD=@WITH_SIMD@ \
+#--> -DWITH_TURBOJPEG=@WITH_TURBOJPEG@ .
+#-->make DESTDIR=$RPM_BUILD_ROOT
+
+%install
+
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
+
+#-->%if 0
+
+# This is only needed to support in-tree RPM generation via 'make rpm'. When
+# building from a SRPM, we control where things are installed via CMake
+# variables.
+
+safedirmove ()
+{
+ if [ "$1" = "$2" ]; then
+ return 0
+ fi
+ if [ "$1" = "" -o ! -d "$1" ]; then
+ echo safedirmove: source dir $1 is not valid
+ return 1
+ fi
+ if [ "$2" = "" -o -e "$2" ]; then
+ echo safedirmove: dest dir $2 is not valid
+ return 1
+ fi
+ if [ "$3" = "" -o -e "$3" ]; then
+ echo safedirmove: tmp dir $3 is not valid
+ return 1
+ fi
+ mkdir -p $3
+ mv $1/* $3/
+ rmdir $1
+ mkdir -p $2
+ mv $3/* $2/
+ rmdir $3
+ return 0
+}
+
+LJT_DOCDIR=@CMAKE_INSTALL_FULL_DOCDIR@
+if [ ! "$LJT_DOCDIR" = "%{_docdir}" ]; then
+ safedirmove $RPM_BUILD_ROOT/$LJT_DOCDIR $RPM_BUILD_ROOT/%{_docdir} $RPM_BUILD_ROOT/__tmpdoc
+fi
+
+#-->%endif
+
+LJT_DOCDIR=@CMAKE_INSTALL_FULL_DOCDIR@
+if [ "%{_prefix}" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a "$LJT_DOCDIR" = "@CMAKE_INSTALL_DEFAULT_PREFIX@/doc" ]; then
+ ln -fs %{_docdir} $RPM_BUILD_ROOT/$LJT_DOCDIR
+fi
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%dir %{_docdir}
+%doc %{_docdir}/*
+%dir %{_prefix}
+%if "%{_prefix}" == "@CMAKE_INSTALL_DEFAULT_PREFIX@" && "%{_docdir}" != "%{_prefix}/doc"
+ %{_prefix}/doc
+%endif
+%dir %{_bindir}
+%{_bindir}/cjpeg
+%{_bindir}/djpeg
+%{_bindir}/jpegtran
+%if "%{_with_turbojpeg}" == "1"
+ %{_bindir}/tjbench
+%endif
+%{_bindir}/rdjpgcom
+%{_bindir}/wrjpgcom
+%dir %{_libdir}
+%if "%{_enable_shared}" == "1"
+ %{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@.@SO_AGE@.@SO_MINOR_VERSION@
+ %{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@
+ %{_libdir}/libjpeg.so
+%endif
+%if "%{_enable_static}" == "1"
+ %{_libdir}/libjpeg.a
+%endif
+%{_libdir}/pkgconfig
+%{_libdir}/pkgconfig/libjpeg.pc
+%if "%{_with_turbojpeg}" == "1"
+ %if "%{_enable_shared}" == "1" || "%{_with_java}" == "1"
+ %{_libdir}/libturbojpeg.so.@TURBOJPEG_SO_VERSION@
+ %{_libdir}/libturbojpeg.so.@TURBOJPEG_SO_MAJOR_VERSION@
+ %{_libdir}/libturbojpeg.so
+ %endif
+ %if "%{_enable_static}" == "1"
+ %{_libdir}/libturbojpeg.a
+ %endif
+ %{_libdir}/pkgconfig/libturbojpeg.pc
+%endif
+%dir %{_includedir}
+%{_includedir}/jconfig.h
+%{_includedir}/jerror.h
+%{_includedir}/jmorecfg.h
+%{_includedir}/jpeglib.h
+%if "%{_with_turbojpeg}" == "1"
+ %{_includedir}/turbojpeg.h
+%endif
+%dir %{_mandir}
+%dir %{_mandir}/man1
+%{_mandir}/man1/cjpeg.1*
+%{_mandir}/man1/djpeg.1*
+%{_mandir}/man1/jpegtran.1*
+%{_mandir}/man1/rdjpgcom.1*
+%{_mandir}/man1/wrjpgcom.1*
+%if "%{_prefix}" != "%{_datarootdir}"
+ %dir %{_datarootdir}
+%endif
+%if "%{_with_java}" == "1"
+ %dir %{_javadir}
+ %{_javadir}/turbojpeg.jar
+%endif
+%changelog