Skip to content

Commit

Permalink
Rather than clean generated icons, plan to distribute them
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr authored and instagibbs committed Apr 10, 2019
1 parent d389515 commit f60462d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 53 deletions.
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,6 @@ case $host in
esac

AM_CONDITIONAL([CAN_RENDER_ICONS], [test x$can_render_icons = xyes])
if test x$can_render_icons != xyes; then
AC_MSG_WARN([Couldn't find ${can_render_icons}; you won't get the Knots-branded Bitcoin icon])
fi

if test x$use_pkgconfig = xyes; then
m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)])
Expand Down
45 changes: 45 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,51 @@ if EMBEDDED_LEVELDB
include Makefile.leveldb.include
endif

# Rendered icons must be here, not in Makefile.qt.include, since they are distributed with the source tarball

RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg

RES_RENDERED_ICONS = \
qt/res/rendered_icons/about.png \
qt/res/rendered_icons/bitcoin.ico \
qt/res/rendered_icons/bitcoin1024.png

RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \
qt/res/rendered_icons/about.svg \
$(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 290 512 1024) \
qt/res/rendered_icons/bitcoin.icns \
qt/res/rendered_icons/nsis-wizard.bmp

EXTRA_DIST += $(RES_RENDERED_ICON_SRC) $(RES_ALL_RENDERED_ICONS)

if CAN_RENDER_ICONS

qt/res/rendered_icons/about.png: qt/res/rendered_icons/about.svg
$(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 128x128+7+7 -colorspace Gray -strip $@

qt/res/rendered_icons/about.svg: qt/res/src/bitcoin.svg
@$(MKDIR_P) $(@D)
sed '/fill="white"/d;s/\(stop-color:\)#....../\1black/' < $< > $@

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

qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/bitcoin290.png
$(IMAGEMAGICK_CONVERT) $^ -crop 164x290+62+0 -border 0x12 -strip BMP3:$@

endif

if ENABLE_TESTS
include Makefile.test.include
endif
Expand Down
51 changes: 1 addition & 50 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,6 @@ BITCOIN_QT_H = \
qt/walletview.h \
qt/winshutdownmonitor.h

RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg

RES_RENDERED_ICONS = \
qt/res/rendered_icons/about.png \
qt/res/rendered_icons/bitcoin.ico \
qt/res/rendered_icons/bitcoin1024.png

RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \
qt/res/rendered_icons/about.svg \
$(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 290 512 1024) \
qt/res/rendered_icons/bitcoin.icns \
qt/res/rendered_icons/nsis-wizard.bmp

RES_ICONS = $(RES_RENDERED_ICONS) \
qt/res/icons/add.png \
qt/res/icons/address-book.png \
Expand Down Expand Up @@ -453,7 +440,7 @@ $(QT_QRC_CPP): $(QT_QRC_BUILD) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MO
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@

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)
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD)

CLEANFILES += $(CLEAN_QT)

Expand All @@ -479,39 +466,3 @@ moc_%.cpp: %.h
@test -f $(LRELEASE)
@$(MKDIR_P) $(@D)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@

EXTRA_DIST += $(RES_RENDERED_ICON_SRC)

if CAN_RENDER_ICONS

qt/res/rendered_icons/about.png: qt/res/rendered_icons/about.svg
$(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 128x128+7+7 -colorspace Gray -strip $@

qt/res/rendered_icons/about.svg: qt/res/src/bitcoin.svg
@$(MKDIR_P) $(@D)
sed '/fill="white"/d;s/\(stop-color:\)#....../\1black/' < $< > $@

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

qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/bitcoin290.png
$(IMAGEMAGICK_CONVERT) $^ -crop 164x290+62+0 -border 0x12 -strip BMP3:$@

else

qt/res/rendered_icons/%: qt/res/icons/%
@$(MKDIR_P) $(@D)
cp $< $@

endif

0 comments on commit f60462d

Please sign in to comment.