Merge lp:~midori/midori/svgtrans into lp:midori

Proposed by Christian Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6400
Merged at revision: 6418
Proposed branch: lp:~midori/midori/svgtrans
Merge into: lp:midori
Diff against target: 56 lines (+28/-0)
2 files modified
cmake/FindConvert.cmake (+19/-0)
data/CMakeLists.txt (+9/-0)
To merge this branch: bzr merge lp:~midori/midori/svgtrans
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Olivier Duchateau (community) Needs Fixing
Review via email: mp+185650@code.launchpad.net

Commit message

Rasterize SVG to PNG with rsvg-convert

To post a comment you must log in.
Revision history for this message
Olivier Duchateau (duchateau-olivier) wrote :

In icons/CMakeLists.txt file SVG2PNG macro is not necessary, otherwise in scalable/ directory SVG images will be rasterized.

--- ./icons/CMakeLists.txt.orig 2013-09-20 16:37:11.000000000 +0000
+++ ./icons/CMakeLists.txt 2013-09-20 16:53:03.000000000 +0000
@@ -7,13 +7,7 @@

 macro(install_icon name cat size)
     file(GLOB FILENAME RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${size}/${name}.*")
- string(FIND ${FILENAME} ".svg" EXTENSION)
- if (EXTENSION GREATER -1)
- string(SUBSTRING ${FILENAME} 0 ${EXTENSION} BASENAME)
- SVG2PNG(${BASENAME} ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${size}/${cat})
- else ()
- install(FILES ${FILENAME} DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${size}/${cat})
- endif ()
+ install(FILES ${FILENAME} DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${size}/${cat})
 endmacro()

 foreach(SIZE 16x16 22x22 scalable)

review: Needs Fixing
Revision history for this message
Paweł Forysiuk (tuxator) wrote :

Seems to work properly

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'cmake/FindConvert.cmake'
2--- cmake/FindConvert.cmake 1970-01-01 00:00:00 +0000
3+++ cmake/FindConvert.cmake 2013-09-22 14:50:19 +0000
4@@ -0,0 +1,19 @@
5+# Copyright (C) 2013 Christian Dywan
6+# Copyright (C) 2013 Olivier Duchateau
7+
8+find_program (RSVG_CONVERT rsvg-convert)
9+
10+if (RSVG_CONVERT)
11+ set (CONVERT_FOUND TRUE)
12+ macro (SVG2PNG filename install_destination)
13+ string(REPLACE "/" "_" target ${filename})
14+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${filename}")
15+ add_custom_target ("${target}.png" ALL
16+ ${RSVG_CONVERT} --keep-aspect-ratio --format=png "${CMAKE_CURRENT_SOURCE_DIR}/${filename}.svg"
17+ --output "${CMAKE_CURRENT_BINARY_DIR}/${filename}.png"
18+ )
19+ install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${filename}.png"
20+ DESTINATION ${install_destination})
21+ endmacro (SVG2PNG filename)
22+endif ()
23+
24
25=== modified file 'data/CMakeLists.txt'
26--- data/CMakeLists.txt 2013-09-08 17:20:49 +0000
27+++ data/CMakeLists.txt 2013-09-22 14:50:19 +0000
28@@ -1,5 +1,10 @@
29 # Copyright (C) 2013 Christian Dywan <christian@twotoasts.de>
30
31+include(FindConvert)
32+if (NOT CONVERT_FOUND)
33+ message(FATAL_ERROR "rsvg-convert not found")
34+endif ()
35+
36 include(FindIntltool)
37 if (NOT INTLTOOL_MERGE_FOUND)
38 message(FATAL_ERROR "intltool-merge not found")
39@@ -15,6 +20,7 @@
40 string(FIND ${FILE} "midori." MIDORI_FILE)
41 string(FIND ${FILE} ".desktop" DESKTOP_FILE)
42 string(FIND ${FILE} ".appdata.xml" APPDATA_FILE)
43+ string(FIND ${FILE} ".svg" SVG_FILE)
44 if (FAQ_FILE GREATER -1)
45 install(FILES ${FILE} DESTINATION ${CMAKE_INSTALL_DOCDIR})
46 elseif (DESKTOP_FILE GREATER -1 AND NOT WIN32)
47@@ -24,6 +30,9 @@
48 string(SUBSTRING ${FILE} 0 ${APPDATA_FILE} DESKTOP_ID)
49 INTLTOOL_MERGE_APPDATA (${DESKTOP_ID} po)
50 # install(FILES ${FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata/)
51+ elseif (SVG_FILE GREATER -1)
52+ string(SUBSTRING ${FILE} 0 ${SVG_FILE} IMG_ID)
53+ SVG2PNG (${IMG_ID} "${CMAKE_INSTALL_DATADIR}/midori/res/")
54 elseif(MIDORI_FILE GREATER -1)
55 else()
56 string(FIND ${FILE} "/" IS_DIR)

Subscribers

People subscribed via source and target branches

to all changes: