Skip to content

Commit

Permalink
[pango,libgd,atk,gtk3,graphviz] Cleanup, fix static windows builds (#…
Browse files Browse the repository at this point in the history
…28766)

* [libgd] Fix static builds on windows

* [pango] Cleanup

* Use freetype2.pc with msvc

* Update CI baseline [skip actions]

* [atk] Cleanup, fix static builds

* [gtk3] Cleanup, fix static builds

* [graphviz] Fix static builds

* Update versions

* [libgd] Revert bad substitution

* [graphviz] Plugins

* [graphviz] Plugins

* [libgd] Fix static usage

* [gtk3] versions
  • Loading branch information
dg0yt committed Jan 9, 2023
1 parent 85c4f11 commit 5bb5f39
Show file tree
Hide file tree
Showing 24 changed files with 227 additions and 53 deletions.
20 changes: 12 additions & 8 deletions ports/atk/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
set(ATK_VERSION 2.38.0)
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}

vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO GNOME/atk
REF "${ATK_VERSION}"
REF "${VERSION}"
HEAD_REF master
SHA512 f31951ecbdace6a18fb9f772616137cb8732163b37448fef4daf1af60ba8479c94d498dcdaf4880468c80012c77a446da585926a99704a9a940b80e546080cf3
)

vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS -Dintrospection=false
ADDITIONAL_NATIVE_BINARIES glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'
glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'
ADDITIONAL_CROSS_BINARIES glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'
glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'
OPTIONS
-Dintrospection=false
ADDITIONAL_BINARIES
"glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'"
"glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'"
)
vcpkg_install_meson()

vcpkg_copy_pdbs()

vcpkg_fixup_pkgconfig()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/atk-1.0/atk/atkmisc.h" "ifdef ATK_STATIC_COMPILATION" "if 1")
endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

10 changes: 9 additions & 1 deletion ports/atk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{
"name": "atk",
"version": "2.38.0",
"port-version": 3,
"port-version": 4,
"description": "GNOME Accessibility Toolkit",
"homepage": "https://developer.gnome.org/atk/",
"license": "GPL-2.0-only",
"dependencies": [
"gettext",
{
"name": "gettext",
"host": true,
"default-features": false,
"features": [
"tools"
]
},
"glib",
{
"name": "glib",
Expand Down
5 changes: 5 additions & 0 deletions ports/graphviz/cmake-project-include.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if(MSVC)
find_package(unofficial-getopt-win32 CONFIG REQUIRED)
set(GETOPT_LIBRARY "unofficial::getopt-win32::getopt" CACHE INTERNAL "vcpkg")
set(GETOPT_RUNTIME_LIBRARY "unused" CACHE INTERNAL "vcpkg")
endif()
10 changes: 10 additions & 0 deletions ports/graphviz/no-absolute-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/lib/gvc/CMakeLists.txt b/lib/gvc/CMakeLists.txt
index b437bde..04fe8e8 100644
--- a/lib/gvc/CMakeLists.txt
+++ b/lib/gvc/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_definitions(-DGVC_EXPORTS -DGVLIBDIR="${LIBRARY_INSTALL_DIR}/graphviz")
+add_definitions(-DGVC_EXPORTS -DGVLIBDIR="")

add_library(gvc SHARED
# Header files
7 changes: 7 additions & 0 deletions ports/graphviz/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) # for plugins

vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}

vcpkg_from_gitlab(
Expand All @@ -9,7 +11,9 @@ vcpkg_from_gitlab(
HEAD_REF main
PATCHES
fix-dependencies.patch
no-absolute-paths.patch
select-plugins.patch
static-linkage.patch
)

if(VCPKG_TARGET_IS_OSX)
Expand Down Expand Up @@ -51,6 +55,7 @@ vcpkg_cmake_configure(
"-DGIT=${GIT}"
"-DPython3_EXECUTABLE=${PYTHON3}"
"-DPKG_CONFIG_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf"
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
-Dinstall_win_dependency_dlls=OFF
-Duse_win_pre_inst_libs=OFF
-Dwith_smyrna=OFF
Expand Down Expand Up @@ -96,6 +101,8 @@ endif()
if(VCPKG_TARGET_IS_WINDOWS)
file(GLOB plugins "${CURRENT_PACKAGES_DIR}/bin/gvplugin_*")
file(COPY ${plugins} ${plugin_config} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
else()
file(COPY "${CURRENT_PACKAGES_DIR}/lib/graphviz" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
endif()

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
25 changes: 25 additions & 0 deletions ports/graphviz/static-linkage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/plugin/gd/gvrender_gd.c b/plugin/gd/gvrender_gd.c
index 960271c..2494e95 100644
--- a/plugin/gd/gvrender_gd.c
+++ b/plugin/gd/gvrender_gd.c
@@ -259,7 +259,7 @@ static void gdgen_missingfont(char *fontreq) {
#else
#define GD_IMPORT
#endif
-GD_IMPORT extern gdFontPtr gdFontTiny, gdFontSmall, gdFontMediumBold, gdFontLarge, gdFontGiant;
+BGD_EXPORT_DATA_PROT extern gdFontPtr gdFontTiny, gdFontSmall, gdFontMediumBold, gdFontLarge, gdFontGiant;

void gdgen_text(gdImagePtr im, pointf spf, pointf epf, int fontcolor, double fontsize, int fontdpi, double fontangle, char *fontname, char *str)
{
diff --git a/plugin/pango/CMakeLists.txt b/plugin/pango/CMakeLists.txt
index 26749af..65d77e4 100644
--- a/plugin/pango/CMakeLists.txt
+++ b/plugin/pango/CMakeLists.txt
@@ -58,6 +58,7 @@ if(CAIRO_FOUND AND PANGOCAIRO_FOUND)
set_target_properties(gvplugin_pango PROPERTIES
VERSION ${GRAPHVIZ_PLUGIN_VERSION}.0.0
SOVERSION ${GRAPHVIZ_PLUGIN_VERSION}
+ LINKER_LANGUAGE CXX # for cairo
)

if(MINGW)
1 change: 1 addition & 0 deletions ports/graphviz/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "graphviz",
"version-semver": "7.0.0",
"port-version": 1,
"description": "Graph Visualization Tools",
"homepage": "https://graphviz.org/",
"license": "EPL-1.0",
Expand Down
62 changes: 62 additions & 0 deletions ports/gtk3/cairo-cpp-linkage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/gtk/meson.build b/gtk/meson.build
index 79f4f0d..33a7723 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1074,6 +1074,7 @@ gtk_query_settings = executable(
'gtk-query-settings.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_query_settings
@@ -1083,6 +1084,7 @@ gtk_builder_tool = executable(
'gtk-builder-tool.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_builder_tool
@@ -1115,6 +1117,7 @@ gtk_update_icon_cache = executable(
extra_update_icon_cache_objs,
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_update_icon_cache
@@ -1125,6 +1128,7 @@ gtk_query_immodules = executable(
'gtkutils.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_query_immodules
@@ -1134,6 +1138,7 @@ gtk_encode_symbolic_svg = executable(
'encodesymbolic.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_encode_symbolic_svg
@@ -1143,6 +1148,7 @@ gtk_launch = executable(
'gtk-launch.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_launch
diff --git a/meson.build b/meson.build
index 287f0cb..d35106f 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('gtk+-3.0', 'c',
+project('gtk+-3.0', 'c', 'cpp',
version: '3.24.34',
default_options: [
'buildtype=debugoptimized',
34 changes: 16 additions & 18 deletions ports/gtk3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ if(buildtrees_path_length GREATER warning_length AND CMAKE_HOST_WIN32)
)
endif()

vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
vcpkg_from_gitlab(
OUT_SOURCE_PATH SOURCE_PATH
GITLAB_URL https://gitlab.gnome.org
REPO GNOME/gtk
REF 3.24.34
REF "${VERSION}"
SHA512 20a91e30a89070461af06b33829bc723b348806b4a785d0743af8bd4789b55dade24686e08bf1b2f0335240463aacc040134babb0605b809186b15de9cf261e4
PATCHES
0001-build.patch
cairo-cpp-linkage.patch
)

vcpkg_find_acquire_program(PKGCONFIG)
Expand All @@ -38,28 +40,26 @@ vcpkg_configure_meson(
-Dtracker3=false # Enable Tracker3 filechooser search
-Dcolord=no # Build colord support for the CUPS printing backend
-Dintrospection=false
ADDITIONAL_NATIVE_BINARIES
glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'
glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'
glib-compile-resources='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-resources${VCPKG_HOST_EXECUTABLE_SUFFIX}'
gdbus-codegen='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/gdbus-codegen'
glib-compile-schemas='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-schemas${VCPKG_HOST_EXECUTABLE_SUFFIX}'
ADDITIONAL_CROSS_BINARIES
glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'
glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'
glib-compile-resources='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-resources${VCPKG_HOST_EXECUTABLE_SUFFIX}'
gdbus-codegen='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/gdbus-codegen'
glib-compile-schemas='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-schemas${VCPKG_HOST_EXECUTABLE_SUFFIX}'
ADDITIONAL_BINARIES
"glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'"
"glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'"
"glib-compile-resources='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-resources${VCPKG_HOST_EXECUTABLE_SUFFIX}'"
"gdbus-codegen='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/gdbus-codegen'"
"glib-compile-schemas='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-schemas${VCPKG_HOST_EXECUTABLE_SUFFIX}'"
)

# Reduce command line lengths, in particular for static windows builds.
foreach(dir IN ITEMS "${TARGET_TRIPLET}-dbg" "${TARGET_TRIPLET}-rel")
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${dir}/build.ninja")
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${dir}/build.ninja" "/${dir}/../src/" "/src/")
endif()
endforeach()
vcpkg_install_meson()

vcpkg_copy_pdbs()

vcpkg_fixup_pkgconfig()

file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

set(GTK_TOOLS
gtk-builder-tool
gtk-encode-symbolic-svg
Expand All @@ -73,6 +73,4 @@ vcpkg_copy_tools(TOOL_NAMES ${GTK_TOOLS} AUTO_CLEAN)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/etc")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
1 change: 1 addition & 0 deletions ports/gtk3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "gtk3",
"version": "3.24.34",
"port-version": 1,
"description": "Portable library for creating graphical user interfaces.",
"homepage": "https://www.gtk.org/",
"license": null,
Expand Down
3 changes: 3 additions & 0 deletions ports/libgd/cmake-project-include.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if(NOT BUILD_SHARED_LIBS)
add_definitions(-DNONDLL)
endif()
15 changes: 15 additions & 0 deletions ports/libgd/fix-static-usage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/gd.h b/src/gd.h
index 3056039..8a7608a 100644
--- a/src/gd.h
+++ b/src/gd.h
@@ -62,6 +62,10 @@ extern "C" {
# else
# define BGD_EXPORT_DATA_PROT __declspec(dllimport)
# endif
+# ifdef NONDLL
+# undef BGD_EXPORT_DATA_PROT
+# define BGD_EXPORT_DATA_PROT
+# endif
# endif
# define BGD_STDCALL __stdcall
# define BGD_EXPORT_DATA_IMPL
5 changes: 5 additions & 0 deletions ports/libgd/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ vcpkg_from_github(
control-build.patch
fix-dependencies.cmake
fix_msvc_build.patch
fix-static-usage.patch
)

# Delete vendored Find modules
Expand Down Expand Up @@ -40,12 +41,16 @@ vcpkg_cmake_configure(
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_STATIC_LIBS=${BUILD_STATIC}
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
OPTIONS_DEBUG
-DENABLE_TOOLS=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()

if(BUILD_STATIC)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/gd.h" "ifdef NONDLL" "if 1")
endif()
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
string(REPLACE "_dynamic" "" suffix "_${VCPKG_LIBRARY_LINKAGE}")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gdlib.pc" " -lgd" " -llibgd${suffix}")
Expand Down
2 changes: 1 addition & 1 deletion ports/libgd/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libgd",
"version-semver": "2.3.3",
"port-version": 1,
"port-version": 2,
"description": "Open source code library for the dynamic creation of images by programmers.",
"homepage": "https://github.com/libgd/libgd",
"license": "GD",
Expand Down
13 changes: 13 additions & 0 deletions ports/pango/freetype2-pc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index 723e0c2..c348730 100644
--- a/meson.build
+++ b/meson.build
@@ -312,7 +312,7 @@ endif

# The first version of freetype with a pkg-config file is 2.1.5,
# CMake uses 'freetype' rather than 'freetype2' for the package name
-freetype_package_name = cc.get_argument_syntax() == 'msvc' ? \
+freetype_package_name = false ? \
'freetype' : 'freetype2'

freetype_dep = dependency(freetype_package_name,
Loading

0 comments on commit 5bb5f39

Please sign in to comment.