Re: git: 0bdf5887f0d2 - main - graphics/tiff: Update to 4.7.0 and switch to CMake

From: Kevin Bowling <kevin.bowling_at_kev009.com>
Date: Wed, 09 Oct 2024 21:28:01 UTC
On Wed, Oct 9, 2024 at 12:43 PM Daniel Engberg <diizzy@freebsd.org> wrote:
>
> The branch main has been updated by diizzy:
>
> URL: https://cgit.FreeBSD.org/ports/commit/?id=0bdf5887f0d2cc9f14ea0cc10ed9e371028dd620
>
> commit 0bdf5887f0d2cc9f14ea0cc10ed9e371028dd620
> Author:     Daniel Engberg <diizzy@FreeBSD.org>
> AuthorDate: 2024-10-09 19:12:09 +0000
> Commit:     Daniel Engberg <diizzy@FreeBSD.org>
> CommitDate: 2024-10-09 19:43:25 +0000
>
>     graphics/tiff: Update to 4.7.0 and switch to CMake

I believe this might have come up in the past but I do not remember
any conclusion.

Upon a quick look at Debian and Fedora (thus accounting for the
majority of all *nix builds/usage) I do not see either using CMake:
* https://sources.debian.org/src/tiff/4.6.0-2/debian/rules/#L16
* https://src.fedoraproject.org/rpms/libtiff/blob/rawhide/f/libtiff.spec#_68

Autotools projects tend to add CMake for Windows support, and if they
are migrating fully they make it very clear whereas this project's
internal .spec file and readme both continue to point to Autotools.
If they are maintaining two build systems, I think it would be wise to
stick to the one used by the dominant *nix and not make a fashion
statement.

If the goal is to promote CMake usage that is more appropriate for
upstream projects, in packaging it risks introducing subtle behavioral
differences now or in the future for what gain?

2c,
Kevin

>     Changelog:
>     https://gitlab.com/libtiff/libtiff/-/releases/v4.7.0
>
>     PR:             281639
>     Approved by:    desktop (fluffy) via Matrix
>     Exp-run by:     antoine
> ---
>  graphics/tiff/Makefile                             | 32 ++++++---
>  graphics/tiff/distinfo                             |  6 +-
>  graphics/tiff/files/patch-cmake_LinkerChecks.cmake | 11 +++
>  graphics/tiff/files/patch-libtiff_CMakeLists.txt   | 11 +++
>  .../tiff/files/patch-tools_unsupported_Makefile.in | 10 ---
>  graphics/tiff/pkg-plist                            | 81 ++++++++++++++++++++--
>  6 files changed, 124 insertions(+), 27 deletions(-)
>
> diff --git a/graphics/tiff/Makefile b/graphics/tiff/Makefile
> index c82338119951..83e435fb3d2d 100644
> --- a/graphics/tiff/Makefile
> +++ b/graphics/tiff/Makefile
> @@ -1,5 +1,5 @@
>  PORTNAME=      tiff
> -DISTVERSION=   4.6.0
> +DISTVERSION=   4.7.0
>  CATEGORIES=    graphics
>  MASTER_SITES=  https://download.osgeo.org/libtiff/
>
> @@ -15,21 +15,33 @@ LIB_DEPENDS=        libdeflate.so:archivers/libdeflate \
>                 libLerc.so:graphics/lerc \
>                 libzstd.so:archivers/zstd
>
> -USES=          cpe jpeg libtool localbase pathfix tar:xz
> +USES=          cmake:testing cpe jpeg pathfix pkgconfig tar:xz
>  CPE_PRODUCT=   libtiff
> +PATHFIX_CMAKELISTSTXT= PkgConfig.cmake
>  USE_LDCONFIG=  yes
>
> -GNU_CONFIGURE= yes
> -CONFIGURE_ARGS=        --disable-sphinx \
> -               --disable-webp
> -
> -INSTALL_TARGET=        install-strip
> -TEST_TARGET=   check
> +DOCSDIR=       ${PREFIX}/share/doc/tiff-${DISTVERSION}
>
> -LDFLAGS+=      -Wl,--undefined-version
> +CMAKE_TESTING_ON=      tiff-tests
>
> -DOCSDIR=       ${PREFIX}/share/doc/tiff-${DISTVERSION}
> +CMAKE_OFF=     CMAKE_DISABLE_FIND_PACKAGE_GLUT \
> +               CMAKE_DISABLE_FIND_PACKAGE_OpenGL \
> +               tiff-docs \
> +               tiff-tests
>
>  OPTIONS_DEFINE=        DOCS
>
> +post-install:
> +       ${INSTALL_MAN} ${WRKSRC}/doc/man-prebuilt/*.1 ${STAGEDIR}${PREFIX}/share/man/man1
> +       ${INSTALL_MAN} ${WRKSRC}/doc/man-prebuilt/*.3tiff ${STAGEDIR}${PREFIX}/share/man/man3
> +
> +post-install-DOCS-on:
> +       (cd ${WRKSRC}/doc/html-prebuilt && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/manual)
> +       ${INSTALL_MAN} ${WRKSRC}/ChangeLog ${STAGEDIR}${DOCSDIR}
> +       ${INSTALL_MAN} ${WRKSRC}/LICENSE.md ${STAGEDIR}${DOCSDIR}
> +       ${INSTALL_MAN} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
> +       ${INSTALL_MAN} ${WRKSRC}/RELEASE-DATE ${STAGEDIR}${DOCSDIR}
> +       ${INSTALL_MAN} ${WRKSRC}/TODO ${STAGEDIR}${DOCSDIR}
> +       ${INSTALL_MAN} ${WRKSRC}/VERSION ${STAGEDIR}${DOCSDIR}
> +
>  .include <bsd.port.mk>
> diff --git a/graphics/tiff/distinfo b/graphics/tiff/distinfo
> index 60c357e6b598..84e8ebf6ad62 100644
> --- a/graphics/tiff/distinfo
> +++ b/graphics/tiff/distinfo
> @@ -1,3 +1,3 @@
> -TIMESTAMP = 1714034290
> -SHA256 (tiff-4.6.0.tar.xz) = e178649607d1e22b51cf361dd20a3753f244f022eefab1f2f218fc62ebaf87d2
> -SIZE (tiff-4.6.0.tar.xz) = 2124388
> +TIMESTAMP = 1726901517
> +SHA256 (tiff-4.7.0.tar.xz) = 273a0a73b1f0bed640afee4a5df0337357ced5b53d3d5d1c405b936501f71017
> +SIZE (tiff-4.7.0.tar.xz) = 2286220
> diff --git a/graphics/tiff/files/patch-cmake_LinkerChecks.cmake b/graphics/tiff/files/patch-cmake_LinkerChecks.cmake
> new file mode 100644
> index 000000000000..8b6c8c54482f
> --- /dev/null
> +++ b/graphics/tiff/files/patch-cmake_LinkerChecks.cmake
> @@ -0,0 +1,11 @@
> +--- cmake/LinkerChecks.cmake.orig      2024-09-21 09:08:00 UTC
> ++++ cmake/LinkerChecks.cmake
> +@@ -39,7 +39,7 @@ set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
> + } VERS_1;
> + ")
> + set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
> +-set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
> ++set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Wl,--undefined-version "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
> + check_c_source_compiles("int main(void){return 0;}" HAVE_LD_VERSION_SCRIPT)
> + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
> + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
> diff --git a/graphics/tiff/files/patch-libtiff_CMakeLists.txt b/graphics/tiff/files/patch-libtiff_CMakeLists.txt
> new file mode 100644
> index 000000000000..face49e28c9a
> --- /dev/null
> +++ b/graphics/tiff/files/patch-libtiff_CMakeLists.txt
> @@ -0,0 +1,11 @@
> +--- libtiff/CMakeLists.txt.orig        2024-08-15 21:16:11 UTC
> ++++ libtiff/CMakeLists.txt
> +@@ -202,7 +202,7 @@ if(HAVE_LD_VERSION_SCRIPT)
> + endif()
> + if(HAVE_LD_VERSION_SCRIPT)
> +   set_target_properties(tiff PROPERTIES LINK_FLAGS
> +-                        "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libtiff.map")
> ++  "-Wl,--undefined-version -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libtiff.map")
> + endif()
> +
> + if(tiff-install)
> diff --git a/graphics/tiff/files/patch-tools_unsupported_Makefile.in b/graphics/tiff/files/patch-tools_unsupported_Makefile.in
> deleted file mode 100644
> index 7c1e41e53db9..000000000000
> --- a/graphics/tiff/files/patch-tools_unsupported_Makefile.in
> +++ /dev/null
> @@ -1,10 +0,0 @@
> ---- tools/unsupported/Makefile.in.orig 2024-04-25 09:24:10 UTC
> -+++ tools/unsupported/Makefile.in
> -@@ -705,7 +705,6 @@ uninstall-am: uninstall-binPROGRAMS
> - .PRECIOUS: Makefile
> -
> -
> --(echo tifftoolsunsupported: $(TIFF_TOOLS_UNSUPPORTED))
> -
> - echo:
> -       (echo $(CFLAGS))
> diff --git a/graphics/tiff/pkg-plist b/graphics/tiff/pkg-plist
> index 7ec1bb8e64ad..afe399914e2f 100644
> --- a/graphics/tiff/pkg-plist
> +++ b/graphics/tiff/pkg-plist
> @@ -1,6 +1,19 @@
> +bin/fax2ps
> +bin/fax2tiff
> +bin/pal2rgb
> +bin/ppm2tiff
> +bin/raw2tiff
> +bin/tiff2bw
> +bin/tiff2pdf
> +bin/tiff2ps
> +bin/tiff2rgba
> +bin/tiffcmp
>  bin/tiffcp
> +bin/tiffcrop
> +bin/tiffdither
>  bin/tiffdump
>  bin/tiffinfo
> +bin/tiffmedian
>  bin/tiffset
>  bin/tiffsplit
>  include/tiff.h
> @@ -8,14 +21,16 @@ include/tiffconf.h
>  include/tiffio.h
>  include/tiffio.hxx
>  include/tiffvers.h
> -lib/libtiff.a
> +lib/cmake/tiff/TiffConfig.cmake
> +lib/cmake/tiff/TiffConfigVersion.cmake
> +lib/cmake/tiff/TiffTargets-%%CMAKE_BUILD_TYPE%%.cmake
> +lib/cmake/tiff/TiffTargets.cmake
>  lib/libtiff.so
>  lib/libtiff.so.6
> -lib/libtiff.so.6.0.2
> -lib/libtiffxx.a
> +lib/libtiff.so.6.1.0
>  lib/libtiffxx.so
>  lib/libtiffxx.so.6
> -lib/libtiffxx.so.6.0.2
> +lib/libtiffxx.so.6.1.0
>  libdata/pkgconfig/libtiff-4.pc
>  %%PORTDOCS%%%%DOCSDIR%%/ChangeLog
>  %%PORTDOCS%%%%DOCSDIR%%/LICENSE.md
> @@ -111,6 +126,7 @@ libdata/pkgconfig/libtiff-4.pc
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/project/index.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/project/license.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/project/mailinglist.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/project/psc.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/releases/historical.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/releases/index.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/releases/v3.4beta007.rst.txt
> @@ -171,6 +187,10 @@ libdata/pkgconfig/libtiff-4.pc
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/releases/v4.5.0.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/releases/v4.5.1.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/releases/v4.6.0.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/releases/v4.7.0.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/rfcs/index.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/rfcs/rfc1_psc.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/rfcs/rfc2_restoring_needed_tools.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/specification/bigtiff.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/specification/coverage-bigtiff.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/specification/coverage.rst.txt
> @@ -178,9 +198,25 @@ libdata/pkgconfig/libtiff-4.pc
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/specification/technote2.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/terms.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/fax2ps.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/fax2tiff.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/pal2rgb.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/ppm2tiff.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/raw2tiff.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/rgb2ycbcr.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/thumbnail.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiff2bw.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffcmp.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffcp.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffcrop.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffdither.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffdump.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffgt.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffinfo.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffmedian.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiff2pdf.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiff2ps.rst.txt
> +%%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiff2rgba.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffset.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_sources/tools/tiffsplit.rst.txt
>  %%PORTDOCS%%%%DOCSDIR%%/manual/_static/basic.css
> @@ -271,6 +307,7 @@ libdata/pkgconfig/libtiff-4.pc
>  %%PORTDOCS%%%%DOCSDIR%%/manual/project/index.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/project/license.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/project/mailinglist.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/project/psc.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/releases/historical.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/releases/index.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/releases/v3.4beta007.html
> @@ -331,6 +368,10 @@ libdata/pkgconfig/libtiff-4.pc
>  %%PORTDOCS%%%%DOCSDIR%%/manual/releases/v4.5.0.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/releases/v4.5.1.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/releases/v4.6.0.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/releases/v4.7.0.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/rfcs/index.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/rfcs/rfc1_psc.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/rfcs/rfc2_restoring_needed_tools.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/search.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/searchindex.js
>  %%PORTDOCS%%%%DOCSDIR%%/manual/specification/bigtiff.html
> @@ -340,14 +381,46 @@ libdata/pkgconfig/libtiff-4.pc
>  %%PORTDOCS%%%%DOCSDIR%%/manual/specification/technote2.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/terms.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/tools.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/fax2ps.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/fax2tiff.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/pal2rgb.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/ppm2tiff.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/raw2tiff.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/rgb2ycbcr.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/thumbnail.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiff2bw.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiff2pdf.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiff2ps.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiff2rgba.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffcmp.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffcp.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffcrop.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffdither.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffdump.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffgt.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffinfo.html
> +%%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffmedian.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffset.html
>  %%PORTDOCS%%%%DOCSDIR%%/manual/tools/tiffsplit.html
> +share/man/man1/fax2ps.1.gz
> +share/man/man1/fax2tiff.1.gz
> +share/man/man1/pal2rgb.1.gz
> +share/man/man1/ppm2tiff.1.gz
> +share/man/man1/raw2tiff.1.gz
> +share/man/man1/rgb2ycbcr.1.gz
> +share/man/man1/thumbnail.1.gz
> +share/man/man1/tiff2bw.1.gz
> +share/man/man1/tiff2pdf.1.gz
> +share/man/man1/tiff2ps.1.gz
> +share/man/man1/tiff2rgba.1.gz
> +share/man/man1/tiffcmp.1.gz
>  share/man/man1/tiffcp.1.gz
> +share/man/man1/tiffcrop.1.gz
> +share/man/man1/tiffdither.1.gz
>  share/man/man1/tiffdump.1.gz
> +share/man/man1/tiffgt.1.gz
>  share/man/man1/tiffinfo.1.gz
> +share/man/man1/tiffmedian.1.gz
>  share/man/man1/tiffset.1.gz
>  share/man/man1/tiffsplit.1.gz
>  share/man/man3/TIFFAccessTagMethods.3tiff.gz