[143052] trunk/dports/science/gr-fosphor

michaelld at macports.org michaelld at macports.org
Sat Dec 12 08:21:17 PST 2015


Revision: 143052
          https://trac.macports.org/changeset/143052
Author:   michaelld at macports.org
Date:     2015-12-02 10:21:00 -0800 (Wed, 02 Dec 2015)
Log Message:
-----------
gr-fosphor:
+ update to 12c1a6d3 (20151112);
+ patch to temporarily add back in the PNG stuff removed in 12c1a6d3.

Modified Paths:
--------------
    trunk/dports/science/gr-fosphor/Portfile

Added Paths:
-----------
    trunk/dports/science/gr-fosphor/files/patch-add-png.diff

Modified: trunk/dports/science/gr-fosphor/Portfile
===================================================================
--- trunk/dports/science/gr-fosphor/Portfile	2015-12-02 17:04:08 UTC (rev 143051)
+++ trunk/dports/science/gr-fosphor/Portfile	2015-12-02 18:21:00 UTC (rev 143052)
@@ -22,10 +22,10 @@
 long_description    ${description}  \
     This port is kept up with the gr-fosphor GIT 'master' branch, which is typically updated weekly to monthly, providing compatibility with GNU Radio release 3.7 API: the gnuradio and gnuradio-devel ports.
 
-set commit          4ae2f539df6ec247751cc1f2196652c30ec25efe
-version             20150828
-checksums           rmd160 6d3532e75b88acbb4d1e9d2a085d4f14eb4f42d2 \
-                    sha256 ea946ded50f90e05e54ce1d6d11824b24ab830ec3e10e9f040c0d0daaf283440
+set commit          12c1a6d3f8e2b4540e870cfa612e51727fa0b1b1
+version             20151112
+checksums           rmd160 23e3dca61301fd87583485ff0ae537bee0af77c8 \
+                    sha256 784b8f3ca9a725e9642228b019a9e7155c9cad304b1fe6ebf6a3f7865fb84f73
 
 distname            ${name}-${commit}
 master_sites        http://cgit.osmocom.org/gr-fosphor/snapshot/
@@ -58,6 +58,10 @@
 
 patchfiles-append patch-cmake_Modules_FindGLFW3.cmake.diff
 
+# temporary patch to add back in the PNG stuff
+
+patchfiles-append patch-add-png.diff
+
 # remove top-level library path, such that internal libraries are used
 # instead of any already-installed ones.
 

Added: trunk/dports/science/gr-fosphor/files/patch-add-png.diff
===================================================================
--- trunk/dports/science/gr-fosphor/files/patch-add-png.diff	                        (rev 0)
+++ trunk/dports/science/gr-fosphor/files/patch-add-png.diff	2015-12-02 18:21:00 UTC (rev 143052)
@@ -0,0 +1,139 @@
+--- lib/fosphor/Makefile.orig
++++ lib/fosphor/Makefile
+@@ -1,7 +1,7 @@
+ UNAME=$(shell uname)
+ CC=gcc
+-CFLAGS=-Wall -Werror -O2 `pkg-config freetype2 glfw3 --cflags` -g
+-LDLIBS=`pkg-config freetype2 glfw3 --libs` -lm
++CFLAGS=-Wall -Werror -O2 `pkg-config freetype2 glfw3 libpng --cflags` -g
++LDLIBS=`pkg-config freetype2 glfw3 libpng --libs` -lm
+ ifneq ($(AMDAPPSDKROOT), )
+ CFLAGS+=-I$(AMDAPPSDKROOT)/include
+ endif
+--- lib/fosphor/gl_cmap_gen.c.orig
++++ lib/fosphor/gl_cmap_gen.c
+@@ -27,10 +27,16 @@
+  *  \brief OpenGL color map generators
+  */
+ 
++#include <errno.h>
+ #include <stdint.h>
++#include <stdlib.h>
++#include <string.h>
+ #include <math.h>
+ 
++#include <png.h>
++
+ #include "gl_cmap_gen.h"
++#include "resource.h"
+ 
+ 
+ static void
+@@ -128,6 +134,33 @@ _set_rgba_from_hsv(uint32_t *rgba, float h, float s, float v)
+ }
+ 
+ 
++static uint32_t
++_rgba_interpolate(uint32_t *rgba, int sz, int p, int N)
++{
++	int pos_i = (p * (sz-1)) / (N-1);
++	int pos_f = (p * (sz-1)) - (pos_i * (N-1));
++	uint32_t vl, vh, vf = 0;
++	int i;
++
++	if (pos_f == 0)
++		return rgba[pos_i];
++
++	vl = rgba[pos_i];
++	vh = rgba[pos_i+1];
++
++	for (i=0; i<4; i++)
++	{
++		uint32_t nv =
++			((vl >> (8 * i)) & 0xff) * ((N-1) - pos_f) +
++			((vh >> (8 * i)) & 0xff) * pos_f;
++
++		vf |= ((nv / (N-1)) & 0xff) << (8 * i);
++	}
++
++	return vf;
++}
++
++
+ int
+ fosphor_gl_cmap_histogram(uint32_t *rgba, int N, void *arg)
+ {
+@@ -179,4 +212,63 @@ fosphor_gl_cmap_waterfall(uint32_t *rgba, int N, void *arg)
+ 	return 0;
+ }
+ 
++int
++fosphor_gl_cmap_png(uint32_t *rgba, int N, void *arg)
++{
++	const char *rsrc_name = arg;
++	png_image img;
++	const void *png_data = NULL;
++	void *png_rgba = NULL;
++	int png_len, i, rv;
++
++	/* Grab the file */
++	png_data = resource_get(rsrc_name, &png_len);
++	if (!png_data)
++		return -ENOENT;
++
++	/* Read PNG */
++	memset(&img, 0x00, sizeof(img));
++	img.version = PNG_IMAGE_VERSION;
++
++	rv = png_image_begin_read_from_memory(&img, png_data, png_len);
++	if (!rv) {
++		rv = -EINVAL;
++		goto error;
++	}
++
++	img.format = PNG_FORMAT_RGBA;
++
++	png_rgba = malloc(sizeof(uint32_t) * img.width * img.height);
++	if (!png_rgba) {
++		rv = -ENOMEM;
++		goto error;
++	}
++
++	rv = png_image_finish_read(&img,
++		NULL,				/* background */
++		png_rgba,			/* buffer */
++		sizeof(uint32_t) * img.width,	/* row_stride */
++		NULL				/* colormap */
++	);
++	if (!rv) {
++		rv = -EINVAL;
++		goto error;
++	}
++
++	/* Interpolate the PNG to the requested linear scale */
++	for (i=0; i<N; i++)
++		rgba[i] = _rgba_interpolate(png_rgba, img.width, i, N);
++
++	/* Done */
++	rv = 0;
++
++error:
++	free(png_rgba);
++
++	if (png_data)
++		resource_put(png_data);
++
++	return rv;
++}
++
+ /*! @} */
+--- lib/fosphor/gl_cmap_gen.h.orig
++++ lib/fosphor/gl_cmap_gen.h
+@@ -34,6 +34,7 @@
+ 
+ int fosphor_gl_cmap_histogram(uint32_t *rgba, int N, void *arg);
+ int fosphor_gl_cmap_waterfall(uint32_t *rgba, int N, void *arg);
++int fosphor_gl_cmap_png(uint32_t *rgba, int N, void *rsrc_name);
+ 
+ /*! @} */
+ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151212/a9f27476/attachment.html>


More information about the macports-changes mailing list