fix: use pkg-config + semi-static for Linux (matches tectonic CI)

Switch Linux build from vcpkg to pkg-config, matching tectonic's
own CI approach. vcpkg on Linux had unsolvable issues:
- graphite2 hidden symbol visibility
- ICU .so files missing symbols
- Incompatible with rust-lld, ld.bfd, and mold

pkg-config + system packages is the tectonic-recommended approach.
Semi-static linking maximizes portability. AppImage bundles .so files
automatically for distribution across distros.

Removes vcpkg overlay ports (no longer needed).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hanjin Bae 2026-06-10 00:29:30 +09:00
parent 42f20163f1
commit a81e0e06a9
4 changed files with 10 additions and 154 deletions

View file

@ -1,48 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 496712d..3df05c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,10 +82,12 @@ if (BUILD_SHARED_LIBS)
endif()
add_subdirectory(src)
-add_subdirectory(tests)
-add_subdirectory(doc)
-if (NOT GRAPHITE2_NFILEFACE)
- add_subdirectory(gr2fonttest)
+if(NOT DISABLE_TESTS)
+ add_subdirectory(tests)
+ add_subdirectory(doc)
+ if (NOT GRAPHITE2_NFILEFACE)
+ add_subdirectory(gr2fonttest)
+ endif()
endif()
set(version 3.0.1)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b6ac26b..851a97f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -127,9 +127,9 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
endif ()
endif()
include(Graphite)
- if (BUILD_SHARED_LIBS)
+ if (NOT DISABLE_TESTS)
nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
- endif ()
+ endif()
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
endif()
@@ -144,7 +144,9 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
endif()
target_link_libraries(graphite2 c)
include(Graphite)
- nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
+ if (NOT DISABLE_TESTS)
+ nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
+ endif()
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
endif()

View file

@ -1,39 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO silnrsi/graphite
REF 92f59dcc52f73ce747f1cdc831579ed2546884aa # 1.3.14
SHA512 011855576124b2f9ae9d7d3a0dfc5489794cf82b81bebc02c11c9cca350feb9fbb411844558811dff1ebbacac58a24a7cf56a374fc2c27e97a5fb4795a01486e
HEAD_REF master
PATCHES disable-tests.patch
)
# Fix symbol visibility for static builds:
# 1. Remove -fvisibility=hidden from target COMPILE_FLAGS
# 2. Add GRAPHITE2_EXPORTING so GR2_API = visibility("default")
file(READ "${SOURCE_PATH}/src/CMakeLists.txt" _src_cmake)
string(REPLACE "-fvisibility=hidden" "" _src_cmake "${_src_cmake}")
string(REPLACE "-fvisibility-inlines-hidden" "" _src_cmake "${_src_cmake}")
string(REPLACE "add_definitions(-DGRAPHITE2_STATIC)" "add_definitions(-DGRAPHITE2_STATIC)\n add_definitions(-DGRAPHITE2_EXPORTING)" _src_cmake "${_src_cmake}")
file(WRITE "${SOURCE_PATH}/src/CMakeLists.txt" "${_src_cmake}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DDISABLE_TESTS=ON
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Keep original GRAPHITE2_STATIC check GRAPHITE2_EXPORTING overrides it
message(STATUS "graphite2 overlay: GRAPHITE2_EXPORTING set for proper symbol export")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libgraphite2.la" "${CURRENT_PACKAGES_DIR}/debug/lib/libgraphite2.la")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING" "${SOURCE_PATH}/LICENSE")

View file

@ -1,11 +0,0 @@
{
"name": "graphite2",
"version": "1.3.14",
"port-version": 100,
"description": "Graphite2 with default symbol visibility (overlay port)",
"homepage": "https://github.com/silnrsi/graphite",
"dependencies": [
{ "name": "vcpkg-cmake", "host": true },
{ "name": "vcpkg-cmake-config", "host": true }
]
}

View file

@ -447,42 +447,9 @@ jobs:
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf \
autoconf autoconf-archive automake libtool pkg-config mold
# vcpkg provides ICU/harfbuzz/graphite2/freetype/fontconfig as dynamic libs.
# This avoids runtime dependency on system ICU version (issue #91).
# graphite2 overlay fixes hidden symbol visibility for rust-lld compat.
- name: Setup vcpkg
run: |
git clone --depth 1 https://github.com/microsoft/vcpkg $HOME/vcpkg
$HOME/vcpkg/bootstrap-vcpkg.sh
echo "VCPKG_ROOT=$HOME/vcpkg" >> $GITHUB_ENV
- name: Restore vcpkg cache
id: vcpkg-cache
uses: actions/cache/restore@v4
with:
path: ~/vcpkg/installed
key: vcpkg-linux-x64-mold-v1
- name: Install Linux dependencies (vcpkg)
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
env:
VCPKG_BINARY_SOURCES: "clear"
run: |
$HOME/vcpkg/vcpkg install \
--overlay-ports=$GITHUB_WORKSPACE/.github/vcpkg-overlays \
"harfbuzz[graphite2]:x64-linux" \
fontconfig:x64-linux \
freetype:x64-linux \
icu:x64-linux
- name: Save vcpkg cache
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/vcpkg/installed
key: vcpkg-linux-x64-mold-v1
autoconf autoconf-archive automake libtool pkg-config \
libgraphite2-dev libicu-dev libfontconfig1-dev libharfbuzz-dev \
libssl-dev libfreetype-dev libpng-dev zlib1g-dev
- uses: dtolnay/rust-toolchain@stable
with:
@ -505,26 +472,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZOTERO_CONSUMER_KEY: ${{ secrets.ZOTERO_CONSUMER_KEY }}
ZOTERO_CONSUMER_SECRET: ${{ secrets.ZOTERO_CONSUMER_SECRET }}
TECTONIC_DEP_BACKEND: vcpkg
CXXFLAGS: "-std=c++17 -DU_DISABLE_RENAMING=1"
CFLAGS: "-DU_DISABLE_RENAMING=1"
# mold handles both graphite2 hidden symbols and Rust version scripts.
# Prepend vcpkg lib path so ICU/harfbuzz from vcpkg are found before
# system versions (prevents ICU version suffix mismatch).
RUSTFLAGS: "-C link-arg=-fuse-ld=mold -C link-arg=-L${{ env.VCPKG_ROOT }}/installed/x64-linux/lib"
run: |
# Diagnose: check if vcpkg ICU has versioned or unversioned symbols
echo "=== vcpkg ICU symbols ==="
nm -D $HOME/vcpkg/installed/x64-linux/lib/libicuuc.so 2>/dev/null | grep "ucnv_fromUChars" | head -3 || echo "NOT FOUND"
echo "=== vcpkg ICU renaming config ==="
grep -E "U_DISABLE_RENAMING|U_ICU_VERSION_SUFFIX" $HOME/vcpkg/installed/x64-linux/include/unicode/uvernum.h $HOME/vcpkg/installed/x64-linux/include/unicode/uconfig.h 2>/dev/null | head -5 || echo "NOT FOUND"
# Move system ICU .so out of the way so linker finds vcpkg's ICU first.
sudo mkdir -p /usr/lib/x86_64-linux-gnu/icu-system-backup
sudo mv /usr/lib/x86_64-linux-gnu/libicu*.so* /usr/lib/x86_64-linux-gnu/icu-system-backup/ 2>/dev/null || true
pnpm --filter @claude-prism/desktop tauri build --target x86_64-unknown-linux-gnu
# Restore system ICU
sudo mv /usr/lib/x86_64-linux-gnu/icu-system-backup/libicu*.so* /usr/lib/x86_64-linux-gnu/ 2>/dev/null || true
# Use pkg-config (same as tectonic's own CI) with semi-static linking.
# AppImage bundles .so files automatically for portable distribution.
TECTONIC_DEP_BACKEND: pkg-config
TECTONIC_PKGCONFIG_FORCE_SEMI_STATIC: "true"
CXXFLAGS: "-std=c++17"
CFLAGS: ""
run: pnpm --filter @claude-prism/desktop tauri build --target x86_64-unknown-linux-gnu
- name: Collect updater artifacts
id: collect