From 25d73d627ae9ea72a37ac8daf9d52c6478252bea Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Thu, 6 Oct 2022 18:45:56 -0300 Subject: [PATCH] Remake non-mac icon; regenerate during build for windows The non-mac icon was an old version with white foreground and a completely transparent background, but this looks bad (or invisible) depending on where you view it. This updates it based on the macos icon, but with a round white circle background instead of the macos "squircle" background. This also replaces the .ico file for the installer with one that we build during the win32 build rather than a pregenerated one. Bumps the gui as well to a version with the new icons in place. --- .drone.jsonnet | 3 +-- cmake/macos.cmake | 2 +- cmake/win32_installer_deps.cmake | 8 +++++- contrib/lokinet-mac.svg | 4 +-- contrib/lokinet.svg | 45 ++++++++++++++++++++------------ contrib/make-ico.sh | 28 ++++++++++++++++++++ gui | 2 +- 7 files changed, 69 insertions(+), 23 deletions(-) create mode 100755 contrib/make-ico.sh diff --git a/.drone.jsonnet b/.drone.jsonnet index c8b741f9c..203746cca 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -13,7 +13,6 @@ local default_deps_base = [ ]; local default_deps_nocxx = ['libsodium-dev'] + default_deps_base; // libsodium-dev needs to be >= 1.0.18 local default_deps = ['g++'] + default_deps_nocxx; -local default_windows_deps = ['mingw-w64', 'zip', 'nsis']; local docker_base = 'registry.oxen.rocks/lokinet-ci-'; local submodule_commands = [ @@ -147,7 +146,7 @@ local windows_cross_pipeline(name, 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections', apt_get_quiet + ' update', apt_get_quiet + ' install -y eatmydata', - 'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y p7zip-full build-essential cmake git pkg-config ccache g++-mingw-w64-x86-64-posix nsis zip automake libtool', + 'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y p7zip-full build-essential cmake git pkg-config ccache g++-mingw-w64-x86-64-posix nsis zip icoutils automake libtool', 'update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix', 'update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix', 'JOBS=' + jobs + ' VERBOSE=1 ./contrib/windows.sh -DSTRIP_SYMBOLS=ON ' + diff --git a/cmake/macos.cmake b/cmake/macos.cmake index 1ca3aa0d9..a15a86e3d 100644 --- a/cmake/macos.cmake +++ b/cmake/macos.cmake @@ -127,7 +127,7 @@ endif() set(mac_icon "${PROJECT_BINARY_DIR}/lokinet.icns") add_custom_command(OUTPUT "${mac_icon}" COMMAND ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg "${mac_icon}" - DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh) + DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh) add_custom_target(icon DEPENDS "${mac_icon}") if(BUILD_PACKAGE) diff --git a/cmake/win32_installer_deps.cmake b/cmake/win32_installer_deps.cmake index e937cabee..e0591466e 100644 --- a/cmake/win32_installer_deps.cmake +++ b/cmake/win32_installer_deps.cmake @@ -32,8 +32,14 @@ endif() set(BOOTSTRAP_FILE "${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed") install(FILES ${BOOTSTRAP_FILE} DESTINATION share COMPONENT lokinet RENAME bootstrap.signed) +set(win_ico "${PROJECT_BINARY_DIR}/lokinet.ico") +add_custom_command(OUTPUT "${win_ico}" + COMMAND ${PROJECT_SOURCE_DIR}/contrib/make-ico.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg "${win_ico}" + DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg ${PROJECT_SOURCE_DIR}/contrib/make-ico.sh) +add_custom_target(icon ALL DEPENDS "${win_ico}") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "Lokinet") -set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/win32-setup/lokinet.ico") +set(CPACK_NSIS_MUI_ICON "${PROJECT_BINARY_DIR}/lokinet.ico") set(CPACK_NSIS_DEFINES "RequestExecutionLevel admin") set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) diff --git a/contrib/lokinet-mac.svg b/contrib/lokinet-mac.svg index ef9dd8b0e..10ddf0ca2 100644 --- a/contrib/lokinet-mac.svg +++ b/contrib/lokinet-mac.svg @@ -3,7 +3,7 @@ - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/contrib/make-ico.sh b/contrib/make-ico.sh new file mode 100755 index 000000000..9a0413a67 --- /dev/null +++ b/contrib/make-ico.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Invoked from cmake as make-ico.sh /path/to/icon.svg /path/to/output.ico +svg="$1" +out="$2" +outdir="$out.d" + +set -e + +sizes=(16 24 32 40 48 64 96 192 256) +outs="" + +mkdir -p "${outdir}" +for size in "${sizes[@]}"; do + outf="${outdir}/${size}x${size}.png" + if [ $size -lt 32 ]; then + # For 16x16 and 24x24 we crop the image to 3/4 of its regular size before resizing and make + # it all white (instead of transparent) which effectively zooms in on it a bit because if we + # resize the full icon it ends up a fuzzy mess, while the crop and resize lets us retain + # some detail of the logo. + convert -background white -resize 512x512 "$svg" -gravity Center -extent 320x320 -resize ${size}x${size} -strip "png32:$outf" + else + convert -background transparent -resize ${size}x${size} "$svg" -strip "png32:$outf" + fi + outs="-r $outf $outs" +done + +icotool -c -b 32 -o "$out" $outs diff --git a/gui b/gui index 37b1f015b..7b0f1aacd 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit 37b1f015b73586c404971e6724721d4f1343ed50 +Subproject commit 7b0f1aacdf79b558adfc39dc9cccb7e348aeec03