diff mbox series

[bug#60156,2/4] gnu: libgeotiff: Apply patch for building against proj 9.1.1.

Message ID 20221217114258.5216-2-felgru@posteo.net
State New
Headers show
Series Update proj to 9.1.1. | expand

Commit Message

Felix Gruber Dec. 17, 2022, 11:42 a.m. UTC
* gnu/packages/patches/libgeotiff-fix-tests-with-proj-9.1.1.patch: New
  file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/geo.scm (libgeotiff): Apply it.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/geo.scm                          |   1 +
 ...libgeotiff-fix-tests-with-proj-9.1.1.patch | 100 ++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 gnu/packages/patches/libgeotiff-fix-tests-with-proj-9.1.1.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 5b8944f568..e1f280250a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1380,6 +1380,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/julia-tracker-16-compat.patch		\
   %D%/packages/patches/libffi-3.3-powerpc-fixes.patch		\
   %D%/packages/patches/libffi-float128-powerpc64le.patch	\
+  %D%/packages/patches/libgeotiff-fix-tests-with-proj-9.1.1.patch	\
   %D%/packages/patches/libobjc2-unbundle-robin-map.patch	\
   %D%/packages/patches/librime-fix-build-with-gcc10.patch	\
   %D%/packages/patches/libvirt-add-install-prefix.patch	\
diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index da8dfbb980..2f2fd6a1f1 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -338,6 +338,7 @@  (define-public libgeotiff
        (method url-fetch)
        (uri (string-append "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-"
                            version ".tar.gz"))
+       (patches (search-patches "libgeotiff-fix-tests-with-proj-9.1.1.patch"))
        (sha256
         (base32 "1mjmgv48x51ppax5dnb6lq7z600czxll53bx6jbzqwd4m93i7aq5"))
        (modules '((guix build utils)))
diff --git a/gnu/packages/patches/libgeotiff-fix-tests-with-proj-9.1.1.patch b/gnu/packages/patches/libgeotiff-fix-tests-with-proj-9.1.1.patch
new file mode 100644
index 0000000000..b4bf292c1e
--- /dev/null
+++ b/gnu/packages/patches/libgeotiff-fix-tests-with-proj-9.1.1.patch
@@ -0,0 +1,100 @@ 
+From: Even Rouault <even.rouault@spatialys.com>
+Date: Sat, 26 Nov 2022 13:23:12 +0100
+Subject: Fix test failures with PROJ 9.1.1
+
+https://github.com/OSGeo/libgeotiff/pull/82
+---
+ bin/listgeo.c             |  7 ++++++-
+ test/testlistgeo          |  4 ++--
+ test/testlistgeo_out.dist | 14 --------------
+ 3 files changed, 8 insertions(+), 17 deletions(-)
+
+diff --git a/bin/listgeo.c b/bin/listgeo.c
+index 06c45f70..acad54c6 100644
+--- a/bin/listgeo.c
++++ b/bin/listgeo.c
+@@ -29,6 +29,7 @@ void Usage()
+         "  -tfw: Generate a .tfw (ESRI TIFF World) file for the target file.\n"
+         "  -proj4: Report PROJ.4 equivalent projection definition.\n"
+         "  -no_norm: Don't report 'normalized' parameter values.\n"
++        "  -no_corners: Don't report corner coordinates.\n"
+         "  filename: Name of the GeoTIFF file to report on.\n" );
+         
+     exit( 1 );
+@@ -42,6 +43,7 @@ int main(int argc, char *argv[])
+     int		i, norm_print_flag = 1, proj4_print_flag = 0;
+     int		tfw_flag = 0, inv_flag = 0, dec_flag = 0;
+     int         st_test_flag = 0;
++    int     corners = 1;
+ 
+     /*
+      * Handle command line options.
+@@ -50,6 +52,8 @@ int main(int argc, char *argv[])
+     {
+         if( strcmp(argv[i],"-no_norm") == 0 )
+             norm_print_flag = 0;
++        else if( strcmp(argv[i],"-no_corners") == 0 )
++            corners = 0;
+         else if( strcmp(argv[i],"-tfw") == 0 )
+             tfw_flag = 1;
+         else if( strcmp(argv[i],"-proj4") == 0 )
+@@ -130,7 +134,8 @@ int main(int argc, char *argv[])
+             
+             TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &xsize );
+             TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &ysize );
+-            GTIFPrintCorners( gtif, &defn, stdout, xsize, ysize, inv_flag, dec_flag );
++            if( corners )
++                GTIFPrintCorners( gtif, &defn, stdout, xsize, ysize, inv_flag, dec_flag );
+         }
+ 
+     }
+diff --git a/test/testlistgeo b/test/testlistgeo
+index 596301b4..9a41e74f 100755
+--- a/test/testlistgeo
++++ b/test/testlistgeo
+@@ -59,11 +59,11 @@ $EXE ${DATA_DIR}/ProjLinearUnitsGeoKey_9036.tif >>${OUT}
+ echo "" >>${OUT}
+ 
+ echo "Testing listgeo ProjectedCSTypeGeoKey_28191_cassini_soldner.tif" >> ${OUT}
+-$EXE ${DATA_DIR}/ProjectedCSTypeGeoKey_28191_cassini_soldner.tif >>${OUT}
++$EXE -no_corners ${DATA_DIR}/ProjectedCSTypeGeoKey_28191_cassini_soldner.tif >>${OUT}
+ echo "" >>${OUT}
+ 
+ echo "Testing listgeo cassini_soldner.tif" >> ${OUT}
+-$EXE ${DATA_DIR}/cassini_soldner.tif >>${OUT}
++$EXE -no_corners ${DATA_DIR}/cassini_soldner.tif >>${OUT}
+ echo "" >>${OUT}
+ 
+ echo "Testing listgeo ProjectedCSTypeGeoKey_27200_new_zealand_mapping_grid.tif" >> ${OUT}
+diff --git a/test/testlistgeo_out.dist b/test/testlistgeo_out.dist
+index 742f0fce..20221cec 100644
+--- a/test/testlistgeo_out.dist
++++ b/test/testlistgeo_out.dist
+@@ -299,13 +299,6 @@ Ellipsoid: 7010/Clarke 1880 (Benoit) (6378300.79,6356566.43)
+ Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
+ Projection Linear Units: 9001/metre (1.000000m)
+ 
+-Corner Coordinates:
+-Upper Left    (  440720.000, 3751320.000)  ( 40d47'28.08"E, 64d13'29.57"N)
+-Lower Left    (  440720.000, 3751260.000)  ( 40d47'27.69"E, 64d13'27.64"N)
+-Upper Right   (  440780.000, 3751320.000)  ( 40d47'32.51"E, 64d13'29.40"N)
+-Lower Right   (  440780.000, 3751260.000)  ( 40d47'32.12"E, 64d13'27.47"N)
+-Center        (  440750.000, 3751290.000)  ( 40d47'30.10"E, 64d13'28.52"N)
+-
+ Testing listgeo cassini_soldner.tif
+ Geotiff_Information:
+    Version: 1
+@@ -348,13 +341,6 @@ Projection Method: CT_CassiniSoldner
+    ProjFalseNorthingGeoKey: 126867.909000 m
+ Projection Linear Units: 9001/metre (1.000000m)
+ 
+-Corner Coordinates:
+-Upper Left    (  440720.000, 3751320.000)  ( 40d47'28.08"E, 64d13'29.57"N)
+-Lower Left    (  440720.000, 3751260.000)  ( 40d47'27.69"E, 64d13'27.64"N)
+-Upper Right   (  440780.000, 3751320.000)  ( 40d47'32.51"E, 64d13'29.40"N)
+-Lower Right   (  440780.000, 3751260.000)  ( 40d47'32.12"E, 64d13'27.47"N)
+-Center        (  440750.000, 3751290.000)  ( 40d47'30.10"E, 64d13'28.52"N)
+-
+ Testing listgeo ProjectedCSTypeGeoKey_27200_new_zealand_mapping_grid.tif
+ Geotiff_Information:
+    Version: 1