Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Mar 2019 07:51:01 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r496552 - in head/graphics/milton: . files
Message-ID:  <201903220751.x2M7p1RG045805@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Fri Mar 22 07:51:01 2019
New Revision: 496552
URL: https://svnweb.freebsd.org/changeset/ports/496552

Log:
  - Fix LICENSE: their website says it's MIT, but the source code comes
    with GPLv3 boilerplate file and README.md says "GPLv3 or later";
  
  - Milton comes with custom TTF font, without it GUI looks pretty bad,
    so install it under ${DATADIR} and set the font path in the program;
  
  - Similar to WIN32 code, set window icon in the platform_setup_cursor()
    function using the IMG_Load() from SDL2 ``image'' package.  While it
    can load Windows ICO files directly, for files with multiple images,
    the first one found with the highest color count is chosen, which in
    our case is 16x16x32 (the smallest).  Tentatively extract all icons
    as PNG files, install them all, and use 256x256 icon by default.

Added:
  head/graphics/milton/files/patch-src_platform__linux.cc   (contents, props changed)
Modified:
  head/graphics/milton/Makefile
  head/graphics/milton/files/patch-CMakeLists.txt

Modified: head/graphics/milton/Makefile
==============================================================================
--- head/graphics/milton/Makefile	Fri Mar 22 07:47:44 2019	(r496551)
+++ head/graphics/milton/Makefile	Fri Mar 22 07:51:01 2019	(r496552)
@@ -4,29 +4,48 @@
 PORTNAME=	milton
 PORTVERSION=	1.6.0
 DISTVERSIONPREFIX=	v
+PORTREVISION=	1
 CATEGORIES=	graphics
 
 MAINTAINER=	danfe@FreeBSD.org
 COMMENT=	Infinite-canvas paint program
 
-LICENSE=	MIT
+LICENSE=	GPLv3+
 
+BUILD_DEPENDS=	icotool:graphics/icoutils
+
 USE_GITHUB=	yes
 GH_ACCOUNT=	serge-rgb
 
 USES=		cmake gl gnome
 USE_GL=		gl
 USE_GNOME=	gtk20
-USE_SDL=	sdl2
+USE_SDL=	sdl2 image2
+INSTALLS_ICONS=	yes
 
-PLIST_FILES=	bin/milton
+PLIST_FILES=	bin/milton ${DATADIR_REL}/Carlito.ttf
+.for n in 16 32 48 64 128 256
+PLIST_FILES+=	share/icons/hicolor/${n}x${n}/apps/milton.png
+.endfor
 
 post-patch:
 	@${REINPLACE_CMD} -e 's:__linux__:__${OPSYS}__:' \
 		${WRKSRC}/src/easytab.h
+	@${REINPLACE_CMD} -e 's:Carlito\.ttf:${DATADIR}/&:' \
+		${WRKSRC}/src/sdl_milton.cc
+	@${REINPLACE_CMD} -e 's:milton\.png:${PREFIX}/share/icons/hicolor/256x256/apps/&:' \
+		${WRKSRC}/src/platform_linux.cc
 
 do-install:
 	${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/Milton \
 		${STAGEDIR}${PREFIX}/bin/milton
+	@${MKDIR} ${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${WRKSRC}/third_party/Carlito.ttf \
+		${STAGEDIR}${DATADIR}
+.for n in 16 32 48 64 128 256
+	@${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/${n}x${n}/apps
+	${INSTALL_DATA} ${INSTALL_WRKSRC}/milton_icon_?_${n}x${n}x32.png \
+		${STAGEDIR}${PREFIX}/share/icons/hicolor/${n}x${n}/apps/milton.png
+.endfor
 
 .include <bsd.port.mk>

Modified: head/graphics/milton/files/patch-CMakeLists.txt
==============================================================================
--- head/graphics/milton/files/patch-CMakeLists.txt	Fri Mar 22 07:47:44 2019	(r496551)
+++ head/graphics/milton/files/patch-CMakeLists.txt	Fri Mar 22 07:51:01 2019	(r496552)
@@ -40,7 +40,20 @@
      ${XINPUT_LIBRARY}
 -    ${SDL2DIR}/build/linux64/lib/libSDL2maind.a
 -    ${SDL2DIR}/build/linux64/lib/libSDL2d.a
-+    ${SDL2_LIBRARIES}
++    ${SDL2_LIBRARIES} SDL2_image
      ${CMAKE_THREAD_LIBS_INIT}
      ${CMAKE_DL_LIBS}
      )
+@@ -132,11 +132,8 @@ if(WIN32 OR APPLE)
+ endif()
+ 
+ add_custom_command(TARGET Milton POST_BUILD
+-  COMMAND ${CMAKE_COMMAND} -E copy
++  COMMAND icotool -x
+     ${CMAKE_CURRENT_LIST_DIR}/milton_icon.ico
+-    ${CMAKE_CURRENT_LIST_DIR}/third_party/Carlito.ttf
+-    ${CMAKE_CURRENT_LIST_DIR}/third_party/Carlito.LICENSE
+-    $<TARGET_FILE_DIR:Milton>
+ )
+ 
+ add_dependencies(Milton shadergen)

Added: head/graphics/milton/files/patch-src_platform__linux.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/milton/files/patch-src_platform__linux.cc	Fri Mar 22 07:51:01 2019	(r496552)
@@ -0,0 +1,24 @@
+--- src/platform_linux.cc.orig	2019-03-15 04:11:43 UTC
++++ src/platform_linux.cc
+@@ -1,6 +1,8 @@
+ // Copyright (c) 2015 Sergio Gonzalez. All rights reserved.
+ // License: https://github.com/serge-rgb/milton#license
+ 
++#include <SDL_image.h>
++
+ #include "platform.h"
+ 
+ #include "common.h"
+@@ -318,5 +320,12 @@ platform_deinit(PlatformState* platform)
+ void
+ platform_setup_cursor(Arena* arena, PlatformState* platform)
+ {
++    SDL_Surface *surface;
+ 
++    surface = IMG_Load("milton.png");
++    if (surface == NULL)
++        return;
++
++    SDL_SetWindowIcon(platform->window, surface);
++    SDL_FreeSurface(surface);
+ }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903220751.x2M7p1RG045805>