[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0-382-g82fe97d43

git at osgeo.org git at osgeo.org
Thu Jan 27 09:19:35 PST 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  82fe97d436ab8a5ad726fba5464c341295c1ef8a (commit)
       via  193f0510f3b516d77a0cdd4549dcf681dbcc9ed9 (commit)
       via  e9bb35128b80fe9b2f29229ffc390dbad7810958 (commit)
       via  286625d4807fe44f5bf0a5334f6eeba08685a35f (commit)
      from  0cfdff58c3de7266d8b799350fdff4fb3d61a4d5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 82fe97d436ab8a5ad726fba5464c341295c1ef8a
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Jan 27 17:59:06 2022 +0100

    Fix `make images` in out-of-tree builds

diff --git a/doc/html/image_src/Makefile.in b/doc/html/image_src/Makefile.in
index aa71d19d9..2f535e01a 100644
--- a/doc/html/image_src/Makefile.in
+++ b/doc/html/image_src/Makefile.in
@@ -2,6 +2,8 @@
 # *
 # * PostGIS - Spatial Types for PostgreSQL
 # * http://postgis.net
+# *
+# * Copyright (C) 2022 Sandro Santilli <strk at kbt.io>
 # * Copyright 2008 Kevin Neufeld
 # *
 # * This is free software; you can redistribute and/or modify it under
@@ -181,6 +183,9 @@ OBJS=styles.o generator.o
 # Build the generator
 all: generator
 
+images_dir:
+	mkdir -p ../images
+
 # generate the images
 images: $(IMAGES) $(IMAGES_RESIZED)
 
@@ -189,12 +194,12 @@ $(OBJS): %.o: %.c
 	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 # Command to build each of the .wkt files
-$(IMAGES): ../images/%.png: %.wkt generator styles.conf
-	@./generator $<
+$(IMAGES): ../images/%.png: %.wkt generator styles.conf | images_dir
+	@./generator $< $@
 
 # Command to resize each of the images
-$(IMAGES_RESIZED): ../images/%.png: %.wkt generator styles.conf
-	@./generator $<
+$(IMAGES_RESIZED): ../images/%.png: %.wkt generator styles.conf | images_dir
+	@./generator $< $@
 	convert $@ -resize 100x100 $@
 
 # Build the main executable

commit 193f0510f3b516d77a0cdd4549dcf681dbcc9ed9
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Jan 27 17:50:32 2022 +0100

    [generator] look for styles.conf in the dir containing image source

diff --git a/doc/html/image_src/generator.c b/doc/html/image_src/generator.c
index 0732acb99..d53d9cd30 100644
--- a/doc/html/image_src/generator.c
+++ b/doc/html/image_src/generator.c
@@ -336,7 +336,10 @@ int main( int argc, const char* argv[] )
 	char *filename;
 	int layerCount;
 	LAYERSTYLE *styles;
+	char *stylefile_path;
 	const char *image_src;
+	char *ptr;
+	const char *stylefilename = "styles.conf";
 
 	if ( argc < 2 || strlen(argv[1]) < 3)
 	{
@@ -352,7 +355,23 @@ int main( int argc, const char* argv[] )
 		return -1;
 	}
 
-	getStyles(&styles);
+	/* Get style */
+	ptr = rindex( image_src, '/' );
+	if ( ptr ) /* source image file has a slash */
+	{
+		size_t dirname_len = (ptr - image_src);
+		stylefile_path = malloc( strlen(stylefilename) + dirname_len + 2);
+		/* copy the directory name */
+		memcpy(stylefile_path, image_src, dirname_len);
+		sprintf(stylefile_path + dirname_len, "/%s", stylefilename);
+	}
+	else /* source image file has no slash, use CWD */
+	{
+		stylefile_path = strdup(stylefilename);
+	}
+	printf("reading styles from %s\n", stylefile_path);
+	getStyles(stylefile_path, &styles);
+	free(stylefile_path);
 
 	if ( argc > 2 )
 	{
diff --git a/doc/html/image_src/styles.c b/doc/html/image_src/styles.c
index 35fdfb676..d22c0ae12 100644
--- a/doc/html/image_src/styles.c
+++ b/doc/html/image_src/styles.c
@@ -20,7 +20,7 @@
 
 
 void
-getStyles( LAYERSTYLE **headRef )
+getStyles( const char *filename, LAYERSTYLE **headRef )
 {
 	char line [128];
 	FILE* pFile;
@@ -28,9 +28,9 @@ getStyles( LAYERSTYLE **headRef )
 
 	*headRef = NULL;
 
-	if ((pFile = fopen("styles.conf", "r")) == NULL)
+	if ((pFile = fopen(filename, "r")) == NULL)
 	{
-		perror ( "styles.conf: No such file or directory" );
+		perror ( filename );
 		return;
 	}
 
diff --git a/doc/html/image_src/styles.h b/doc/html/image_src/styles.h
index 04c4fc260..78144e5d8 100644
--- a/doc/html/image_src/styles.h
+++ b/doc/html/image_src/styles.h
@@ -33,7 +33,7 @@ struct layerStyle
 	LAYERSTYLE *next;
 };
 
-void getStyles( LAYERSTYLE **headRef );
+void getStyles( const char *filename, LAYERSTYLE **headRef );
 void freeStyles( LAYERSTYLE **headRef );
 void addStyle( LAYERSTYLE **headRef, char* styleName, int pointSize, char* pointColor, int lineWidth, char* lineColor, char* polygonFillColor, char* polygonStrokeColor, int polygonStrokeWidth );
 

commit e9bb35128b80fe9b2f29229ffc390dbad7810958
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Jan 27 17:31:36 2022 +0100

    [generator] Add support for taking output in commandline

diff --git a/doc/html/image_src/generator.c b/doc/html/image_src/generator.c
index b9eb57487..0732acb99 100644
--- a/doc/html/image_src/generator.c
+++ b/doc/html/image_src/generator.c
@@ -2,6 +2,8 @@
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
+ *
+ * Copyright (C) 2022 Sandro Santilli <strk at kbt.io>
  * Copyright 2008 Kevin Neufeld
  *
  * This is free software; you can redistribute and/or modify it under
@@ -334,26 +336,33 @@ int main( int argc, const char* argv[] )
 	char *filename;
 	int layerCount;
 	LAYERSTYLE *styles;
-	char *image_path = "../images/";
-
-	getStyles(&styles);
+	const char *image_src;
 
-	if ( argc != 2 || strlen(argv[1]) < 3)
+	if ( argc < 2 || strlen(argv[1]) < 3)
 	{
-		lwerror("You must specify a wkt filename to convert, and it must be 3 or more characters long.\n");
+		lwerror("Usage: %s <source_wktfile> [<output_pngfile>]", argv[0]);
 		return -1;
 	}
 
-	if ( (pfile = fopen(argv[1], "r")) == NULL)
+	image_src = argv[1];
+
+	if ( (pfile = fopen(image_src, "r")) == NULL)
 	{
-		perror ( argv[1] );
+		perror ( image_src );
 		return -1;
 	}
 
-	filename = malloc( strlen(argv[1]) + strlen(image_path) + 1 );
-	strcpy( filename, image_path );
-	strncat( filename, argv[1], strlen(argv[1])-3 );
-	strncat( filename, "png", 3 );
+	getStyles(&styles);
+
+	if ( argc > 2 )
+	{
+		filename = strdup(argv[2]);
+	}
+	else
+	{
+		filename = strdup(image_src);
+		sprintf(filename + strlen(image_src) - 3, "png" );
+	}
 
 	printf( "generating %s\n", filename );
 
@@ -390,7 +399,7 @@ int main( int argc, const char* argv[] )
 
 		ptr += sprintf( ptr, "-flip tmp%d.png", layerCount );
 
-		lwfree( lwgeom );
+		lwgeom_free( lwgeom );
 
 		LWDEBUGF( 4, "%s", output );
 		checked_system(output);

commit 286625d4807fe44f5bf0a5334f6eeba08685a35f
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Jan 27 16:59:19 2022 +0100

    Fix out-of-source build of image generator

diff --git a/doc/html/image_src/Makefile.in b/doc/html/image_src/Makefile.in
index 1add81ce4..aa71d19d9 100644
--- a/doc/html/image_src/Makefile.in
+++ b/doc/html/image_src/Makefile.in
@@ -9,14 +9,18 @@
 # *
 # **********************************************************************
 
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+srcdir = @srcdir@
+
 CC=@CC@
 CFLAGS=@CFLAGS@ @PROJ_CPPFLAGS@
-top_builddir = @top_builddir@
+CPPFLAGS = -I$(top_builddir)/liblwgeom -I$(top_srcdir)/liblwgeom @CPPFLAGS@
 SHELL = @SHELL@
 LIBTOOL = @LIBTOOL@
+LDFLAGS = @LDFLAGS@ @GEOS_LDFLAGS@ @PROJ_LDFLAGS@
 
-CUNIT_LDFLAGS=@CUNIT_LDFLAGS@
-CUNIT_CPPFLAGS=-I../../../liblwgeom @CUNIT_CPPFLAGS@
+VPATH = $(srcdir)
 
 IMAGES= \
 	../images/de9im01.png \
@@ -182,7 +186,7 @@ images: $(IMAGES) $(IMAGES_RESIZED)
 
 # Command to build each of the .o files
 $(OBJS): %.o: %.c
-	$(CC) $(CUNIT_CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 # Command to build each of the .wkt files
 $(IMAGES): ../images/%.png: %.wkt generator styles.conf
@@ -194,9 +198,9 @@ $(IMAGES_RESIZED): ../images/%.png: %.wkt generator styles.conf
 	convert $@ -resize 100x100 $@
 
 # Build the main executable
-generator: ../../../liblwgeom/.libs/liblwgeom.a $(OBJS)
+generator: $(OBJS) ../../../liblwgeom/.libs/liblwgeom.a
 	$(LIBTOOL) --mode=link \
-	$(CC) -o $@ $(OBJS) ../../../liblwgeom/liblwgeom.la $(CUNIT_LDFLAGS)
+	$(CC) -o $@ $^ $(LDFLAGS)
 
 # Build liblwgeom
 ../../../liblwgeom/.libs/liblwgeom.a:

-----------------------------------------------------------------------

Summary of changes:
 doc/html/image_src/Makefile.in | 29 +++++++++++++++--------
 doc/html/image_src/generator.c | 52 ++++++++++++++++++++++++++++++++----------
 doc/html/image_src/styles.c    |  6 ++---
 doc/html/image_src/styles.h    |  2 +-
 4 files changed, 63 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list