rsvg-convert is much faster and more commonly installed.
Please send PSPP bug reports to bug-gnu-pspp@gnu.org.
+Changes after 1.6.2:
+
+ * Building from a Git repository, which previously required GIMP, now
+ requires rsvg-convert from librsvg2 instead.
+
Changes from 1.6.1 to 1.6.2:
* Bug fixes.
----------------------------------------
To build this project from the sources direct from the Git archive,
-you must install the prerequisites listed in README, plus the
+you must install the prerequisites listed in INSTALL, plus the
following:
* Autoconf 2.64 (or later).
* Texinfo 5.2 or later, to build the documentation.
- * Gimp -- 2.8.2 is known to work
+ * rsvg-convert from librsvg2.
After you install PSPP's prerequisites, you must obtain a copy of
Gnulib, then bootstrap the tree, as described in the sections below.
GNULIB = ../gnulib
GNULIB_TOOL = $(GNULIB)/gnulib-tool
+PYTHON3 = python3
+
GNULIB_MODULES = \
assert \
byteswap \
.PHONY: all gettextize clean
-# The "convert" program from imagemagick can be used to create png from svg but doesn't properly deal
-# with the alpha channels. Therefore, it is not recommended for production pspp builds, but might
-# be useful to get something working on a platform which doesn't have a working gimp.
-
-#svg2png=convert -background transparent $1 $3
-
# Graphical layout of icons and our portfolio
# ===========================================
#
# => all others are in scaled (just one design svg)
#
+SVG2PNG = PYTHON3='$(PYTHON3)' build-aux/svg2png
+
# Rule for icons with size dependent graphical design
src/ui/gui/icons/%.png: src/ui/gui/artwork/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
# Rules for icons which are simply scaled - Attention multitarget would trigger only once...
src/ui/gui/icons/16x16/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
src/ui/gui/icons/22x22/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
src/ui/gui/icons/24x24/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
src/ui/gui/icons/32x32/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
src/ui/gui/icons/48x48/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
src/ui/gui/icons/96x96/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
src/ui/gui/icons/256x256/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
mkdir -p $(dir $@)
- build-aux/svg2png "$<" "$(lastword $^)" "$@"
+ $(SVG2PNG) "$<" "$(lastword $^)" "$@"
# Copy svg
src/ui/gui/icons/%.svg: src/ui/gui/artwork/%.svg
#
## Process this file with automake to produce Makefile.in -*- makefile -*-
-EXTRA_DIST += build-aux/svg2png build-aux/icon-list
+EXTRA_DIST += build-aux/png-add-comment build-aux/svg2png build-aux/icon-list
--- /dev/null
+#! /usr/bin/python3
+
+import codecs
+import os
+import struct
+import sys
+import zlib
+
+if len(sys.argv) != 3 or '--help' in sys.argv:
+ sys.stdout.write("""\
+%s: adds a comment to a PNG file
+usage: png-add-comment KEYWORD TEXT < INPUT.PNG > OUTPUT.PNG
+where KEYWORD is the comment type, e.g. "Comment" or "Copyright"
+ and TEXT is the comment's content (encoded in Latin-1).
+""" % sys.argv[0])
+ sys.exit(0)
+
+if os.isatty(1):
+ sys.stderr.write("%s: not writing binary data to a terminal "
+ "(use --help for help)\n")
+ sys.exit(1)
+
+infile = sys.stdin.buffer
+outfile = sys.stdout.buffer
+
+encoded_keyword = codecs.encode(sys.argv[1], "ASCII")
+if len(encoded_keyword) > 79:
+ sys.stderr.write("%s: keyword must be 79 bytes or less\n" % sys.argv[0])
+
+encoded_comment = codecs.encode(sys.argv[2], "Latin-1")
+comment_data = encoded_keyword + bytes([0]) + encoded_comment
+comment_crc = zlib.crc32(b'tEXt' + comment_data, 0)
+comment_chunk = struct.pack('!L', len(comment_data)) + b'tEXt' + comment_data + struct.pack('!L', comment_crc)
+
+def read_fully(stream, n):
+ data = stream.read(n)
+ if len(data) != n:
+ sys.stderr.write("%s: unexpected end of input\n" % sys.argv[0])
+ sys.exit(1)
+ return data
+
+# Copy signature and verify that we're working with a PNG file.
+signature = read_fully(infile, 8)
+if signature != bytes([137, 80, 78, 71, 13, 10, 26, 10]):
+ sys.stderr.write("%s: input is not a PNG file\n" % sys.argv[0])
+ sys.exit(1)
+outfile.write(signature)
+
+comment_written = False
+while True:
+ header = read_fully(infile, 8)
+ chunk_len, chunk_type = struct.unpack('!L 4s', header)
+ chunk_data = read_fully(infile, chunk_len)
+ chunk_crc = read_fully(infile, 4)
+
+ if (chunk_type in (b'iCCP', b'sRGB', b'sBIT', b'gAMA', b'cHRM',
+ b'PLTE', b'tRNS', b'hIST', b'bKGD', b'IDAT',
+ b'IEND')) and not comment_written:
+ outfile.write(comment_chunk)
+ comment_written = True
+
+ outfile.write(header)
+ outfile.write(chunk_data)
+ outfile.write(chunk_crc)
+ crc = struct.unpack('!L', chunk_crc)[0]
+ expected_crc = zlib.crc32(header[4:8] + chunk_data, 0)
+ if crc != expected_crc:
+ sys.stderr.write("%s: bad crc reading PNG chunk\n"
+ % sys.argv[0])
+ if chunk_type == b'IEND':
+ break
+assert comment_written
stripprefix=${3#src*icons\/}
width=${stripprefix%%x*}
-if (gimp --version) >/dev/null 2>&1; then
- echo "Converting $1 to $3 size $widthx$width with GIMP"
- comment=`cat $2`
- # If no width can be extracted from the destination path
- # then take the natural width by setting width to 0
- case "$width" in
- [0-9][0-9] | [0-9][0-9][0-9]) ;;
- *) width="0";;
- esac
- gimp -i -d -b "\
-(let* ((image (car (file-svg-load 1 \"$1\" \"$1\" 90 $width $width 0 ))))
- (gimp-image-attach-parasite image '(\"gimp-comment\" 0 \"$comment\"))
- (gimp-file-save 1 image (car (gimp-image-get-active-drawable image))
- \"$3\" \"$3\"))
- (gimp-quit 1)"
-elif (rsvg-convert --version) >/dev/null 2>&1; then
- echo "Converting $1 to $3 size $widthx$width with rsvg-convert"
- case $width in
- [0-9][0-9] | [0-9][0-9][0-9]) widthoption="--width=$width --height=$width" ;;
- *) widthoption= ;;
- esac
- rsvg-convert $widthoption "$1" > "$3"
-else
- echo "$0: can't find gimp or rsvg-convert" >&2
- exit 1
-fi
+comment=`cat $2`
+case $width in
+ [0-9][0-9] | [0-9][0-9][0-9]) widthoption="--width=$width --height=$width" ;;
+ *) widthoption= ;;
+esac
+rsvg-convert $widthoption "$1" | ${PYTHON3:-python3} build-aux/png-add-comment Comment "$comment" > "$3"