From: Simon Tatham Date: Wed, 27 Oct 2021 17:29:18 +0000 (+0100) Subject: Work around Inkscape command-line breaking change. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~sgtatham/git?a=commitdiff_plain;h=84eecc5f176b9ec2b061c43ce1db5b2c3993bbc5;p=chroma-debian.git Work around Inkscape command-line breaking change. It looks as if Inkscape 1.0 changed the command-line syntax for converting an SVG into a PNG, and didn't provide any syntax I can see that works in both versions. Bodge around that with an initial run of 'inkscape --version', so that this package build should work both before and after that breaking change. --- diff --git a/resources/inkscape_export.pm b/resources/inkscape_export.pm new file mode 100644 index 0000000..7e0545e --- /dev/null +++ b/resources/inkscape_export.pm @@ -0,0 +1,13 @@ +our $inkscape_export_option = undef; + +sub inkscape_export { + my ($opts, $width, $height, $outfile, $infile) = @_; + unless (defined $inkscape_export_option) { + my $ver = `inkscape --version`; + $inkscape_export_option = ($ver =~ /Inkscape 0\./) ? "-e" : "-o"; + } + + system "inkscape $opts -w $width -h $height $inkscape_export_option $outfile $infile"; +} + +1; diff --git a/resources/make-base-marble.pl b/resources/make-base-marble.pl index 6f4821c..a20f078 100755 --- a/resources/make-base-marble.pl +++ b/resources/make-base-marble.pl @@ -21,6 +21,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +require './inkscape_export.pm'; + if($#ARGV != 1) { print STDERR "Usage: make-base-marble.pl \n"; @@ -69,5 +71,5 @@ sub make_pieces $background = ""; # Use Inkscape to convert the SVG to a PNG - system("inkscape $background -w $width_png -h $height_png -e $file_png $file_svg"); + inkscape_export($background, $width_png, $height_png, $file_png, $file_svg); } diff --git a/resources/make-pieces-marble.pl b/resources/make-pieces-marble.pl index a4e3968..e786bf9 100755 --- a/resources/make-pieces-marble.pl +++ b/resources/make-pieces-marble.pl @@ -21,6 +21,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +require './inkscape_export.pm'; + if($#ARGV != 1) { print STDERR "Usage: make-pieces-marble.pl \n"; @@ -88,7 +90,7 @@ sub make_pieces $background = "-b \"#000000\"" if($partial); # Use Inkscape to convert the SVG to a PNG - system("inkscape $background -w $width_png -h $height_png -e $file_png $file_svg"); + inkscape_export($background, $width_png, $height_png, $file_png, $file_svg); for($piece = 0; $piece < $rows * $columns; $piece ++) { diff --git a/resources/make-pieces-neon.pl b/resources/make-pieces-neon.pl index 7e8c29e..c9d6c67 100755 --- a/resources/make-pieces-neon.pl +++ b/resources/make-pieces-neon.pl @@ -34,6 +34,8 @@ # Use blur-full for most pieces, blur-half for earth and earth_double, and # blur-quarter for earth_directional, maps and teleport. +require './inkscape_export.pm'; + if($#ARGV != 0) { print STDERR "Usage: make-pieces-neon.pl \n"; @@ -96,13 +98,13 @@ sub make_pieces $height_png = $height * ($columns * 2 + 1); $file_png_base = "/tmp/chroma-pieces-base-$$.png"; - system("inkscape -w $width_png -h $height_png -e $file_png_base $file_svg_base"); + inkscape_export("", $width_png, $height_png, $file_png_base, $file_svg_base); $file_png_overlay = "/tmp/chroma-pieces-overlay-$$.png"; - system("inkscape -w $width_png -h $height_png -e $file_png_overlay $file_svg_overlay"); + inkscape_export("", $width_png, $height_png, $file_png_overlay, $file_svg_overlay); $file_png_overlay_double = "/tmp/chroma-pieces-double-$$.png"; - system("inkscape -w $width_png -h $height_png -e $file_png_overlay_double $file_svg_overlay_double"); + inkscape_export("", $width_png, $height_png, $file_png_overlay_double, $file_svg_overlay_double); $file_png_partial = "/tmp/chroma-pieces-partial-$$.png"; system("convert -compose overlay -composite $file_png_base $file_png_overlay $file_png_partial"); diff --git a/resources/make-pieces-zen.pl b/resources/make-pieces-zen.pl index 95538be..280a982 100755 --- a/resources/make-pieces-zen.pl +++ b/resources/make-pieces-zen.pl @@ -21,6 +21,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +require './inkscape_export.pm'; if($#ARGV != 1) { @@ -85,7 +86,7 @@ sub make_pieces $background = "-b \"#000000\"" if($partial); # Use Inkscape to convert the SVG to a PNG - system("inkscape $background -w $width_png -h $height_png -e $file_png $file_svg"); + inkscape_export($background, $width_png, $height_png, $file_png, $file_svg); for($piece = 0; $piece < $rows * $columns; $piece ++) { diff --git a/resources/make-wall-marble.pl b/resources/make-wall-marble.pl index 1d39ca6..c15e495 100755 --- a/resources/make-wall-marble.pl +++ b/resources/make-wall-marble.pl @@ -21,6 +21,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +require './inkscape_export.pm'; + if($#ARGV != 1) { print STDERR "Usage: make-wall-marble.pl \n"; @@ -69,5 +71,5 @@ sub make_pieces $background = ""; # Use Inkscape to convert the SVG to a PNG - system("inkscape $background -w $width_png -h $height_png -e $file_png $file_svg"); + inkscape_export($background, $width_png, $height_png, $file_png, $file_svg); }