From b09e9f92e90218578653e91495a88f97a66487d9 Mon Sep 17 00:00:00 2001 From: Rodrigo Hernandez Date: Wed, 29 May 2019 11:54:24 -0600 Subject: [PATCH 1/4] [librsvg] Initial librsvg port. This is version 2.40.20, the last C version of the library, moving forward would require rust compilation tools to be available in vcpkg. Should close issue #3865 --- ports/librsvg/CMakeLists.txt | 149 +++++++++++++++++++++++++++++++++++ ports/librsvg/CONTROL | 4 + ports/librsvg/config.h.linux | 89 +++++++++++++++++++++ ports/librsvg/portfile.cmake | 28 +++++++ 4 files changed, 270 insertions(+) create mode 100755 ports/librsvg/CMakeLists.txt create mode 100755 ports/librsvg/CONTROL create mode 100644 ports/librsvg/config.h.linux create mode 100755 ports/librsvg/portfile.cmake diff --git a/ports/librsvg/CMakeLists.txt b/ports/librsvg/CMakeLists.txt new file mode 100755 index 00000000000000..8952370ba9b591 --- /dev/null +++ b/ports/librsvg/CMakeLists.txt @@ -0,0 +1,149 @@ +cmake_minimum_required(VERSION 3.11) +project(librsvg C) + +find_package(unofficial-cairo CONFIG REQUIRED) +find_package(unofficial-libcroco CONFIG REQUIRED) +find_package(unofficial-glib CONFIG REQUIRED) +find_package(LibXml2 REQUIRED) +find_library(PANGO_LIB pango-1.0) +find_library(PANGO_CAIRO_LIB pangocairo-1.0) +find_library(GDK_PIXBUF_LIB gdk_pixbuf-2.0) +find_path(CAIRO_INCLUDE_DIR cairo/cairo.h) + +# Add include directories +include_directories(${CAIRO_INCLUDE_DIR} ${GDK_PIXBUF_INCLUDE_DIR}) + +set(LIBRSVG_SOURCES + librsvg-features.c + rsvg-css.c + rsvg-css.h + rsvg-compat.h + rsvg-defs.c + rsvg-defs.h + rsvg-image.c + rsvg-image.h + rsvg-io.c + rsvg-io.h + rsvg-paint-server.c + rsvg-paint-server.h + rsvg-path.c + rsvg-path.h + rsvg-private.h + rsvg-base-file-util.c + rsvg-filter.c + rsvg-filter.h + rsvg-marker.c + rsvg-marker.h + rsvg-mask.c + rsvg-mask.h + rsvg-shapes.c + rsvg-shapes.h + rsvg-structure.c + rsvg-structure.h + rsvg-styles.c + rsvg-styles.h + rsvg-text.c + rsvg-text.h + rsvg-cond.c + rsvg-base.c + librsvg-enum-types.c + rsvg-cairo-draw.c + rsvg-cairo-draw.h + rsvg-cairo-render.c + rsvg-cairo-render.h + rsvg-cairo-clip.h + rsvg-cairo-clip.c + rsvg.c + rsvg-gobject.c + rsvg-file-util.c + rsvg-size-callback.c + rsvg-size-callback.h + rsvg-xml.c + rsvg-xml.h + rsvg.h + rsvg-cairo.h + librsvg-features.h + librsvg-enum-types.h +) + +set(PIXBUFLOADERSVG_SOURCES + gdk-pixbuf-loader/io-svg.c +) + +if(WIN32) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.win32 ${CMAKE_CURRENT_SOURCE_DIR}/config.h COPYONLY) + add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/rsvg.def + COMMAND echo "EXPORTS" > ${CMAKE_CURRENT_SOURCE_DIR}/rsvg.def + COMMAND ${CMAKE_C_COMPILER} /EP ${CMAKE_CURRENT_SOURCE_DIR}/rsvg.symbols >> ${CMAKE_CURRENT_SOURCE_DIR}/rsvg.def) + list(APPEND LIBRSVG_SOURCES rsvg.def) +else() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.linux ${CMAKE_CURRENT_SOURCE_DIR}/config.h COPYONLY) + list(APPEND LIBRSVG_SOURCES rsvg.symbols) +endif() + +set(CMAKE_DEBUG_POSTFIX "d") + +add_library(rsvg-2.40 ${LIBRSVG_SOURCES}) +add_library(pixbufloader-svg ${PIXBUFLOADERSVG_SOURCES}) + +target_compile_definitions(rsvg-2.40 PRIVATE -DRSVG_COMPILATION -D_CRT_SECURE_NO_WARNINGS -DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") + +target_include_directories(pixbufloader-svg PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_definitions(pixbufloader-svg PRIVATE + -DRSVG_COMPILATION + -D_CRT_SECURE_NO_WARNINGS + -DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + -DGDK_PIXBUF_ENABLE_BACKEND + -DG_LOG_DOMAIN="libpixbufloader-svg") + +target_link_libraries(rsvg-2.40 PRIVATE + unofficial::cairo::cairo + unofficial::libcroco::croco-0.6 + unofficial::glib::gio + unofficial::glib::glib + unofficial::glib::gmodule + unofficial::glib::gobject + ${LIBXML2_LIBRARIES} + ${PANGO_LIB} + ${PANGO_CAIRO_LIB} + ${GDK_PIXBUF_LIB} +) +target_link_libraries(pixbufloader-svg PRIVATE + rsvg-2.40 + unofficial::glib::glib + unofficial::glib::gobject + ${GDK_PIXBUF_LIB} +) + +install(TARGETS rsvg-2.40 pixbufloader-svg + EXPORT librsvg-targets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install( + EXPORT librsvg-targets + NAMESPACE unofficial::librsvg:: + FILE unofficial-librsvg-targets.cmake + DESTINATION share/unofficial-librsvg +) + +install(FILES + rsvg.h + rsvg-cairo.h + librsvg-features.h + librsvg-enum-types.h + DESTINATION include/librsvg +) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/unofficial-librsvg-config.cmake " +include(CMakeFindDependencyMacro) +find_dependency(unofficial-cairo CONFIG) +find_dependency(unofficial-libcroco CONFIG) +find_dependency(gdk-pixbuf CONFIG) +find_dependency(pango CONFIG) + +include(\${CMAKE_CURRENT_LIST_DIR}/unofficial-librsvg-targets.cmake) +") +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-librsvg-config.cmake DESTINATION share/unofficial-librsvg) diff --git a/ports/librsvg/CONTROL b/ports/librsvg/CONTROL new file mode 100755 index 00000000000000..3a250b8d4cf256 --- /dev/null +++ b/ports/librsvg/CONTROL @@ -0,0 +1,4 @@ +Source: librsvg +Version: 2.40.20 +Description: A small library to render Scalable Vector Graphics (SVG) +Build-Depends: cairo, pango, gdk-pixbuf, libcroco \ No newline at end of file diff --git a/ports/librsvg/config.h.linux b/ports/librsvg/config.h.linux new file mode 100644 index 00000000000000..c3881b8c991982 --- /dev/null +++ b/ports/librsvg/config.h.linux @@ -0,0 +1,89 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if your file defines LC_MESSAGES. */ +#define HAVE_LC_MESSAGES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Have the pangoft2 library */ +#define HAVE_PANGOFT2 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "librsvg" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://bugzilla.gnome.org/enter_bug.cgi?product=librsvg" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "RSVG" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "RSVG 2.40.20" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "librsvg" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.40.20" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "2.40.20" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif diff --git a/ports/librsvg/portfile.cmake b/ports/librsvg/portfile.cmake new file mode 100755 index 00000000000000..8ae45ce9c731b6 --- /dev/null +++ b/ports/librsvg/portfile.cmake @@ -0,0 +1,28 @@ +include(vcpkg_common_functions) + +vcpkg_download_distfile(ARCHIVE + URLS "https://download.gnome.org/sources/librsvg/2.40/librsvg-2.40.20.tar.xz" + FILENAME "librsvg-2.40.20.tar.xz" + SHA512 cdd8224deb4c3786e29f48ed02c32ed9dff5cb15aba574a5ef845801ad3669cfcc3eedb9d359c22213dc7a29de24c363248825adad5877c40abf73b3688ff12f +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +configure_file(${CMAKE_CURRENT_LIST_DIR}/config.h.linux ${SOURCE_PATH}/config.h.linux COPYONLY) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/librsvg RENAME copyright) From 2549917e6abbce1dc3caed30f7c6d78a56e7f613 Mon Sep 17 00:00:00 2001 From: Rodrigo Hernandez Date: Tue, 4 Jun 2019 16:11:07 -0600 Subject: [PATCH 2/4] [librsvg] Adding copy pdbs to portfile. --- ports/librsvg/portfile.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/librsvg/portfile.cmake b/ports/librsvg/portfile.cmake index 8ae45ce9c731b6..721d3386094168 100755 --- a/ports/librsvg/portfile.cmake +++ b/ports/librsvg/portfile.cmake @@ -26,3 +26,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) # Handle copyright file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/librsvg RENAME copyright) + +vcpkg_copy_pdbs() + +vcpkg_test_cmake(PACKAGE_NAME unofficial-librsvg) From b8a3e2da9f352bb507220387432f572489a21217 Mon Sep 17 00:00:00 2001 From: Rodrigo Hernandez Date: Wed, 5 Jun 2019 12:13:40 -0600 Subject: [PATCH 3/4] [librsvg] Fix for missing debug target cmake config file. --- ports/librsvg/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/librsvg/portfile.cmake b/ports/librsvg/portfile.cmake index 721d3386094168..c3765f0a3d4394 100755 --- a/ports/librsvg/portfile.cmake +++ b/ports/librsvg/portfile.cmake @@ -21,8 +21,8 @@ vcpkg_configure_cmake( vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-librsvg TARGET_PATH share/unofficial-librsvg) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) # Handle copyright file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/librsvg RENAME copyright) From ca2521481954f27a5df3731eec4ff926c6090e09 Mon Sep 17 00:00:00 2001 From: Phil Christensen Date: Wed, 10 Jul 2019 11:34:43 -0700 Subject: [PATCH 4/4] [librsvg] change library dependency name on Linux --- ports/librsvg/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/librsvg/CMakeLists.txt b/ports/librsvg/CMakeLists.txt index 8952370ba9b591..749d3132bbdb80 100755 --- a/ports/librsvg/CMakeLists.txt +++ b/ports/librsvg/CMakeLists.txt @@ -7,7 +7,12 @@ find_package(unofficial-glib CONFIG REQUIRED) find_package(LibXml2 REQUIRED) find_library(PANGO_LIB pango-1.0) find_library(PANGO_CAIRO_LIB pangocairo-1.0) -find_library(GDK_PIXBUF_LIB gdk_pixbuf-2.0) +if(CMAKE_SYSTEM_NAME MATCHES "Windows") + find_library(GDK_PIXBUF_LIB gdk_pixbuf-2.0) +else() + find_library(GDK_PIXBUF_LIB gdk_pixbuf-2) +endif() + find_path(CAIRO_INCLUDE_DIR cairo/cairo.h) # Add include directories