diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/librsvg | |
Diffstat (limited to 'vcpkg/ports/librsvg')
| -rw-r--r-- | vcpkg/ports/librsvg/CMakeLists.txt | 199 | ||||
| -rw-r--r-- | vcpkg/ports/librsvg/config.h.linux | 89 | ||||
| -rw-r--r-- | vcpkg/ports/librsvg/fix-libxml2-2.13.5.patch | 25 | ||||
| -rw-r--r-- | vcpkg/ports/librsvg/portfile.cmake | 42 | ||||
| -rw-r--r-- | vcpkg/ports/librsvg/unofficial-librsvg-config.cmake | 14 | ||||
| -rw-r--r-- | vcpkg/ports/librsvg/usage | 5 | ||||
| -rw-r--r-- | vcpkg/ports/librsvg/vcpkg.json | 24 |
7 files changed, 398 insertions, 0 deletions
diff --git a/vcpkg/ports/librsvg/CMakeLists.txt b/vcpkg/ports/librsvg/CMakeLists.txt new file mode 100644 index 0000000..630dc44 --- /dev/null +++ b/vcpkg/ports/librsvg/CMakeLists.txt @@ -0,0 +1,199 @@ +cmake_minimum_required(VERSION 3.11) +project(librsvg C) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(LIBCROCO libcroco-0.6 IMPORTED_TARGET) +pkg_check_modules(GLIB2 glib-2.0 gobject-2.0 gmodule-2.0 gio-2.0 IMPORTED_TARGET) +pkg_check_modules(CAIRO cairo IMPORTED_TARGET) +pkg_check_modules(GDK_PIXBUF gdk-pixbuf-2.0 IMPORTED_TARGET) +pkg_check_modules(PANGO pango pangocairo IMPORTED_TARGET) +find_package(LibXml2 REQUIRED) + +if(CMAKE_SYSTEM_NAME MATCHES "Windows") +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") +else() + pkg_check_modules(PANGO2 pangoft2 pangofc IMPORTED_TARGET) + set(PANGO_FT2_LIB PkgConfig::PANGO2) +endif() + +set(RSVG_API_MAJOR_VERSION 2) +set(RSVG_API_VERSION "2.0") +Set(VERSION "2.40.20") +set(LIBRSVG_TARGET "rsvg-${RSVG_API_MAJOR_VERSION}") + +Set(prefix "${CMAKE_INSTALL_PREFIX}") +Set(exec_prefix "\${prefix}") +Set(libdir "\${prefix}/lib") +Set(includedir "\${prefix}/include") + +# Public required modules (cf. headers and librsvg.pc) +set(librsvg_pc_requires glib-2.0 gio-2.0 gdk-pixbuf-2.0 cairo) +# Other required modules from configure.ac +set(librsvg_pc_requires_private + libxml-2.0 + pangocairo + pangoft2 + cairo-png + libcroco-0.6 + gthread-2.0 + gmodule-2.0 + gobject-2.0 + gio-unix-2.0 + fontconfig +) +if(WIN32) + string(REPLACE "gio-unix" "gio-windows" librsvg_pc_requires_private "${librsvg_pc_requires_private}") +endif() + +find_package(PkgConfig REQUIRED) +pkg_check_modules(LIBRSVG_LINK_PUBLIC ${librsvg_pc_requires} IMPORTED_TARGET REQUIRED) +pkg_check_modules(LIBRSVG_LINK_PRIVATE ${librsvg_pc_requires_private} IMPORTED_TARGET REQUIRED) + +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 +) + +if(WIN32) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.win32" "${CMAKE_CURRENT_BINARY_DIR}/config.h" COPYONLY) + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/rsvg.symbols" rsvg_symbols) + string(REGEX REPLACE "/[*][^*]*[*]/" "" rsvg_symbols "${rsvg_symbols}") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/rsvg.def" "EXPORTS\n${rsvg_symbols}") + list(APPEND LIBRSVG_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/rsvg.def") +else() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.linux" "${CMAKE_CURRENT_BINARY_DIR}/config.h" COPYONLY) + list(APPEND LIBRSVG_SOURCES rsvg.symbols) +endif() + +add_library(${LIBRSVG_TARGET} ${LIBRSVG_SOURCES}) +target_compile_definitions(${LIBRSVG_TARGET} PRIVATE + -DRSVG_COMPILATION + -D_CRT_SECURE_NO_WARNINGS + -DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + -DGDK_PIXBUF_ENABLE_BACKEND + -DG_LOG_DOMAIN="libpixbufloader-svg" + -DSRCDIR="" + $<$<BOOL:${MINGW}>:HAVE_STRTOK_R> +) + +target_link_libraries(${LIBRSVG_TARGET} PRIVATE + PkgConfig::GLIB2 + ${LIBXML2_LIBRARIES} + PkgConfig::PANGO + PkgConfig::GDK_PIXBUF + ${PANGO_FT2_LIB} + PkgConfig::LIBCROCO +) + +target_include_directories(${LIBRSVG_TARGET} + PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}" + PUBLIC + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" + "$<INSTALL_INTERFACE:include/librsvg-${RSVG_API_VERSION}>" +) +target_link_libraries(${LIBRSVG_TARGET} + PUBLIC + PkgConfig::LIBRSVG_LINK_PUBLIC + PRIVATE + PkgConfig::LIBRSVG_LINK_PRIVATE +) +install(TARGETS ${LIBRSVG_TARGET} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +install( + FILES + rsvg.h + rsvg-cairo.h + librsvg-features.h + librsvg-enum-types.h + DESTINATION include/librsvg-${RSVG_API_VERSION}/librsvg +) + +set(gdk_pixbuf_pc_requires_private gdk-pixbuf-2.0) +pkg_check_modules(GDK_PIXBUF ${gdk_pixbuf_pc_requires_private} IMPORTED_TARGET REQUIRED) +pkg_get_variable(GDK_PIXBUF_MODULEDIR ${gdk_pixbuf_pc_requires_private} gdk_pixbuf_moduledir) + +set(PIXBUFLOADERSVG_SOURCES + gdk-pixbuf-loader/io-svg.c +) + +add_library(pixbufloader-svg MODULE ${PIXBUFLOADERSVG_SOURCES}) +target_include_directories(pixbufloader-svg + PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}" +) +target_compile_definitions(pixbufloader-svg PRIVATE + -DRSVG_COMPILATION + -D_CRT_SECURE_NO_WARNINGS + -DSRCDIR="" + -DGDK_PIXBUF_ENABLE_BACKEND + -DG_LOG_DOMAIN="libpixbufloader-svg" +) +target_link_libraries(pixbufloader-svg + PRIVATE + ${LIBRSVG_TARGET} + PkgConfig::GDK_PIXBUF +) +install(TARGETS pixbufloader-svg + RUNTIME DESTINATION "${GDK_PIXBUF_MODULEDIR}" + LIBRARY DESTINATION "${GDK_PIXBUF_MODULEDIR}" +) + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/librsvg.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/librsvg.pc" @ONLY) +file(READ "${CMAKE_CURRENT_BINARY_DIR}/librsvg.pc" librsvg_pc) +list(JOIN librsvg_pc_requires_private " " requires_private) +string(REPLACE "Requires.private:" "Requires.private: ${requires_private}" librsvg_pc "${librsvg_pc}") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/librsvg.pc" "${librsvg_pc}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/librsvg.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" RENAME "librsvg-${RSVG_API_VERSION}.pc") diff --git a/vcpkg/ports/librsvg/config.h.linux b/vcpkg/ports/librsvg/config.h.linux new file mode 100644 index 0000000..c3881b8 --- /dev/null +++ b/vcpkg/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 <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if your <locale.h> file defines LC_MESSAGES. */ +#define HAVE_LC_MESSAGES 1 + +/* Define to 1 if you have the <locale.h> header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Have the pangoft2 library */ +#define HAVE_PANGOFT2 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> 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 <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> 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/vcpkg/ports/librsvg/fix-libxml2-2.13.5.patch b/vcpkg/ports/librsvg/fix-libxml2-2.13.5.patch new file mode 100644 index 0000000..634f659 --- /dev/null +++ b/vcpkg/ports/librsvg/fix-libxml2-2.13.5.patch @@ -0,0 +1,25 @@ +diff --git a/rsvg-css.c b/rsvg-css.c +index 5b359a206..4f59281b6 100644 +--- a/rsvg-css.c ++++ b/rsvg-css.c +@@ -839,7 +839,7 @@ rsvg_css_parse_overflow (const char *str, gboolean * inherit) + } + + static void +-rsvg_xml_noerror (void *data, xmlErrorPtr error) ++rsvg_xml_noerror (void *data, const xmlError *error) + { + } + +diff --git a/rsvg-private.h b/rsvg-private.h +index 82157bc..fb9c4e0 100644 +--- a/rsvg-private.h ++++ b/rsvg-private.h +@@ -33,6 +33,7 @@ + + #include <libxml/SAX.h> + #include <libxml/xmlmemory.h> ++#include <libxml/tree.h> + #include <pango/pango.h> + #include <glib.h> + #include <glib-object.h> diff --git a/vcpkg/ports/librsvg/portfile.cmake b/vcpkg/ports/librsvg/portfile.cmake new file mode 100644 index 0000000..c913d13 --- /dev/null +++ b/vcpkg/ports/librsvg/portfile.cmake @@ -0,0 +1,42 @@ +# port update requires rust/cargo
+
+string(REGEX REPLACE "^([0-9]*[.][0-9]*)[.].*" "\\1" MAJOR_MINOR "${VERSION}")
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://download.gnome.org/sources/librsvg/${MAJOR_MINOR}/librsvg-${VERSION}.tar.xz"
+ "https://www.mirrorservice.org/sites/ftp.gnome.org/pub/GNOME/sources/librsvg/${MAJOR_MINOR}/librsvg-${VERSION}.tar.xz"
+ FILENAME "librsvg-${VERSION}.tar.xz"
+ SHA512 db0563d8e0edaae642a6b2bcd239cf54191495058ac8c7ff614ebaf88c0e30bd58dbcd41f58d82a9d5ed200ced45fc5bae22f2ed3cf3826e9348a497009e1280
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES
+ fix-libxml2-2.13.5.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" "${CMAKE_CURRENT_LIST_DIR}/config.h.linux" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_find_acquire_program(PKGCONFIG)
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ file(GLOB_RECURSE pc_files "${CURRENT_PACKAGES_DIR}/*.pc")
+ foreach(pc_file IN LISTS pc_files)
+ vcpkg_replace_string("${pc_file}" " -lm" "")
+ endforeach()
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(COPY "${CURRENT_PORT_DIR}/unofficial-librsvg-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-librsvg")
+file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/librsvg/unofficial-librsvg-config.cmake b/vcpkg/ports/librsvg/unofficial-librsvg-config.cmake new file mode 100644 index 0000000..6bff45d --- /dev/null +++ b/vcpkg/ports/librsvg/unofficial-librsvg-config.cmake @@ -0,0 +1,14 @@ +file(READ "${CMAKE_CURRENT_LIST_DIR}/../librsvg/usage" usage) +message(WARNING "find_package(unofficial-librsvg) is deprecated.\n${usage}") + +include(CMakeFindDependencyMacro) +find_dependency(PkgConfig) +pkg_check_modules(VCPKG_LIBRSVG librsvg-2.0 IMPORTED_TARGET) +if(NOT VCPKG_LIBRSVG_FOUND) + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND 0) +elseif(NOT TARGET unofficial::librsvg::rsvg-2) + add_library(unofficial::librsvg::rsvg-2 INTERFACE IMPORTED) + set_target_properties(unofficial::librsvg::rsvg-2 PROPERTIES + INTERFACE_LINK_LIBRARIES PkgConfig::VCPKG_LIBRSVG + ) +endif() diff --git a/vcpkg/ports/librsvg/usage b/vcpkg/ports/librsvg/usage new file mode 100644 index 0000000..22bfe67 --- /dev/null +++ b/vcpkg/ports/librsvg/usage @@ -0,0 +1,5 @@ +librsvg can be imported via CMake FindPkgConfig module: + + find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBRSVG librsvg-2.0 IMPORTED_TARGET REQUIRED) + target_link_libraries(main PRIVATE PkgConfig::LIBRSVG) diff --git a/vcpkg/ports/librsvg/vcpkg.json b/vcpkg/ports/librsvg/vcpkg.json new file mode 100644 index 0000000..2f0a097 --- /dev/null +++ b/vcpkg/ports/librsvg/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "librsvg", + "version": "2.40.21", + "port-version": 1, + "description": "A small library to render Scalable Vector Graphics (SVG)", + "homepage": "https://gitlab.gnome.org/GNOME/librsvg", + "license": "LGPL-2.0-or-later", + "dependencies": [ + "cairo", + "fontconfig", + "gdk-pixbuf", + "glib", + "libcroco", + { + "name": "libxml2", + "default-features": false + }, + "pango", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |