Render some icons when possible

8-bit icon is required to make builds deterministic
This commit is contained in:
Luke Dashjr 2016-02-05 06:58:18 +00:00
parent 7a74eee847
commit 52122c588a
7 changed files with 69 additions and 10 deletions

View File

@ -39,7 +39,7 @@ OSX_APP=Bitcoin-Qt.app
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME)) OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
OSX_DMG = $(OSX_VOLNAME).dmg OSX_DMG = $(OSX_VOLNAME).dmg
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns OSX_INSTALLER_ICONS=src/qt/res/rendered_icons/bitcoin.icns
OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
DIST_CONTRIB = \ DIST_CONTRIB = \
@ -58,7 +58,7 @@ BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \
$(top_srcdir)/contrib/devtools/security-check.py \ $(top_srcdir)/contrib/devtools/security-check.py \
$(top_srcdir)/contrib/devtools/utils.py $(top_srcdir)/contrib/devtools/utils.py
WINDOWS_PACKAGING = $(top_srcdir)/src/qt/res/icons/bitcoin.ico \ WINDOWS_PACKAGING = src/qt/res/rendered_icons/bitcoin.ico \
$(top_srcdir)/share/pixmaps/nsis-header.bmp \ $(top_srcdir)/share/pixmaps/nsis-header.bmp \
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp \ $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
$(top_srcdir)/doc/README_windows.txt $(top_srcdir)/doc/README_windows.txt
@ -71,6 +71,9 @@ COVERAGE_INFO = $(COV_TOOL_WRAPPER) baseline.info \
baseline_filtered.info functional_test.info functional_test_filtered.info \ baseline_filtered.info functional_test.info functional_test_filtered.info \
test_bitcoin_coverage.info test_bitcoin.info fuzz.info fuzz_filtered.info fuzz_coverage.info test_bitcoin_coverage.info test_bitcoin.info fuzz.info fuzz_filtered.info fuzz_coverage.info
$(OSX_INSTALLER_ICONS): FORCE
$(MAKE) -C src $(patsubst src/%,%,$@)
dist-hook: dist-hook:
-$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf - -$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -

View File

@ -680,6 +680,17 @@ AC_ARG_WITH([daemon],
[build_bitcoind=$withval], [build_bitcoind=$withval],
[build_bitcoind=yes]) [build_bitcoind=yes])
can_render_icons=yes
AC_PATH_PROGS([RSVG_CONVERT],[rsvg-convert rsvg],no)
AC_PATH_PROGS([IMAGEMAGICK_CONVERT],[convert],no)
AC_PATH_PROGS([PNG2ICNS],[png2icns],no)
if test x$RSVG_CONVERT = xno; then
can_render_icons='rsvg-convert'
elif test x$IMAGEMAGICK_CONVERT = xno; then
can_render_icons='(ImageMagick) convert'
fi
case $host in case $host in
*mingw*) *mingw*)
TARGET_OS=windows TARGET_OS=windows
@ -729,6 +740,10 @@ case $host in
AX_CHECK_LINK_FLAG([-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"], [], [$LDFLAG_WERROR]) AX_CHECK_LINK_FLAG([-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"], [], [$LDFLAG_WERROR])
;; ;;
*darwin*) *darwin*)
if test x$PNG2ICNS = xno; then
can_render_icons='png2icns'
fi
TARGET_OS=darwin TARGET_OS=darwin
if test $cross_compiling != "yes"; then if test $cross_compiling != "yes"; then
BUILD_OS=darwin BUILD_OS=darwin
@ -833,6 +848,11 @@ case $host in
;; ;;
esac esac
AM_CONDITIONAL([CAN_RENDER_ICONS], [test "$can_render_icons" = "yes"])
if test "$can_render_icons" != "yes"; then
AC_MSG_WARN([Couldn't find ${can_render_icons}; you won't get the Knots-branded Bitcoin icon])
fi
if test "$use_extended_functional_tests" != "no"; then if test "$use_extended_functional_tests" != "no"; then
AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended) AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended)
fi fi

View File

@ -15,7 +15,7 @@ Unicode true
!define URL @PACKAGE_URL@ !define URL @PACKAGE_URL@
# MUI Symbol Definitions # MUI Symbol Definitions
!define MUI_ICON "@abs_top_srcdir@/src/qt/res/icons/bitcoin.ico" !define MUI_ICON "@abs_top_srcdir@/src/qt/res/rendered_icons/bitcoin.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp"
!define MUI_HEADERIMAGE !define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT !define MUI_HEADERIMAGE_RIGHT

View File

@ -172,12 +172,20 @@ BITCOIN_QT_H = \
QT_RES_FONTS = \ QT_RES_FONTS = \
qt/res/fonts/RobotoMono-Bold.ttf qt/res/fonts/RobotoMono-Bold.ttf
QT_RES_ICONS = \ RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg
RES_RENDERED_ICONS = \
qt/res/rendered_icons/bitcoin.ico \
qt/res/rendered_icons/bitcoin1024.png
RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \
$(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 512 1024) \
qt/res/rendered_icons/bitcoin.icns
QT_RES_ICONS = $(RES_RENDERED_ICONS) \
qt/res/icons/add.png \ qt/res/icons/add.png \
qt/res/icons/address-book.png \ qt/res/icons/address-book.png \
qt/res/icons/bitcoin.ico \
qt/res/icons/bitcoin_testnet.ico \ qt/res/icons/bitcoin_testnet.ico \
qt/res/icons/bitcoin.png \
qt/res/icons/chevron.png \ qt/res/icons/chevron.png \
qt/res/icons/clock1.png \ qt/res/icons/clock1.png \
qt/res/icons/clock2.png \ qt/res/icons/clock2.png \
@ -293,6 +301,8 @@ QT_RES_ANIMATION = $(wildcard $(srcdir)/qt/res/animation/spinner-*.png)
BITCOIN_QT_RC = qt/res/bitcoin-qt-res.rc BITCOIN_QT_RC = qt/res/bitcoin-qt-res.rc
$(BITCOIN_RC): qt/res/rendered_icons/bitcoin.ico
BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER
qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
@ -384,7 +394,7 @@ $(QT_QRC_CPP): $(QT_QRC_BUILD) $(QT_FORMS_H) $(QT_RES_FONTS) $(QT_RES_ICONS) $(Q
@test -f $(RCC) @test -f $(RCC)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin --format-version 1 $< > $@ $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin --format-version 1 $< > $@
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) $(RES_ALL_RENDERED_ICONS)
CLEANFILES += $(CLEAN_QT) CLEANFILES += $(CLEAN_QT)
@ -422,3 +432,29 @@ moc_%.cpp: %.h
@test -f $(LRELEASE) @test -f $(LRELEASE)
@$(MKDIR_P) $(@D) @$(MKDIR_P) $(@D)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@ $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@
EXTRA_DIST += $(RES_RENDERED_ICON_SRC)
if CAN_RENDER_ICONS
qt/res/rendered_icons/bitcoin%.png: qt/res/src/bitcoin.svg
@$(MKDIR_P) $(@D)
$(RSVG_CONVERT) -f png -d $* -p $* < $< > $@
# NOTE: ImageMagick will never convert transparent PNGs to 8-bit ICOs, but GIF is fine
qt/res/rendered_icons/bitcoin%d8.gif: qt/res/rendered_icons/bitcoin%.png
$(IMAGEMAGICK_CONVERT) $^ -colors 256 -channel A -threshold '50%' $@
qt/res/rendered_icons/bitcoin.icns: $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 512 1024 32 16)
$(PNG2ICNS) $@ $^
qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 64 48 32 20 16)
$(IMAGEMAGICK_CONVERT) $^ $@
else
qt/res/rendered_icons/%: qt/res/icons/%
@$(MKDIR_P) $(@D)
cp $< $@
endif

View File

@ -1,6 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0"> <!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/icons"> <qresource prefix="/icons">
<file alias="bitcoin">res/icons/bitcoin.png</file> <file alias="bitcoin">res/rendered_icons/bitcoin1024.png</file>
<file alias="address-book">res/icons/address-book.png</file> <file alias="address-book">res/icons/address-book.png</file>
<file alias="send">res/icons/send.png</file> <file alias="send">res/icons/send.png</file>
<file alias="connect_0">res/icons/connect0.png</file> <file alias="connect_0">res/icons/connect0.png</file>

View File

@ -1,4 +1,4 @@
IDI_ICON1 ICON DISCARDABLE "icons/bitcoin.ico" IDI_ICON1 ICON DISCARDABLE "rendered_icons/bitcoin.ico"
IDI_ICON2 ICON DISCARDABLE "icons/bitcoin_testnet.ico" IDI_ICON2 ICON DISCARDABLE "icons/bitcoin_testnet.ico"
#include <windows.h> // needed for VERSIONINFO #include <windows.h> // needed for VERSIONINFO

View File

@ -7,7 +7,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" <svg version="1.1"
id="svg2" sodipodi:docname="bitcoin-logo-noshadow.svg" inkscape:version="0.48.2 r9819" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg2" sodipodi:docname="bitcoin-logo-noshadow.svg" inkscape:version="0.48.2 r9819" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1024px" height="1024px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1in" height="1in"
viewBox="-34 -34 580 580" enable-background="new 0 0 1024 1024" xml:space="preserve"> viewBox="-34 -34 580 580" enable-background="new 0 0 1024 1024" xml:space="preserve">
<!-- nice shadow with alpha 0.35 --> <!-- nice shadow with alpha 0.35 -->

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB