Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
513c7765
Commit
513c7765
authored
Apr 06, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: Improve error handling in the buildicon script.
parent
3b1b1863
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
buildicon
tools/buildicon
+25
-12
No files found.
tools/buildicon
View file @
513c7765
...
...
@@ -36,12 +36,27 @@ my $icoName = $1;
my
@pngFiles
;
# Get the programs from the environment variables
my
$convert
=
$ENV
{
"CONVERT"
};
$convert
=
"convert"
if
$convert
eq
""
;
my
$rsvg
=
$ENV
{
"RSVG"
};
$rsvg
=
"rsvg"
if
$rsvg
eq
""
;
my
$icotool
=
$ENV
{
"ICOTOOL"
};
$icotool
=
"icotool"
if
$icotool
eq
""
;
my
$convert
=
$ENV
{
"CONVERT"
}
||
"convert"
;
my
$rsvg
=
$ENV
{
"RSVG"
}
||
"rsvg"
;
my
$icotool
=
$ENV
{
"ICOTOOL"
}
||
"icotool"
;
sub
cleanup
()
{
unlink
$renderedSVGFileName
;
unlink
$_
foreach
(
@pngFiles
);
}
$SIG
{
"INT"
}
=
"cleanup"
;
$SIG
{
"HUP"
}
=
"cleanup"
;
$SIG
{
"TERM"
}
=
"cleanup"
;
$SIG
{
"__DIE__"
}
=
"cleanup"
;
# run a shell command and die on error
sub
shell
(@)
{
my
@args
=
@_
;
system
(
@args
)
==
0
or
die
"@args failed: $?"
;
}
sub
svg_element_start
{
...
...
@@ -67,7 +82,7 @@ sub svg_element_start
if
(
defined
(
$x
)
and
defined
(
$x
))
{
if
(
$x
=~
/\d*/
and
$y
=~
/\d*/
)
{
s
ystem
"$convert $renderedSVGFileName -crop '$size x$size+$x+$y' $pngFileName"
;
s
hell
$convert
,
$renderedSVGFileName
,
"-crop"
,
"${size}x${size}+$x+$y"
,
$pngFileName
;
}
}
...
...
@@ -96,7 +111,7 @@ sub resize_image
# Use ImageMagick to stretch the image
my
(
$size
)
=
@_
;
my
$pngFileName
=
"$icoName-$size.png"
;
s
ystem
"$convert $renderedSVGFileName -resize '$size x$size' $pngFileName"
;
s
hell
$convert
,
$renderedSVGFileName
,
"-resize"
,
"${size}x${size}"
,
$pngFileName
;
push
(
@pngFiles
,
$pngFileName
);
}
...
...
@@ -108,7 +123,7 @@ sub fallback_render
}
# Render the SVG image
s
ystem
'rsvg'
,
$svgFileName
,
$renderedSVGFileName
;
s
hell
'rsvg'
,
$svgFileName
,
$renderedSVGFileName
;
# Render the images in the SVG
my
$parser
=
new
XML::
Parser
(
...
...
@@ -120,9 +135,7 @@ $parser->parsefile("$svgFileName");
fallback_render
unless
(
@pngFiles
);
# Combine them into an ICO file
my
$icotoolCommand
=
"$icotool -c -o $icoFileName"
;
$icotoolCommand
.=
" $_"
foreach
(
@pngFiles
);
system
$icotoolCommand
;
shell
$icotool
,
"-c"
,
"-o"
,
$icoFileName
,
@pngFiles
;
# Delete the intermediate images
unlink
$renderedSVGFileName
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment