From 8c037305e4df39b50fbb80f869894a3ec8801f4f Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 23 Aug 2010 17:07:32 -0500 Subject: [PATCH] [devel] Updated CMakeLists.txt to use CMAKE_INSTALL_LIBDIR variable; useful for installing libpng in /usr/lib64 (Funda Wang). Also ported other recent changes from libpng-1.4.4beta07: Revised CMakeLists.txt to put the man pages in share/man/man* not man/man* Revised CMakeLists.txt to make symlinks instead of copies when installing. Changed PNG_LIB_NAME from pngNN to libpngNN in CMakeLists.txt (Philip Lowman) --- ANNOUNCE | 25 ++++++++++------ CHANGES | 9 +++++- CMakeLists.txt | 80 +++++++++++++++++++++++++++++++++++--------------- 3 files changed, 80 insertions(+), 34 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index fdc05012c..7383341fb 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.5.0beta43 - August 11, 2010 +Libpng 1.5.0beta44 - August 11, 2010 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -9,20 +9,20 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - 1.5.0beta43.tar.xz (LZMA-compressed, recommended) - 1.5.0beta43.tar.gz - 1.5.0beta43.tar.bz2 + 1.5.0beta44.tar.xz (LZMA-compressed, recommended) + 1.5.0beta44.tar.gz + 1.5.0beta44.tar.bz2 Source files with CRLF line endings (for Windows), without the "configure" script - lp150b43.zip - lp150b43.7z + lp150b44.zip + lp150b44.7z Other information: - 1.5.0beta43-README.txt - 1.5.0beta43-LICENSE.txt + 1.5.0beta44-README.txt + 1.5.0beta44-LICENSE.txt Changes since the last public release (1.4.1): @@ -349,7 +349,7 @@ version 1.5.0beta42 [August 18, 2010] Made all API functions that have const arguments and constant string literal pointers declare them (John Bowler). -version 1.5.0beta43 [August 11, 2010] +Version 1.5.0beta43 [August 20, 2010] Removed spurious tabs, shorten long lines (no source change) Also added scripts/chkfmt to validate the format of all the files that can reasonably be validated (it is suggested to run "make distclean" before @@ -362,6 +362,13 @@ version 1.5.0beta43 [August 11, 2010] in an earlier update. Fixed to declare the auto variables at the head. Use cexcept.h in pngvalid.c. +Version 1.5.0beta44 [August 11, 2010] + Updated CMakeLists.txt to use CMAKE_INSTALL_LIBDIR variable; useful for + installing libpng in /usr/lib64 (Funda Wang). + Revised CMakeLists.txt to put the man pages in share/man/man* not man/man* + Revised CMakeLists.txt to make symlinks instead of copies when installing. + Changed PNG_LIB_NAME from pngNN to libpngNN in CMakeLists.txt (Philip Lowman) + Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/CHANGES b/CHANGES index 78844c79f..1d1b67ece 100644 --- a/CHANGES +++ b/CHANGES @@ -2986,7 +2986,7 @@ Version 1.5.0beta42 [August 18, 2010] Made all API functions that have const arguments and constant string literal pointers declare them (John Bowler). -Version 1.5.0beta43 [August 11, 2010] +Version 1.5.0beta43 [August 20, 2010] Removed spurious tabs, shorten long lines (no source change) Also added scripts/chkfmt to validate the format of all the files that can reasonably be validated (it is suggested to run "make distclean" before @@ -2999,6 +2999,13 @@ Version 1.5.0beta43 [August 11, 2010] in an earlier update. Fixed to declare the auto variables at the head. Use cexcept.h in pngvalid.c. +Version 1.5.0beta44 [August 11, 2010] + Updated CMakeLists.txt to use CMAKE_INSTALL_LIBDIR variable; useful for + installing libpng in /usr/lib64 (Funda Wang). + Revised CMakeLists.txt to put the man pages in share/man/man* not man/man* + Revised CMakeLists.txt to make symlinks instead of copies when installing. + Changed PNG_LIB_NAME from pngNN to libpngNN in CMakeLists.txt (Philip Lowman) + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/CMakeLists.txt b/CMakeLists.txt index 689d165b8..874c8cd35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ else() endif() # SET LIBNAME -set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) +set(PNG_LIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) # to distinguish between debug and release lib set(CMAKE_DEBUG_POSTFIX "d") @@ -101,7 +101,7 @@ set(CMAKE_DEBUG_POSTFIX "d") set(libpng_sources png.h pngconf.h - pngpriv.h + pngpriv.h png.c pngerror.c pngget.c @@ -123,8 +123,14 @@ set(pngtest_sources ) # SOME NEEDED DEFINITIONS +add_definitions(-DPNG_CONFIGURE_LIBPNG) + +if(_AIX) + add_definitions(-D_ALL_SOURCE) +endif(_AIX) + if(MSVC) - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE) endif(MSVC) if(PNG_SHARED OR NOT MSVC) @@ -146,7 +152,7 @@ if(PNG_NO_STDIO) endif() if(PNG_DEBUG) - add_definitions(-DPNG_DEBUG=1) + add_definitions(-DPNG_DEBUG) endif() if(NOT M_LIBRARY AND NOT WIN32) @@ -190,24 +196,36 @@ endif() # CREATE PKGCONFIG FILES # we use the same files like ./configure, so we have to set its vars +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) +endif(NOT DEFINED CMAKE_INSTALL_LIBDIR) set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX}) -set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(libdir ${CMAKE_INSTALL_LIBDIR}) set(includedir ${CMAKE_INSTALL_PREFIX}/include) +set(LIBS "-lz -lm") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in - ${CMAKE_CURRENT_BINARY_DIR}/libpng-config) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) +install(CODE " + MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}.pc to libpng.pc\") + execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink + \"${PNGLIB_NAME}.pc\" + \"libpng.pc\") +") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in + ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) +install(CODE " + MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}-config to libpng-config\") + execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink + \"${PNGLIB_NAME}-config\" + \"libpng-config\") +") # SET UP LINKS if(PNG_SHARED) set_target_properties(${PNG_LIB_NAME} PROPERTIES -# VERSION 15.${PNGLIB_RELEASE}.1.5.0beta43 +# VERSION 15.${PNGLIB_RELEASE}.1.5.0beta44 VERSION 15.${PNGLIB_RELEASE}.0 SOVERSION 15 CLEAN_DIRECT_OUTPUT 1) @@ -226,13 +244,27 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) if(PNG_SHARED) install(TARGETS ${PNG_LIB_NAME} RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(CODE " + MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to libpng${CMAKE_SHARED_LIBRARY_SUFFIX}\") + execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink + \"${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\" + \"libpng${CMAKE_SHARED_LIBRARY_SUFFIX}\") + ") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() if(PNG_STATIC) install(TARGETS ${PNG_LIB_NAME_STATIC} - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(CODE " + MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} to libpng${CMAKE_STATIC_LIBRARY_SUFFIX}\") + execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink + \"${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}\" + \"libpng${CMAKE_STATIC_LIBRARY_SUFFIX}\") + ") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() endif() @@ -247,16 +279,16 @@ if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL ) endif() if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) # Install man pages - install(FILES libpng.3 libpngpf.3 DESTINATION man/man3) - install(FILES png.5 DESTINATION man/man5) + install(FILES libpng.3 libpngpf.3 DESTINATION share/man/man3) + install(FILES png.5 DESTINATION share/man/man5) # Install pkg-config files install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc - DESTINATION lib/pkgconfig) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng-config + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc - DESTINATION lib/pkgconfig) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) endif()