From a81e0e06a99a67da0643a38913347b7a1b2914c8 Mon Sep 17 00:00:00 2001 From: Hanjin Bae Date: Wed, 10 Jun 2026 00:29:30 +0900 Subject: [PATCH] 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) --- .../graphite2/disable-tests.patch | 48 -------------- .../vcpkg-overlays/graphite2/portfile.cmake | 39 ----------- .github/vcpkg-overlays/graphite2/vcpkg.json | 11 ---- .github/workflows/build-desktop.yml | 66 +++---------------- 4 files changed, 10 insertions(+), 154 deletions(-) delete mode 100644 .github/vcpkg-overlays/graphite2/disable-tests.patch delete mode 100644 .github/vcpkg-overlays/graphite2/portfile.cmake delete mode 100644 .github/vcpkg-overlays/graphite2/vcpkg.json diff --git a/.github/vcpkg-overlays/graphite2/disable-tests.patch b/.github/vcpkg-overlays/graphite2/disable-tests.patch deleted file mode 100644 index d1c1fd9..0000000 --- a/.github/vcpkg-overlays/graphite2/disable-tests.patch +++ /dev/null @@ -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++ $) -- 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++ $) -+ if (NOT DISABLE_TESTS) -+ nolib_test(stdc++ $) -+ endif() - set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") - CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}") - endif() diff --git a/.github/vcpkg-overlays/graphite2/portfile.cmake b/.github/vcpkg-overlays/graphite2/portfile.cmake deleted file mode 100644 index f0c21fd..0000000 --- a/.github/vcpkg-overlays/graphite2/portfile.cmake +++ /dev/null @@ -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") diff --git a/.github/vcpkg-overlays/graphite2/vcpkg.json b/.github/vcpkg-overlays/graphite2/vcpkg.json deleted file mode 100644 index d39f030..0000000 --- a/.github/vcpkg-overlays/graphite2/vcpkg.json +++ /dev/null @@ -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 } - ] -} diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index 8e57553..37524f4 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -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