svn commit: r564633 - in head/databases/grass7: . files

Loïc Bartoletti lbartoletti at FreeBSD.org
Sun Feb 7 18:14:39 UTC 2021


Author: lbartoletti
Date: Sun Feb  7 18:14:38 2021
New Revision: 564633
URL: https://svnweb.freebsd.org/changeset/ports/564633

Log:
  databases/grass7: remove use of sbrk
  
  sbrk is deprecated and is not present on some architectures. There is only one use of this function in grass for the r.terraflow module.
  Its use will be removed in the next version, so I integrate this patch now to use it on architectures that don't have sbrk.
  
  Thanks to mikael@ for the tests on aarch64

Added:
  head/databases/grass7/files/patch-raster_r.terraflow_stats.cpp   (contents, props changed)
  head/databases/grass7/files/patch-raster_r.terraflow_stats.h   (contents, props changed)
Modified:
  head/databases/grass7/Makefile
  head/databases/grass7/pkg-plist

Modified: head/databases/grass7/Makefile
==============================================================================
--- head/databases/grass7/Makefile	Sun Feb  7 17:33:24 2021	(r564632)
+++ head/databases/grass7/Makefile	Sun Feb  7 18:14:38 2021	(r564633)
@@ -3,7 +3,7 @@
 
 PORTNAME=	grass
 PORTVERSION=	7.8.5
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	databases geography
 MASTER_SITES=	https://grass.osgeo.org/%SUBDIR%/ \
 		http://grass.cict.fr/%SUBDIR%/ \
@@ -134,12 +134,6 @@ ZSTD_CONFIGURE_WITH=	zstd
 ZSTD_LIB_DEPENDS=	libzstd.so:archivers/zstd
 
 .include <bsd.port.pre.mk>
-
-.if ${ARCH} == "aarch64" || ${ARCH} == "riscv64"
-PLIST_SUB+=	WOSBRK="@comment "
-.else
-PLIST_SUB+=	WOSBRK=""
-.endif
 
 .if ${ARCH} == "i386" && ${OSVERSION} < 1200000
 # clang 7.x and 8.x do not build properly on 11i386

Added: head/databases/grass7/files/patch-raster_r.terraflow_stats.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/grass7/files/patch-raster_r.terraflow_stats.cpp	Sun Feb  7 18:14:38 2021	(r564633)
@@ -0,0 +1,47 @@
+--- raster/r.terraflow/stats.cpp.orig	2020-12-21 18:40:15 UTC
++++ raster/r.terraflow/stats.cpp
+@@ -126,44 +126,7 @@ statsRecorder::statsRecorder(char *fname) : ofstream(n
+   //ofstream that takes an fd; wrote another noclobber() function that
+   //closes fd and returns the name;
+   rt_start(tm);
+-#ifndef __MINGW32__
+-  bss = sbrk(0);
+-#endif
+-  char buf[BUFSIZ];
+-  *this << freeMem(buf) << endl;
+ }
+-
+-/* ********************************************************************** */
+-
+-long 
+-statsRecorder::freeMem() {
+-#ifdef __MINGW32__
+-  return -1;
+-#else
+-  struct rlimit rlim;
+-  if (getrlimit(RLIMIT_DATA, &rlim) == -1) {
+-	perror("getrlimit: ");
+-	return -1;
+-  } 	
+-  /* printf("getrlimit returns: %d \n", rlim.rlim_cur); */
+-  if (rlim.rlim_cur == RLIM_INFINITY) {
+-	/* printf("rlim is infinity\n"); */
+-	/* should fix this */
+-	return -1; 
+-  } 
+-  long freeMem = rlim.rlim_cur - ((char*)sbrk(0)-(char*)bss);
+-  return freeMem;
+-#endif /* __MINGW32__ */
+-}
+-
+-char *
+-statsRecorder::freeMem(char *buf) {
+-  char buf2[BUFSIZ];
+-  sprintf(buf, "Free Memory=%s", formatNumber(buf2, freeMem()));
+-  return buf;
+-}
+-
+-
+ 
+ /* ********************************************************************** */
+ 

Added: head/databases/grass7/files/patch-raster_r.terraflow_stats.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/grass7/files/patch-raster_r.terraflow_stats.h	Sun Feb  7 18:14:38 2021	(r564633)
@@ -0,0 +1,17 @@
+--- raster/r.terraflow/stats.h.orig	2020-12-21 18:40:15 UTC
++++ raster/r.terraflow/stats.h
+@@ -35,14 +35,11 @@ int noclobberFile(char *);
+ class statsRecorder : public ofstream {
+ private:
+   Rtimer tm;
+-  void *bss;
+ public:
+   statsRecorder(char *fname);
+   ~statsRecorder() { 
+ 	this->flush(); 
+   }
+-  char *freeMem(char *);
+-  long freeMem();
+   char *timestamp();
+   void timestamp(const char *s);
+   void comment(const char *s, const int verbose=1);

Modified: head/databases/grass7/pkg-plist
==============================================================================
--- head/databases/grass7/pkg-plist	Sun Feb  7 17:33:24 2021	(r564632)
+++ head/databases/grass7/pkg-plist	Sun Feb  7 18:14:38 2021	(r564633)
@@ -240,7 +240,7 @@ bin/grass%%VER%%
 %%GRASS_INST_DIR%%/bin/r.surf.gauss
 %%GRASS_INST_DIR%%/bin/r.surf.idw
 %%GRASS_INST_DIR%%/bin/r.surf.random
-%%WOSBRK%%%%GRASS_INST_DIR%%/bin/r.terraflow
+%%GRASS_INST_DIR%%/bin/r.terraflow
 %%GRASS_INST_DIR%%/bin/r.texture
 %%GRASS_INST_DIR%%/bin/r.thin
 %%GRASS_INST_DIR%%/bin/r.tile


More information about the svn-ports-all mailing list