- Belatedly update to version 3.1.7
- Install and show window icon - Shorten COMMENT, install README file - Reclaim maintainership while here
This commit is contained in:
parent
ecb41782d7
commit
6be0c37958
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=518920
@ -2,15 +2,14 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= simpleviewer
|
||||
PORTVERSION= 2.92
|
||||
PORTREVISION= 7
|
||||
PORTVERSION= 3.1.7
|
||||
CATEGORIES= graphics
|
||||
MASTER_SITES= https://bitbucket.org/andreyu/simple-viewer-gl/get/
|
||||
DISTNAME= v${PORTVERSION} # version tag, thus no embedded ${PORTNAME}
|
||||
DIST_SUBDIR= ${PORTNAME} # and hence the need for ${DIST_SUBDIR}
|
||||
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
COMMENT= Small and simple OpenGL image viewer with transparency support
|
||||
MAINTAINER= danfe@FreeBSD.org
|
||||
COMMENT= Small and simple image viewer based on OpenGL
|
||||
|
||||
LICENSE= GPLv2
|
||||
|
||||
@ -30,16 +29,28 @@ USES= cmake:insource compiler:c++11-lang gl jpeg pkgconfig tar:bzip2 \
|
||||
USE_GL= glu
|
||||
USE_XORG= ice sm x11 xcursor xext xinerama xrandr xxf86vm
|
||||
|
||||
WRKSRC= ${WRKDIR}/andreyu-simple-viewer-gl-b3bd8710e176
|
||||
WRKSRC= ${WRKDIR}/andreyu-simple-viewer-gl-d8928067922d
|
||||
|
||||
PLIST_FILES= bin/sviewgl
|
||||
PLIST_FILES= bin/sviewgl ${DATADIR_REL}/Icon-1024.png \
|
||||
${DATADIR_REL}/Icon-16.png ${DATADIR_REL}/Icon-32.png
|
||||
PORTDOCS= README.md
|
||||
PORTEXAMPLES= config.example
|
||||
SUB_FILES= pkg-message
|
||||
|
||||
OPTIONS_DEFINE= EXAMPLES
|
||||
OPTIONS_DEFINE= DOCS EXAMPLES
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's,%%DATADIR%%,${DATADIR},' \
|
||||
${WRKSRC}/src/main.cpp
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/sviewgl ${STAGEDIR}${PREFIX}/bin
|
||||
@${MKDIR} ${STAGEDIR}${DATADIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/res/Icon-*.png ${STAGEDIR}${DATADIR}
|
||||
|
||||
do-install-DOCS-on:
|
||||
@${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
|
||||
|
||||
do-install-EXAMPLES-on:
|
||||
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
|
||||
|
@ -1,3 +1,3 @@
|
||||
TIMESTAMP = 1494869203
|
||||
SHA256 (simpleviewer/v2.92.tar.bz2) = 9d8ff147a932da3f1e627a6e30f63609921b707642c560368396ce7e7b11f91c
|
||||
SIZE (simpleviewer/v2.92.tar.bz2) = 290889
|
||||
TIMESTAMP = 1573635164
|
||||
SHA256 (simpleviewer/v3.1.7.tar.bz2) = 7ac309f080d7095f824b580fb02b066914c81b0bef1daa82cd474d06e23bf7f7
|
||||
SIZE (simpleviewer/v3.1.7.tar.bz2) = 893495
|
||||
|
11
graphics/simpleviewer/files/patch-CMakeLists.txt
Normal file
11
graphics/simpleviewer/files/patch-CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
--- CMakeLists.txt.orig 2018-09-10 11:03:52 UTC
|
||||
+++ CMakeLists.txt
|
||||
@@ -27,7 +27,7 @@ message(STATUS "***************************")
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
message(STATUS "* Release Build *")
|
||||
add_definitions("-DNDEBUG" )
|
||||
- add_definitions("-Wall -Wextra -pedantic -pedantic-errors -O2")
|
||||
+ add_definitions("-Wall -Wextra")
|
||||
else()
|
||||
message(STATUS "* Debug Build *")
|
||||
add_definitions("-DDEBUG" )
|
94
graphics/simpleviewer/files/patch-src_main.cpp
Normal file
94
graphics/simpleviewer/files/patch-src_main.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
--- src/main.cpp.orig 2019-11-13 08:52:44 UTC
|
||||
+++ src/main.cpp
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "viewer.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
+#include <png.h>
|
||||
|
||||
#include <clocale>
|
||||
#include <cstdio>
|
||||
@@ -148,6 +149,64 @@ namespace
|
||||
::printf("(EE) GLFW error (%d) '%s'\n", e, error);
|
||||
}
|
||||
|
||||
+ // Based on https://gist.github.com/niw/5963798
|
||||
+ void load_png_icon(const char *filename, GLFWimage *icon)
|
||||
+ {
|
||||
+ png_byte color_type;
|
||||
+ png_byte bit_depth;
|
||||
+
|
||||
+ FILE *fp = fopen(filename, "rb");
|
||||
+ if (!fp) return;
|
||||
+
|
||||
+ png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
+ if (!png) return;
|
||||
+ png_infop info = png_create_info_struct(png);
|
||||
+ if (!info) return;
|
||||
+ if (setjmp(png_jmpbuf(png))) return;
|
||||
+
|
||||
+ png_init_io(png, fp);
|
||||
+ png_read_info(png, info);
|
||||
+
|
||||
+ icon->width = png_get_image_width(png, info);
|
||||
+ icon->height = png_get_image_height(png, info);
|
||||
+ color_type = png_get_color_type(png, info);
|
||||
+ bit_depth = png_get_bit_depth(png, info);
|
||||
+
|
||||
+ // Read any color_type into 8bit depth, RGBA format.
|
||||
+ // See http://www.libpng.org/pub/png/libpng-manual.txt
|
||||
+ if (bit_depth == 16)
|
||||
+ png_set_strip_16(png);
|
||||
+ if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
+ png_set_palette_to_rgb(png);
|
||||
+ // PNG_COLOR_TYPE_GRAY_ALPHA is always 8 or 16 bit depth.
|
||||
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||
+ png_set_expand_gray_1_2_4_to_8(png);
|
||||
+ if (png_get_valid(png, info, PNG_INFO_tRNS))
|
||||
+ png_set_tRNS_to_alpha(png);
|
||||
+ // These color_type don't have an alpha channel then fill it with 0xFF.
|
||||
+ if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||
+ color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
+ color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
+ png_set_filler(png, 0xFF, PNG_FILLER_AFTER);
|
||||
+ if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
+ png_set_gray_to_rgb(png);
|
||||
+ png_read_update_info(png, info);
|
||||
+
|
||||
+ // Allocate contiguous memory region; caller has to delete[].
|
||||
+ icon->pixels = new unsigned char[icon->width * icon->height * 4];
|
||||
+
|
||||
+ auto *row_pointers = new png_bytep[icon->height];
|
||||
+ png_byte bpr = png_get_rowbytes(png, info);
|
||||
+ for (int y = 0; y < icon->height; y++)
|
||||
+ row_pointers[y] = icon->pixels + y * bpr;
|
||||
+
|
||||
+ png_read_image(png, row_pointers);
|
||||
+ delete[] row_pointers;
|
||||
+ png_destroy_read_struct(&png, &info, NULL);
|
||||
+ fclose(fp);
|
||||
+ }
|
||||
+
|
||||
void setup(GLFWwindow* window)
|
||||
{
|
||||
glfwMakeContextCurrent(window);
|
||||
@@ -173,6 +232,18 @@ namespace
|
||||
#if GLFW_VERSION_MAJOR >= 3 && GLFW_VERSION_MINOR >= 1
|
||||
glfwSetDropCallback(window, callbackDrop);
|
||||
#endif
|
||||
+
|
||||
+ GLFWimage icons[3];
|
||||
+
|
||||
+ load_png_icon("%%DATADIR%%/Icon-1024.png", &icons[0]);
|
||||
+ load_png_icon("%%DATADIR%%/Icon-32.png", &icons[1]);
|
||||
+ load_png_icon("%%DATADIR%%/Icon-16.png", &icons[2]);
|
||||
+
|
||||
+ glfwSetWindowIcon(window, 3, icons);
|
||||
+
|
||||
+ delete[] icons[2].pixels;
|
||||
+ delete[] icons[1].pixels;
|
||||
+ delete[] icons[0].pixels;
|
||||
}
|
||||
|
||||
GLFWwindow* createWindowedWindow(int width, int height, GLFWwindow* parent, const sConfig& config)
|
Loading…
Reference in New Issue
Block a user