aboutsummaryrefslogtreecommitdiff
path: root/graphics/milton
diff options
context:
space:
mode:
authorAlexey Dokuchaev <danfe@FreeBSD.org>2019-03-22 07:51:01 +0000
committerAlexey Dokuchaev <danfe@FreeBSD.org>2019-03-22 07:51:01 +0000
commitc4a01e479e3198422878ba586ce5631aded75603 (patch)
treefa0941716f232b9ab26237778f82a0e77439c947 /graphics/milton
parent69de523ba9380e4d60a32bd9f61bf5f82d2f0d9d (diff)
downloadports-c4a01e479e3198422878ba586ce5631aded75603.tar.gz
ports-c4a01e479e3198422878ba586ce5631aded75603.zip
- 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.
Notes
Notes: svn path=/head/; revision=496552
Diffstat (limited to 'graphics/milton')
-rw-r--r--graphics/milton/Makefile25
-rw-r--r--graphics/milton/files/patch-CMakeLists.txt15
-rw-r--r--graphics/milton/files/patch-src_platform__linux.cc24
3 files changed, 60 insertions, 4 deletions
diff --git a/graphics/milton/Makefile b/graphics/milton/Makefile
index c35db9eb9ac1..b8027b377258 100644
--- a/graphics/milton/Makefile
+++ b/graphics/milton/Makefile
@@ -4,12 +4,15 @@
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
@@ -17,16 +20,32 @@ 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>
diff --git a/graphics/milton/files/patch-CMakeLists.txt b/graphics/milton/files/patch-CMakeLists.txt
index 297a12bb8c25..d619b8e3f494 100644
--- a/graphics/milton/files/patch-CMakeLists.txt
+++ b/graphics/milton/files/patch-CMakeLists.txt
@@ -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)
diff --git a/graphics/milton/files/patch-src_platform__linux.cc b/graphics/milton/files/patch-src_platform__linux.cc
new file mode 100644
index 000000000000..f9bbe6a7f565
--- /dev/null
+++ b/graphics/milton/files/patch-src_platform__linux.cc
@@ -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);
+ }