From 4edbb4da81626a7342a22824d7a8f60a3ea71bd0 Mon Sep 17 00:00:00 2001 From: Cosmin Truta Date: Mon, 22 Jan 2024 17:24:59 +0200 Subject: [PATCH] build: Move scripts/*.cmake.in to scripts/cmake/; add cmake/AUTHORS.md From the libpng licensing point of view, the build projects, the build scripts, the test scripts, the CI verification scripts, et cetera, have not traditionally been part of libpng proper, although some of these, including the CMake-based build, have been released under the libpng license. Considering how the CMake build grew as a result of many contributions from many contributing authors over a long time, one may argue that it almost became an individual piece of software in its own right. Moving on, everything CMake-related shall be placed in the subdirectory scripts/cmake/ (except, of course, the main CMakeLists.txt). Moreover, contributing authors shall be acknowledged in scripts/cmake/AUTHORS.md. Please see scripts/cmake/README.md for more information. --- CMakeLists.txt | 70 +++++++++++------------------ scripts/cmake/AUTHORS.md | 35 +++++++++++++++ scripts/cmake/README.md | 35 +++++++++++++++ scripts/{ => cmake}/genchk.cmake.in | 13 +++--- scripts/{ => cmake}/genout.cmake.in | 13 +++--- scripts/{ => cmake}/gensrc.cmake.in | 15 ++++--- scripts/{ => cmake}/test.cmake.in | 17 ++++--- 7 files changed, 132 insertions(+), 66 deletions(-) create mode 100644 scripts/cmake/AUTHORS.md create mode 100644 scripts/cmake/README.md rename scripts/{ => cmake}/genchk.cmake.in (82%) rename scripts/{ => cmake}/genout.cmake.in (91%) rename scripts/{ => cmake}/gensrc.cmake.in (94%) rename scripts/{ => cmake}/test.cmake.in (63%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a57e8364..2e559c072 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,37 +1,19 @@ -# CMakeLists.txt -# Copyright (c) 2018-2023 Cosmin Truta -# Copyright (c) 2007,2009-2018 Glenn Randers-Pehrson -# Written by Christian Ehrlicher, 2007 -# Revised by Roger Lowman, 2009-2010 -# Revised by Clifford Yapp, 2011-2012,2017 -# Revised by Claudio Bley, 2013 -# Revised by Roger Leigh, 2016 -# Revised by Andreas Franek, 2016 -# Revised by Sam Serrels, 2017 -# Revised by Vadim Barkov, 2017 -# Revised by Vicky Pfau, 2018 -# Revised by Cameron Cawley, 2018,2021 -# Revised by Kyle Bentley, 2018 -# Revised by David Callu, 2020 -# Revised by Steve Robinson, 2020 -# Revised by Simon Hausmann, 2020 -# Revised by Alex Gaynor, 2020 -# Revised by Owen Rudge, 2020 -# Revised by Gleb Mazovetskiy, 2021 -# Revised by Christopher Sean Morrison, 2022 -# Revised by B. Scott Michel, 2022 -# Revised by Jeremy Maitin-Shepard, 2022 -# Revised by Martin Storsjo, 2022 -# Revised by Jon Creighton, 2023 -# Revised by Gunther Nikl, 2023 -# Revised by Tyler Kropp, 2023 -# Revised by Timothy Lyanguzov, 2023 -# Revised by Clinton Ingram, 2023 - -# This code is released under the libpng license. -# For conditions of distribution and use, see the disclaimer -# and license in png.h +# CMakeLists.txt - CMake lists for libpng +# +# Copyright (c) 2018-2024 Cosmin Truta. +# Copyright (c) 2007-2018 Glenn Randers-Pehrson. +# Originally written by Christian Ehrlicher, 2007. +# +# Use, modification and distribution are subject to +# the same licensing terms and conditions as libpng. +# Please see the copyright notice in png.h or visit +# http://libpng.org/pub/png/src/libpng-LICENSE.txt +# +# For copyright and licensing purposes, please see +# the accompanying file scripts/cmake/AUTHORS.md +# +# SPDX-License-Identifier: libpng-2.0 cmake_minimum_required(VERSION 3.6) @@ -370,7 +352,7 @@ else() COMMAND "${CMAKE_COMMAND}" "-DINPUT=${_GC_INPUT}" "-DOUTPUT=${_GC_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake" DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endfunction() @@ -393,7 +375,7 @@ else() COMMAND "${CMAKE_COMMAND}" "-DINPUT=${_GO_INPUT}" "-DOUTPUT=${_GO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/genout.cmake" DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endfunction() @@ -412,7 +394,7 @@ else() add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}" COMMAND "${CMAKE_COMMAND}" "-DOUTPUT=${_GSO_OUTPUT}" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake" DEPENDS ${_GSO_DEPENDS} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") endfunction() @@ -542,7 +524,7 @@ else() add_custom_target(png_genprebuilt COMMAND "${CMAKE_COMMAND}" "-DOUTPUT=scripts/pnglibconf.h.prebuilt" - -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" + -P "${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") # A single target handles generation of all generated files. @@ -750,7 +732,7 @@ if(PNG_TESTS AND PNG_SHARED) set(TEST_OPTIONS "${_PAT_OPTIONS}") set(TEST_FILES "${_PAT_FILES}") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in" + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/test.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY) add_test(NAME "${_PAT_NAME}" @@ -984,14 +966,14 @@ function(create_symlink DEST_FILE) endfunction() # Create source generation scripts. -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genchk.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genout.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/genout.cmake @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/gensrc.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake @ONLY) # libpng is a library so default to 'lib' diff --git a/scripts/cmake/AUTHORS.md b/scripts/cmake/AUTHORS.md new file mode 100644 index 000000000..1c1173ab3 --- /dev/null +++ b/scripts/cmake/AUTHORS.md @@ -0,0 +1,35 @@ +CMake Files, Lists and Scripts for the PNG Reference Library +============================================================ + +Author List +----------- + + * Alex Gaynor + * Andreas Franek + * B. Scott Michel + * Cameron Cawley + * Christian Ehrlicher + * Christopher Sean Morrison + * Claudio Bley + * Clifford Yapp + * Clinton Ingram + * Cosmin Truta + * David Callu + * Gleb Mazovetskiy + * Glenn Randers-Pehrson + * Gunther Nikl + * Jeremy Maitin-Shepard + * John Bowler + * Jon Creighton + * Kyle Bentley + * Martin Storsjö + * Owen Rudge + * Roger Leigh + * Roger Lowman + * Sam Serrels + * Simon Hausmann + * Steve Robinson + * Timothy Lyanguzov + * Tyler Kropp + * Vadim Barkov + * Vicky Pfau diff --git a/scripts/cmake/README.md b/scripts/cmake/README.md new file mode 100644 index 000000000..ca418893a --- /dev/null +++ b/scripts/cmake/README.md @@ -0,0 +1,35 @@ +CMake Files, Lists and Scripts for the PNG Reference Library +============================================================ + +Copyright Notice +---------------- + + * Copyright (c) 2018-2024 Cosmin Truta. + * Copyright (c) 2007-2018 Glenn Randers-Pehrson. + * Originally written by Christian Ehrlicher, 2007. + +Use, modification and distribution of the CMake +files in the libpng distribution are subject to +the same licensing terms and conditions as libpng. +Please see the copyright notice in `png.h` or visit +http://libpng.org/pub/png/src/libpng-LICENSE.txt + +File List +--------- + + CMakeLists.txt ==> The main CMake lists file + scripts/cmake/AUTHORS.md ==> The Authors file + scripts/cmake/README.md ==> This file + scripts/cmake/genchk.cmake.in ==> Template for genchk.cmake + scripts/cmake/genout.cmake.in ==> Template for genout.cmake + scripts/cmake/gensrc.cmake.in ==> Template for gensrc.cmake + scripts/cmake/test.cmake.in ==> Template for test.cmake + +Acknowledgements +---------------- + +See the accompanying file `scripts/cmake/AUTHORS.md` +for the list of Contributing Authors. + +If you are a Contributing Author, please make sure +that you are being acknowledged. diff --git a/scripts/genchk.cmake.in b/scripts/cmake/genchk.cmake.in similarity index 82% rename from scripts/genchk.cmake.in rename to scripts/cmake/genchk.cmake.in index 4079ff1e6..5ea92dd73 100644 --- a/scripts/genchk.cmake.in +++ b/scripts/cmake/genchk.cmake.in @@ -1,13 +1,16 @@ # genchk.cmake.in # Generate .chk from .out with awk (generic), based upon the automake logic. -# Copyright (c) 2022-2023 Cosmin Truta +# Copyright (c) 2022-2024 Cosmin Truta # Copyright (c) 2016 Glenn Randers-Pehrson # Written by Roger Leigh, 2016 - -# This code is released under the libpng license. -# For conditions of distribution and use, see the disclaimer -# and license in png.h +# +# Use, modification and distribution are subject to +# the same licensing terms and conditions as libpng. +# Please see the copyright notice in png.h or visit +# http://libpng.org/pub/png/src/libpng-LICENSE.txt +# +# SPDX-License-Identifier: libpng-2.0 # Variables substituted from CMakeLists.txt set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@") diff --git a/scripts/genout.cmake.in b/scripts/cmake/genout.cmake.in similarity index 91% rename from scripts/genout.cmake.in rename to scripts/cmake/genout.cmake.in index 6c82672e3..ab8285968 100644 --- a/scripts/genout.cmake.in +++ b/scripts/cmake/genout.cmake.in @@ -1,13 +1,16 @@ # genout.cmake.in # Generate .out from .c with awk (generic), based upon the automake logic. -# Copyright (c) 2022-2023 Cosmin Truta +# Copyright (c) 2022-2024 Cosmin Truta # Copyright (c) 2016 Glenn Randers-Pehrson # Written by Roger Leigh, 2016 - -# This code is released under the libpng license. -# For conditions of distribution and use, see the disclaimer -# and license in png.h +# +# Use, modification and distribution are subject to +# the same licensing terms and conditions as libpng. +# Please see the copyright notice in png.h or visit +# http://libpng.org/pub/png/src/libpng-LICENSE.txt +# +# SPDX-License-Identifier: libpng-2.0 # Variables substituted from CMakeLists.txt set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@") diff --git a/scripts/gensrc.cmake.in b/scripts/cmake/gensrc.cmake.in similarity index 94% rename from scripts/gensrc.cmake.in rename to scripts/cmake/gensrc.cmake.in index 976c04333..52dab8d2b 100644 --- a/scripts/gensrc.cmake.in +++ b/scripts/cmake/gensrc.cmake.in @@ -1,13 +1,16 @@ # gensrc.cmake.in # Generate source files with awk, based upon the automake logic. -# Copyright (c) 2022-2023 Cosmin Truta +# Copyright (c) 2022-2024 Cosmin Truta # Copyright (c) 2016 Glenn Randers-Pehrson # Written by Roger Leigh, 2016 - -# This code is released under the libpng license. -# For conditions of distribution and use, see the disclaimer -# and license in png.h +# +# Use, modification and distribution are subject to +# the same licensing terms and conditions as libpng. +# Please see the copyright notice in png.h or visit +# http://libpng.org/pub/png/src/libpng-LICENSE.txt +# +# SPDX-License-Identifier: libpng-2.0 # Variables substituted from CMakeLists.txt set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@") @@ -135,5 +138,7 @@ elseif(OUTPUT STREQUAL "scripts/pnglibconf.h.prebuilt") message(FATAL_ERROR "Stopping build") else() + message(FATAL_ERROR "Unsupported output: ${OUTPUT}") + endif() diff --git a/scripts/test.cmake.in b/scripts/cmake/test.cmake.in similarity index 63% rename from scripts/test.cmake.in rename to scripts/cmake/test.cmake.in index fa6a889bb..a1cd30f55 100644 --- a/scripts/test.cmake.in +++ b/scripts/cmake/test.cmake.in @@ -1,11 +1,15 @@ # test.cmake.in -# Copyright (C) 2016 Glenn Randers-Pehrson +# Copyright (c) 2024 Cosmin Truta +# Copyright (c) 2016 Glenn Randers-Pehrson # Written by Roger Leigh, 2016 - -# This code is released under the libpng license. -# For conditions of distribution and use, see the disclaimer -# and license in png.h +# +# Use, modification and distribution are subject to +# the same licensing terms and conditions as libpng. +# Please see the copyright notice in png.h or visit +# http://libpng.org/pub/png/src/libpng-LICENSE.txt +# +# SPDX-License-Identifier: libpng-2.0 set(TEST_OPTIONS "@TEST_OPTIONS@") set(TEST_FILES "@TEST_FILES@") @@ -22,8 +26,7 @@ if(WIN32) set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}") endif() -execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}) - +message("Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}) execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES} RESULT_VARIABLE TEST_STATUS) if(TEST_STATUS)