1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

- 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.
This commit is contained in:
Alexey Dokuchaev 2019-03-22 07:51:01 +00:00
parent 69de523ba9
commit c4a01e479e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=496552
3 changed files with 60 additions and 4 deletions

View File

@ -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>

View File

@ -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)

View File

@ -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);
}