Build: Set install dirs in a more GNU-friendly way

This builds upon the existing GNUInstallDirs module in CMake but adds
the following features to that module:

- The ability to override the defaults for each install directory
  through a new set of variables (`CMAKE_INSTALL_DEFAULT_*DIR`).

  Before operating system vendors began shipping libjpeg-turbo, it was
  meant to be a run-time drop-in replacement for the system's
  distribution of libjpeg, so it has traditionally installed itself
  under /opt/libjpeg-turbo on Un*x systems by default.  On Windows, it
  has traditionally installed itself under %SystemDrive%\libjpeg-turbo*,
  which is not uncommon behavior for open source libraries (open source
  SDKs tend to install outside of the Program Files directory so as to
  avoid spaces in the directory name.)  At least in the case of Un*x,
  the install directory behavior is based somewhat on the Solaris
  standard, which requires all non-O/S packages to install their files
  under /opt/{package_name}.  I adopted that standard for VirtualGL and
  TurboVNC while working at Sun, because it allowed those packages to be
  located under the same directory on all platforms.  I adopted it for
  libjpeg-turbo because it ensured that our files would never conflict
  with the system's version of libjpeg.  Even though many Un*x
  distributions ship libjpeg-turbo these days, not all of them ship the
  TurboJPEG API library or the Java classes or even the latest version
  of the libjpeg API library, so there are still many cases in which it
  is desirable to install a separate version of libjpeg-turbo than the
  one installed by the system.  Furthermore, installing the files under
  /opt mimics the directory structure of our official binary packages,
  and it makes it very easy to uninstall libjpeg-turbo.

  For these reasons, our build system needs to be able to use
  non-GNU-compliant defaults for each install directory if
  `CMAKE_INSTALL_PREFIX` is set to the default value.

- For each directory variable, the module now detects changes to
  `CMAKE_INSTALL_PREFIX` and changes the directory variable accordingly,
  if the variable has not been changed by the user.

  This makes it easy to switch between our "official" directory
  structure and the GNU-compliant directory structure "on the fly"
  simply by changing `CMAKE_INSTALL_PREFIX`.  Also, this new mechanism
  eliminated the need for the crufty mechanism that previously did the
  same thing just for the library directory variable.

  How it should work:
  - If a dir variable is unset, then the module will set an internal
    property indicating that the dir variable was initialized to its
    default value.
  - If the dir variable ever diverges from its default value, then the
    internal property is cleared, and it cannot be set again without
    unsetting the dir variable.
  - If the install prefix changes, and if the internal property
    indicates that the dir variable is still set to its default value,
    and if the dir variable's value is not being manually changed at the
    same time that the install prefix is being changed, then the dir
    variable's value is automatically changed to the new default value
    for that variable (as determined by the new install prefix.)

- The directory variables are now always cached, regardless of whether
  they were set on the command line or not.  This ensures that they can
  easily be examined and modified after being set, regardless of how they
  were set.

  This was made possible by the introduction of the aforementioned
  `CMAKE_INSTALL_DEFAULT_*DIR` variables.

- Improved directory variable documentation (based on descriptions at
  https://www.gnu.org/prep/standards/html_node/Directory-Variables.html)

- The module now allows "<DATAROOTDIR>" to be used as a placeholder in
  relative directory variables.

  It is replaced "on the fly" with the actual path of
  `CMAKE_INSTALL_DATAROOTDIR`.

This should more closely mimic the behavior of the old autotools build
system while retaining our customizations to it, and it should retain
the behavior of the old CMake build system.

Closes #124
This commit is contained in:
DRC 2016-12-07 10:54:54 -06:00
parent ff05b6e0de
commit d681fa7626
13 changed files with 572 additions and 122 deletions

View File

@ -638,10 +638,32 @@ MinGW 64-bit build
**/opt/libjpeg-turbo**<br>
Un*x
The `BINDIR`, `DATADIR`, `DOCDIR`, `INCLUDEDIR`, `LIBDIR`, and `MANDIR`
CMake variables allow a finer degree of control over where specific files in
the libjpeg-turbo distribution should be installed.
The default value of `CMAKE_INSTALL_PREFIX` causes the libjpeg-turbo files to
be installed with a directory structure resembling that of the official
libjpeg-turbo binary packages. Changing the value of `CMAKE_INSTALL_PREFIX`
(for instance, to "/usr/local") causes the libjpeg-turbo files to be installed
with a directory structure that conforms to GNU standards.
The `CMAKE_INSTALL_BINDIR`, `CMAKE_INSTALL_DATAROOTDIR`,
`CMAKE_INSTALL_DOCDIR`, `CMAKE_INSTALL_INCLUDEDIR`, `CMAKE_INSTALL_JAVADIR`,
`CMAKE_INSTALL_LIBDIR`, and `CMAKE_INSTALL_MANDIR` CMake variables allow a
finer degree of control over where specific files in the libjpeg-turbo
distribution should be installed. These directory variables can either be
specified as absolute paths or as paths relative to `CMAKE_INSTALL_PREFIX` (for
instance, setting `CMAKE_INSTALL_DOCDIR=doc` would cause the documentation to
be installed in `${CMAKE_INSTALL_PREFIX}/doc`.) If `CMAKE_INSTALL_DOCDIR`,
`CMAKE_INSTALL_JAVADIR`, or `CMAKE_INSTALL_MANDIR` contains the special string
`<DATAROOTDIR>`, then that string is automatically replaced by the value of
`CMAKE_INSTALL_DATAROOTDIR`.
NOTE: If setting one of these directory variables to a relative path using the
CMake command line, you must specify that the variable is of type `PATH`.
For example:
cmake -DCMAKE_INSTALL_LIBDIR:PATH=lib
Otherwise, CMake will assume that the path is relative to the build directory
rather than the install directory.
Creating Distribution Packages

View File

@ -70,72 +70,58 @@ message(STATUS "${BITS}-bit build (${CPU_TYPE})")
if(WIN32)
if(MSVC)
set(DEFAULT_CMAKE_INSTALL_PREFIX "c:/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}")
else()
set(DEFAULT_CMAKE_INSTALL_PREFIX "c:/${CMAKE_PROJECT_NAME}-gcc")
set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}-gcc")
endif()
if(BITS EQUAL 64)
set(DEFAULT_CMAKE_INSTALL_PREFIX "${DEFAULT_CMAKE_INSTALL_PREFIX}64")
set(CMAKE_INSTALL_DEFAULT_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}64")
endif()
else()
set(DEFAULT_CMAKE_INSTALL_PREFIX /opt/${CMAKE_PROJECT_NAME})
set(CMAKE_INSTALL_DEFAULT_PREFIX /opt/${CMAKE_PROJECT_NAME})
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${DEFAULT_CMAKE_INSTALL_PREFIX}" CACHE PATH
"Directory into which to install ${CMAKE_PROJECT_NAME} (default: ${DEFAULT_CMAKE_INSTALL_PREFIX})"
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}" CACHE PATH
"Directory into which to install ${CMAKE_PROJECT_NAME} (default: ${CMAKE_INSTALL_DEFAULT_PREFIX})"
FORCE)
endif()
set(DEFAULT_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
set(BINDIR ${DEFAULT_BINDIR} CACHE PATH
"Directory into which executables and scripts should be installed (default: ${DEFAULT_BINDIR})")
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
# When the prefix is /opt/${CMAKE_PROJECT_NAME}, we assume that an "official"
# build is being created, and thus we install things into specific locations.
if(CMAKE_INSTALL_PREFIX STREQUAL "${DEFAULT_CMAKE_INSTALL_PREFIX}" OR NOT UNIX)
set(DEFAULT_DATADIR ${CMAKE_INSTALL_PREFIX})
else()
set(DEFAULT_DATADIR ${CMAKE_INSTALL_PREFIX}/share)
if(CMAKE_INSTALL_PREFIX STREQUAL "${CMAKE_INSTALL_DEFAULT_PREFIX}" OR NOT UNIX)
set(CMAKE_INSTALL_DEFAULT_DATAROOTDIR "")
set(CMAKE_INSTALL_DEFAULT_DOCDIR "doc")
set(CMAKE_INSTALL_DEFAULT_JAVADIR "classes")
endif()
set(DATADIR ${DEFAULT_DATADIR} CACHE PATH
"Directory under which Java classes, docs, and man pages should be installed (default: ${DEFAULT_DATADIR})")
if(CMAKE_INSTALL_PREFIX STREQUAL "${DEFAULT_CMAKE_INSTALL_PREFIX}" OR NOT UNIX)
set(DEFAULT_DOCDIR ${DATADIR}/doc)
else()
set(DEFAULT_DOCDIR ${DATADIR}/doc/${CMAKE_PROJECT_NAME})
endif()
set(DOCDIR ${DEFAULT_DOCDIR} CACHE PATH
"Directory into which docs should be installed (default: ${DEFAULT_DOCDIR})")
set(DEFAULT_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
set(INCLUDEDIR ${DEFAULT_INCLUDEDIR} CACHE PATH
"Directory into which include files should be installed (default: ${DEFAULT_INCLUDEDIR})")
if(CMAKE_INSTALL_PREFIX STREQUAL "${DEFAULT_CMAKE_INSTALL_PREFIX}" AND UNIX AND
NOT APPLE)
if(BITS EQUAL 64)
set(DEFAULT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib64)
else()
set(DEFAULT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib32)
if(CMAKE_INSTALL_PREFIX STREQUAL "${CMAKE_INSTALL_DEFAULT_PREFIX}" AND UNIX)
if(NOT APPLE)
if(BITS EQUAL 64)
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64")
else()
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib32")
endif()
endif()
else()
set(DEFAULT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_INSTALL_DEFAULT_MANDIR "man")
endif()
set(LIBDIR ${DEFAULT_LIBDIR} CACHE PATH
"Directory into which libraries should be installed (default: ${DEFAULT_LIBDIR})")
set(CMAKE_INSTALL_RPATH ${LIBDIR})
foreach(var CMAKE_INSTALL_PREFIX BINDIR DATADIR DOCDIR INCLUDEDIR LIBDIR)
message(STATUS "${var} = ${${var}}")
endforeach()
include(cmakescripts/GNUInstallDirs.cmake)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR")
if(UNIX)
set(DEFAULT_MANDIR ${DATADIR}/man)
set(MANDIR ${DEFAULT_MANDIR} CACHE PATH
"Directory into which man pages should be installed (default: ${DEFAULT_MANDIR})")
message(STATUS "MANDIR = ${MANDIR}")
list(APPEND DIRLIST "MANDIR")
endif()
foreach(var ${DIRLIST})
if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var})
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}")
else()
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})")
endif()
mark_as_advanced(CLEAR CMAKE_INSTALL_${var})
endforeach()
###############################################################################
@ -1280,55 +1266,58 @@ endif()
if(WITH_TURBOJPEG)
if(ENABLE_SHARED)
install(TARGETS turbojpeg tjbench
ARCHIVE DESTINATION ${LIBDIR}
LIBRARY DESTINATION ${LIBDIR}
RUNTIME DESTINATION ${BINDIR})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if(ENABLE_STATIC)
install(TARGETS turbojpeg-static ARCHIVE DESTINATION ${LIBDIR})
install(TARGETS turbojpeg-static ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT ENABLE_SHARED)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static${EXE}
DESTINATION ${BINDIR} RENAME tjbench${EXE})
DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME tjbench${EXE})
endif()
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg.h
DESTINATION ${INCLUDEDIR})
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
if(ENABLE_STATIC)
install(TARGETS jpeg-static ARCHIVE DESTINATION ${LIBDIR})
install(TARGETS jpeg-static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT ENABLE_SHARED)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static${EXE}
DESTINATION ${BINDIR} RENAME cjpeg${EXE})
DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME cjpeg${EXE})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static${EXE}
DESTINATION ${BINDIR} RENAME djpeg${EXE})
DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME djpeg${EXE})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static${EXE}
DESTINATION ${BINDIR} RENAME jpegtran${EXE})
DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME jpegtran${EXE})
endif()
endif()
install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION ${BINDIR})
install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.ijg
${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/example.c
${CMAKE_CURRENT_SOURCE_DIR}/libjpeg.txt
${CMAKE_CURRENT_SOURCE_DIR}/structure.txt
${CMAKE_CURRENT_SOURCE_DIR}/usage.txt ${CMAKE_CURRENT_SOURCE_DIR}/wizard.txt
${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md DESTINATION ${DOCDIR})
${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
if(UNIX)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cjpeg.1
${CMAKE_CURRENT_SOURCE_DIR}/djpeg.1 ${CMAKE_CURRENT_SOURCE_DIR}/jpegtran.1
${CMAKE_CURRENT_SOURCE_DIR}/rdjpgcom.1
${CMAKE_CURRENT_SOURCE_DIR}/wrjpgcom.1 DESTINATION ${MANDIR}/man1)
${CMAKE_CURRENT_SOURCE_DIR}/wrjpgcom.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libjpeg.pc
${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libturbojpeg.pc
DESTINATION ${LIBDIR}/pkgconfig)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h
${CMAKE_CURRENT_SOURCE_DIR}/jerror.h ${CMAKE_CURRENT_SOURCE_DIR}/jmorecfg.h
${CMAKE_CURRENT_SOURCE_DIR}/jpeglib.h DESTINATION ${INCLUDEDIR})
${CMAKE_CURRENT_SOURCE_DIR}/jpeglib.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
include(cmakescripts/BuildPackages.cmake)

View File

@ -0,0 +1,423 @@
#.rst:
# GNUInstallDirs
# --------------
#
# Define GNU standard installation directories
#
# Provides install directory variables as defined by the
# `GNU Coding Standards`_.
#
# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# Inclusion of this module defines the following variables:
#
# ``CMAKE_INSTALL_<dir>``
#
# Destination for files of a given type. This value may be passed to
# the ``DESTINATION`` options of :command:`install` commands for the
# corresponding file type.
#
# ``CMAKE_INSTALL_FULL_<dir>``
#
# The absolute path generated from the corresponding ``CMAKE_INSTALL_<dir>``
# value. If the value is not already an absolute path, an absolute path
# is constructed typically by prepending the value of the
# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some
# `special cases`_ as documented below.
#
# where ``<dir>`` is one of:
#
# ``BINDIR``
# user executables (``bin``)
# ``SBINDIR``
# system admin executables (``sbin``)
# ``LIBEXECDIR``
# program executables (``libexec``)
# ``SYSCONFDIR``
# read-only single-machine data (``etc``)
# ``SHAREDSTATEDIR``
# modifiable architecture-independent data (``com``)
# ``LOCALSTATEDIR``
# modifiable single-machine data (``var``)
# ``LIBDIR``
# object code libraries (``lib`` or ``lib64``
# or ``lib/<multiarch-tuple>`` on Debian)
# ``INCLUDEDIR``
# C header files (``include``)
# ``OLDINCLUDEDIR``
# C header files for non-gcc (``/usr/include``)
# ``DATAROOTDIR``
# read-only architecture-independent data root (``share``)
# ``DATADIR``
# read-only architecture-independent data (``DATAROOTDIR``)
# ``INFODIR``
# info documentation (``DATAROOTDIR/info``)
# ``LOCALEDIR``
# locale-dependent data (``DATAROOTDIR/locale``)
# ``MANDIR``
# man documentation (``DATAROOTDIR/man``)
# ``DOCDIR``
# documentation root (``DATAROOTDIR/doc/PROJECT_NAME``)
#
# If the includer does not define a value the above-shown default will be
# used and the value will appear in the cache for editing by the user.
#
# Special Cases
# ^^^^^^^^^^^^^
#
# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
#
# ``/``
#
# For ``<dir>`` other than the ``SYSCONFDIR`` and ``LOCALSTATEDIR``,
# the value of ``CMAKE_INSTALL_<dir>`` is prefixed with ``usr/`` if
# it is not user-specified as an absolute path. For example, the
# ``INCLUDEDIR`` value ``include`` becomes ``usr/include``.
# This is required by the `GNU Coding Standards`_, which state:
#
# When building the complete GNU system, the prefix will be empty
# and ``/usr`` will be a symbolic link to ``/``.
#
# ``/usr``
#
# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
# ``CMAKE_INSTALL_FULL_<dir>`` is computed by prepending just ``/``
# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
# becomes ``/etc``. This is required by the `GNU Coding Standards`_.
#
# ``/opt/...``
#
# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
# ``CMAKE_INSTALL_FULL_<dir>`` is computed by *appending* the prefix
# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
# becomes ``/etc/opt/...``. This is defined by the
# `Filesystem Hierarchy Standard`_.
#
# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
#
# Macros
# ^^^^^^
#
# .. command:: GNUInstallDirs_get_absolute_install_dir
#
# ::
#
# GNUInstallDirs_get_absolute_install_dir(absvar var)
#
# Set the given variable ``absvar`` to the absolute path contained
# within the variable ``var``. This is to allow the computation of an
# absolute path, accounting for all the special cases documented
# above. While this macro is used to compute the various
# ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
# allow users who create additional path variables to also compute
# absolute paths where necessary, using the same logic.
#=============================================================================
# Copyright 2016 D. R. Commander
# Copyright 2016 Dmitry Marakasov
# Copyright 2016 Roger Leigh
# Copyright 2015 Alex Turbov
# Copyright 2014 Rolf Eike Beer
# Copyright 2014 Daniele E. Domenichelli
# Copyright 2013 Dimitri John Ledkov
# Copyright 2011 Alex Neundorf
# Copyright 2011 Eric NOULARD
# Copyright 2011, 2013-2015 Kitware, Inc.
# Copyright 2011 Nikita Krupen'ko
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Installation directories
#
macro(set_dir var docstring)
# If CMAKE_INSTALL_PREFIX changes and CMAKE_INSTALL_*DIR is still set to the
# default value, then modify it accordingly. This presumes that the default
# value may change based on the prefix.
set(_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var} "")
if(NOT DEFINED CMAKE_INSTALL_${var})
set(_GNUInstallDirs_CMAKE_INSTALL_DEFAULT_${var} 1 CACHE INTERNAL
"CMAKE_INSTALL_${var} has default value")
elseif(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX AND
NOT "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" STREQUAL
"${CMAKE_INSTALL_PREFIX}" AND
_GNUInstallDirs_CMAKE_INSTALL_DEFAULT_${var} AND
"${_GNUInstallDirs_CMAKE_INSTALL_LAST_${var}}" STREQUAL
"${CMAKE_INSTALL_${var}}")
set(_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var} "FORCE")
endif()
set(CMAKE_INSTALL_${var} "${CMAKE_INSTALL_DEFAULT_${var}}" CACHE PATH
"${docstring} (Default: ${CMAKE_INSTALL_DEFAULT_${var}})"
${_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var}})
if(NOT "${CMAKE_INSTALL_${var}}" STREQUAL "${CMAKE_INSTALL_DEFAULT_${var}}")
unset(_GNUInstallDirs_CMAKE_INSTALL_DEFAULT_${var} CACHE)
endif()
# Save for next run
set(_GNUInstallDirs_CMAKE_INSTALL_LAST_${var} "${CMAKE_INSTALL_${var}}"
CACHE INTERNAL "CMAKE_INSTALL_${var} during last run")
endmacro()
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_BINDIR)
set(CMAKE_INSTALL_DEFAULT_BINDIR "bin")
endif()
set_dir(BINDIR "Directory into which user executables should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_SBINDIR)
set(CMAKE_INSTALL_DEFAULT_SBINDIR "sbin")
endif()
set_dir(SBINDIR
"Directory into which system admin executables should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LIBEXECDIR)
set(CMAKE_INSTALL_DEFAULT_LIBEXECDIR "libexec")
endif()
set_dir(LIBEXECDIR
"Directory under which executables run by other programs should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_SYSCONFDIR)
set(CMAKE_INSTALL_DEFAULT_SYSCONFDIR "etc")
endif()
set_dir(SYSCONFDIR
"Directory into which machine-specific read-only ASCII data and configuration files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_SHAREDSTATEDIR)
set(CMAKE_INSTALL_DEFAULT_SHAREDSTATEDIR "com")
endif()
set_dir(SHAREDSTATEDIR
"Directory into which architecture-independent run-time-modifiable data files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LOCALSTATEDIR)
set(CMAKE_INSTALL_DEFAULT_LOCALSTATEDIR "var")
endif()
set_dir(LOCALSTATEDIR
"Directory into which machine-specific run-time-modifiable data files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LIBDIR)
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib")
# Override this default 'lib' with 'lib64' iff:
# - we are on Linux system but NOT cross-compiling
# - we are NOT on debian
# - we are on a 64 bits system
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
# and CMAKE_INSTALL_PREFIX is "/usr"
# See http://wiki.debian.org/Multiarch
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
AND NOT CMAKE_CROSSCOMPILING)
if (EXISTS "/etc/debian_version") # is this a debian system ?
if(CMAKE_LIBRARY_ARCHITECTURE)
if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
endif()
else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
message(AUTHOR_WARNING
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
"Please enable at least one language before including GNUInstallDirs.")
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64")
endif()
endif()
endif()
endif()
endif()
set_dir(LIBDIR
"Directory into which object files and object code libraries should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_INCLUDEDIR)
set(CMAKE_INSTALL_DEFAULT_INCLUDEDIR "include")
endif()
set_dir(INCLUDEDIR "Directory into which C header files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_OLDINCLUDEDIR)
set(CMAKE_INSTALL_DEFAULT_OLDINCLUDEDIR "/usr/include")
endif()
set_dir(OLDINCLUDEDIR
PATH "Directory into which C header files for non-GCC compilers should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_DATAROOTDIR)
set(CMAKE_INSTALL_DEFAULT_DATAROOTDIR "share")
endif()
set_dir(DATAROOTDIR
"The root of the directory tree for read-only architecture-independent data files")
#-----------------------------------------------------------------------------
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
# the cache and store the defaults in local variables if the cache values are
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_DATADIR)
set(CMAKE_INSTALL_DEFAULT_DATADIR "<DATAROOTDIR>")
endif()
set_dir(DATADIR
"The directory under which read-only architecture-independent data files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_INFODIR)
if(CMAKE_SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$")
set(CMAKE_INSTALL_DEFAULT_INFODIR "info")
else()
set(CMAKE_INSTALL_DEFAULT_INFODIR "<DATAROOTDIR>/info")
endif()
endif()
set_dir(INFODIR
"The directory into which info documentation files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_MANDIR)
if(CMAKE_SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$")
set(CMAKE_INSTALL_DEFAULT_MANDIR "man")
else()
set(CMAKE_INSTALL_DEFAULT_MANDIR "<DATAROOTDIR>/man")
endif()
endif()
set_dir(MANDIR "The directory under which man pages should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_LOCALEDIR)
set(CMAKE_INSTALL_DEFAULT_LOCALEDIR "<DATAROOTDIR>/locale")
endif()
set_dir(LOCALEDIR
"The directory under which locale-specific message catalogs should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_DOCDIR)
set(CMAKE_INSTALL_DEFAULT_DOCDIR "<DATAROOTDIR>/doc/${PROJECT_NAME}")
endif()
set_dir(DOCDIR
"The directory into which documentation files (other than info files) should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_JAVADIR)
set(CMAKE_INSTALL_DEFAULT_JAVADIR "<DATAROOTDIR>/java")
endif()
set_dir(JAVADIR "The directory into which Java classes should be installed")
string(REGEX REPLACE "<DATAROOTDIR>" "${CMAKE_INSTALL_DATAROOTDIR}"
CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}")
foreach(var INFODIR MANDIR LOCALEDIR DOCDIR JAVADIR)
if(NOT CMAKE_INSTALL_DATAROOTDIR)
string(REGEX REPLACE "<DATAROOTDIR>/" "${CMAKE_INSTALL_DATAROOTDIR}"
CMAKE_INSTALL_${var} "${CMAKE_INSTALL_${var}}")
else()
string(REGEX REPLACE "<DATAROOTDIR>" "${CMAKE_INSTALL_DATAROOTDIR}"
CMAKE_INSTALL_${var} "${CMAKE_INSTALL_${var}}")
endif()
endforeach()
# Save for next run
set(_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "CMAKE_INSTALL_PREFIX during last run")
#-----------------------------------------------------------------------------
mark_as_advanced(
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_SBINDIR
CMAKE_INSTALL_LIBEXECDIR
CMAKE_INSTALL_SYSCONFDIR
CMAKE_INSTALL_SHAREDSTATEDIR
CMAKE_INSTALL_LOCALSTATEDIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_OLDINCLUDEDIR
CMAKE_INSTALL_DATAROOTDIR
CMAKE_INSTALL_DATADIR
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_DOCDIR
CMAKE_INSTALL_JAVADIR
)
macro(GNUInstallDirs_get_absolute_install_dir absvar var)
if(NOT IS_ABSOLUTE "${${var}}")
# Handle special cases:
# - CMAKE_INSTALL_PREFIX == /
# - CMAKE_INSTALL_PREFIX == /usr
# - CMAKE_INSTALL_PREFIX == /opt/...
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
set(${absvar} "/${${var}}")
else()
if (NOT "${${var}}" MATCHES "^usr/")
set(${var} "usr/${${var}}")
endif()
set(${absvar} "/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
set(${absvar} "/${${var}}")
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}")
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
else()
set(${absvar} "${${var}}")
endif()
string(REGEX REPLACE "/$" "" ${absvar} "${${absvar}}")
endmacro()
# Result directories
#
foreach(dir
BINDIR
SBINDIR
LIBEXECDIR
SYSCONFDIR
SHAREDSTATEDIR
LOCALSTATEDIR
LIBDIR
INCLUDEDIR
OLDINCLUDEDIR
DATAROOTDIR
DATADIR
INFODIR
LOCALEDIR
MANDIR
DOCDIR
JAVADIR
)
GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
endforeach()

View File

@ -54,4 +54,11 @@ add_jar(turbojpeg-java ${JAVA_SOURCES} OUTPUT_NAME turbojpeg
if(MSYS)
set(CMAKE_HOST_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME})
endif()
install_jar(turbojpeg-java ${DATADIR}/classes)
if(CMAKE_INSTALL_JAVADIR STREQUAL CMAKE_INSTALL_FULL_JAVADIR)
message(STATUS "CMAKE_INSTALL_JAVADIR = ${CMAKE_INSTALL_JAVADIR}")
else()
message(STATUS "CMAKE_INSTALL_JAVADIR = ${CMAKE_INSTALL_JAVADIR} (${CMAKE_INSTALL_FULL_JAVADIR})")
endif()
install_jar(turbojpeg-java ${CMAKE_INSTALL_JAVADIR})
mark_as_advanced(CLEAR CMAKE_INSTALL_JAVADIR)

View File

@ -36,19 +36,19 @@ final class TJLoader {
String os = System.getProperty("os.name").toLowerCase();
if (os.indexOf("mac") >= 0) {
try {
System.load("@LIBDIR@/libturbojpeg.jnilib");
System.load("@CMAKE_INSTALL_FULL_LIBDIR@/libturbojpeg.jnilib");
} catch (java.lang.UnsatisfiedLinkError e2) {
System.load("/usr/lib/libturbojpeg.jnilib");
}
} else {
try {
System.load("@LIBDIR@/libturbojpeg.so");
System.load("@CMAKE_INSTALL_FULL_LIBDIR@/libturbojpeg.so");
} catch (java.lang.UnsatisfiedLinkError e3) {
String libdir = "@LIBDIR@";
if (libdir.equals("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib64")) {
System.load("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib32/libturbojpeg.so");
} else if (libdir.equals("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib32")) {
System.load("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib64/libturbojpeg.so");
String libdir = "@CMAKE_INSTALL_FULL_LIBDIR@";
if (libdir.equals("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib64")) {
System.load("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib32/libturbojpeg.so");
} else if (libdir.equals("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib32")) {
System.load("@CMAKE_INSTALL_DEFAULT_PREFIX@/lib64/libturbojpeg.so");
} else {
throw e3;
}

View File

@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@LIBDIR@
includedir=@INCLUDEDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: libjpeg
Description: A SIMD-accelerated JPEG codec that provides the libjpeg API

View File

@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@LIBDIR@
includedir=@INCLUDEDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: libturbojpeg
Description: A SIMD-accelerated JPEG codec that provides the TurboJPEG API

View File

@ -46,15 +46,15 @@ VERSION=@VERSION@
BUILD=@BUILD@
PREFIX=@CMAKE_INSTALL_PREFIX@
DOCDIR=@DOCDIR@
LIBDIR=@LIBDIR@
DOCDIR=@CMAKE_INSTALL_FULL_DOCDIR@
LIBDIR=@CMAKE_INSTALL_FULL_LIBDIR@
umask 022
rm -f $PACKAGE_NAME-$VERSION-$BUILD.tar.bz2
TMPDIR=`mktemp -d /tmp/ljtbuild.XXXXXX`
__PWD=`pwd`
make install DESTDIR=$TMPDIR/pkg
if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
if [ "$PREFIX" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a "$DOCDIR" = "@CMAKE_INSTALL_DEFAULT_PREFIX@/doc" ]; then
safedirmove $TMPDIR/pkg$DOCDIR $TMPDIR/pkg/usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/__tmpdoc
ln -fs /usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/pkg$DOCDIR
fi

View File

@ -67,15 +67,16 @@ makedeb()
rm -rf $TMPDIR$BINDIR
if [ "$DATADIR" != "$PREFIX" ]; then
rm -rf $TMPDIR$DATADIR
else
rm -rf $TMPDIR$PREFIX/classes
fi
if [ "$JAVADIR" != "" ]; then
rm -rf $TMPDIR$JAVADIR
fi
rm -rf $TMPDIR$DOCDIR
rm -rf $TMPDIR$INCLUDEDIR
rm -rf $TMPDIR$MANDIR
else
make install DESTDIR=$TMPDIR
if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
if [ "$PREFIX" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a "$DOCDIR" = "@CMAKE_INSTALL_DEFAULT_PREFIX@/doc" ]; then
safedirmove $TMPDIR/$DOCDIR $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/__tmpdoc
ln -fs /usr/share/doc/$DIRNAME-$VERSION $TMPDIR$DOCDIR
fi
@ -96,12 +97,13 @@ PACKAGE_NAME=@PKGNAME@
VERSION=@VERSION@
DEBARCH=@DEBARCH@
PREFIX=@CMAKE_INSTALL_PREFIX@
BINDIR=@BINDIR@
DATADIR=@DATADIR@
DOCDIR=@DOCDIR@
INCLUDEDIR=@INCLUDEDIR@
LIBDIR=@LIBDIR@
MANDIR=@MANDIR@
BINDIR=@CMAKE_INSTALL_FULL_BINDIR@
DATADIR=@CMAKE_INSTALL_FULL_DATADIR@
DOCDIR=@CMAKE_INSTALL_FULL_DOCDIR@
INCLUDEDIR=@CMAKE_INSTALL_FULL_INCLUDEDIR@
JAVADIR=@CMAKE_INSTALL_FULL_JAVADIR@
LIBDIR=@CMAKE_INSTALL_FULL_LIBDIR@
MANDIR=@CMAKE_INSTALL_FULL_MANDIR@
if [ ! `uid` -eq 0 ]; then
SUDO=sudo

View File

@ -61,9 +61,9 @@ WITH_JAVA=@WITH_JAVA@
LIPO=lipo
PREFIX=@CMAKE_INSTALL_PREFIX@
BINDIR=@BINDIR@
DOCDIR=@DOCDIR@
LIBDIR=@LIBDIR@
BINDIR=@CMAKE_INSTALL_FULL_BINDIR@
DOCDIR=@CMAKE_INSTALL_FULL_DOCDIR@
LIBDIR=@CMAKE_INSTALL_FULL_LIBDIR@
LIBJPEG_DSO_NAME=libjpeg.@SO_MAJOR_VERSION@.@SO_AGE@.@SO_MINOR_VERSION@.dylib
TURBOJPEG_DSO_NAME=libturbojpeg.@TURBOJPEG_SO_VERSION@.dylib
@ -98,7 +98,7 @@ mkdir -p $PKGROOT
make install DESTDIR=$PKGROOT
if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
if [ "$PREFIX" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a "$DOCDIR" = "@CMAKE_INSTALL_DEFAULT_PREFIX@/doc" ]; then
mkdir -p $PKGROOT/Library/Documentation
safedirmove $PKGROOT$DOCDIR $PKGROOT/Library/Documentation/@CMAKE_PROJECT_NAME@ $TMPDIR/__tmpdoc
ln -fs /Library/Documentation/@CMAKE_PROJECT_NAME@ $PKGROOT$DOCDIR
@ -238,7 +238,7 @@ install_name_tool -id $LIBDIR/$TURBOJPEG_DSO_NAME $PKGROOT/$LIBDIR/$TURBOJPEG_DS
if [ $WITH_JAVA = 1 ]; then
ln -fs $TURBOJPEG_DSO_NAME $PKGROOT/$LIBDIR/libturbojpeg.jnilib
fi
if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$LIBDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/lib" ]; then
if [ "$PREFIX" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a "$LIBDIR" = "@CMAKE_INSTALL_DEFAULT_PREFIX@/lib" ]; then
if [ ! -h $PKGROOT/$PREFIX/lib32 ]; then
ln -fs lib $PKGROOT/$PREFIX/lib32
fi

View File

@ -1,10 +1,11 @@
%define _prefix @CMAKE_INSTALL_PREFIX@
%define _bindir @BINDIR@
%define _datadir @DATADIR@
%define _bindir @CMAKE_INSTALL_FULL_BINDIR@
%define _datadir @CMAKE_INSTALL_FULL_DATADIR@
%define _docdir %{_defaultdocdir}/%{name}-%{version}
%define _includedir @INCLUDEDIR@
%define _libdir @LIBDIR@
%define _mandir @MANDIR@
%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@
@ -54,15 +55,20 @@ broader range of users and developers.
#-->%build
#-->cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ \
#--> -DBUILD=%{release} \
#--> -DCMAKE_INSTALL_BINDIR=%{_bindir} \
#--> -DCMAKE_INSTALL_DATADIR=%{_datadir} \
#--> -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@ \
#--> -DBINDIR=%{_bindir} -DBUILD=%{release} -DDATADIR=%{_datadir} \
#--> -DDOCDIR=%{_docdir} \
#--> -DENABLE_SHARED=@ENABLE_SHARED@ -DENABLE_STATIC=@ENABLE_STATIC@ \
#--> -DSO_MAJOR_VERSION=@SO_MAJOR_VERSION@ \
#--> -DSO_MINOR_VERSION=@SO_MINOR_VERSION@ \
#--> -DENABLE_SHARED=@ENABLE_SHARED@ -DENABLE_STATIC=@ENABLE_STATIC@ \
#--> -DINCLUDEDIR=%{_includedir} -DJPEG_LIB_VERSION=@JPEG_LIB_VERSION@ \
#--> -DLIBDIR=%{_libdir} -DMANDIR=%{_mandir} \
#--> -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@ \
@ -109,15 +115,15 @@ safedirmove ()
return 0
}
LJT_DOCDIR=@DOCDIR@
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=@DOCDIR@
if [ "%{_prefix}" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$LJT_DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
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
@ -133,7 +139,7 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_docdir}
%doc %{_docdir}/*
%dir %{_prefix}
%if "%{_prefix}" == "@DEFAULT_CMAKE_INSTALL_PREFIX@" && "%{_docdir}" != "%{_prefix}/doc"
%if "%{_prefix}" == "@CMAKE_INSTALL_DEFAULT_PREFIX@" && "%{_docdir}" != "%{_prefix}/doc"
%{_prefix}/doc
%endif
%dir %{_bindir}
@ -186,7 +192,7 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_datadir}
%endif
%if "%{_with_java}" == "1"
%dir %{_datadir}/classes
%{_datadir}/classes/turbojpeg.jar
%dir %{_javadir}
%{_javadir}/turbojpeg.jar
%endif
%changelog

View File

@ -57,11 +57,12 @@ popd
echo Removing package directories ...
PREFIX=@CMAKE_INSTALL_PREFIX@
BINDIR=@BINDIR@
DATADIR=@DATADIR@
INCLUDEDIR=@INCLUDEDIR@
LIBDIR=@LIBDIR@
MANDIR=@MANDIR@
BINDIR=@CMAKE_INSTALL_FULL_BINDIR@
DATADIR=@CMAKE_INSTALL_FULL_DATADIR@
INCLUDEDIR=@CMAKE_INSTALL_FULL_INCLUDEDIR@
JAVADIR=@CMAKE_INSTALL_FULL_JAVADIR@
LIBDIR=@CMAKE_INSTALL_FULL_LIBDIR@
MANDIR=@CMAKE_INSTALL_FULL_MANDIR@
if [ -d $BINDIR ]; then
rmdir $BINDIR 2>&1 || EXITSTATUS=-1
@ -75,7 +76,7 @@ fi
if [ -d $INCLUDEDIR ]; then
rmdir $INCLUDEDIR 2>&1 || EXITSTATUS=-1
fi
if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$LIBDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/lib" ]; then
if [ "$PREFIX" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a "$LIBDIR" = "@CMAKE_INSTALL_DEFAULT_PREFIX@/lib" ]; then
if [ -h $LIBDIR\32 ]; then
rm $LIBDIR\32 2>&1 || EXITSTATUS=-1
fi
@ -89,13 +90,13 @@ fi
if [ -d $MANDIR ]; then
rmdir $MANDIR 2>&1 || EXITSTATUS=-1
fi
if [ -d $DATADIR/classes ]; then
rmdir $DATADIR/classes 2>&1 || EXITSTATUS=-1
if [ -d $JAVADIR ]; then
rmdir $JAVADIR 2>&1 || EXITSTATUS=-1
fi
if [ -d $DATADIR -a "$DATADIR" != "$PREFIX" ]; then
rmdir $DATADIR 2>&1 || EXITSTATUS=-1
fi
if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a -h "$PREFIX/doc" ]; then
if [ "$PREFIX" = "@CMAKE_INSTALL_DEFAULT_PREFIX@" -a -h "$PREFIX/doc" ]; then
rm $PREFIX/doc 2>&1 || EXITSTATUS=-1
fi
rmdir $PREFIX 2>&1 || EXITSTATUS=-1

View File

@ -84,6 +84,6 @@ add_executable(jcstest ../jcstest.c)
target_link_libraries(jcstest jpeg)
install(TARGETS jpeg cjpeg djpeg jpegtran
ARCHIVE DESTINATION ${LIBDIR}
LIBRARY DESTINATION ${LIBDIR}
RUNTIME DESTINATION ${BINDIR})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})