mirror of
https://github.com/delibae/claude-prism.git
synced 2026-08-28 05:14:59 +00:00
Merge pull request #195 from delibae/fix/linux-build-mold-vcpkg
fix: Linux build with mold linker + graphite2 overlay
This commit is contained in:
commit
715753c8d3
4 changed files with 117 additions and 8 deletions
48
.github/vcpkg-overlays/graphite2/disable-tests.patch
vendored
Normal file
48
.github/vcpkg-overlays/graphite2/disable-tests.patch
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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()
|
||||
39
.github/vcpkg-overlays/graphite2/portfile.cmake
vendored
Normal file
39
.github/vcpkg-overlays/graphite2/portfile.cmake
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
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")
|
||||
11
.github/vcpkg-overlays/graphite2/vcpkg.json
vendored
Normal file
11
.github/vcpkg-overlays/graphite2/vcpkg.json
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"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 }
|
||||
]
|
||||
}
|
||||
27
.github/workflows/build-desktop.yml
vendored
27
.github/workflows/build-desktop.yml
vendored
|
|
@ -447,12 +447,11 @@ 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
|
||||
autoconf autoconf-archive automake libtool pkg-config mold
|
||||
|
||||
# Static linking via vcpkg — avoids runtime dependency on system ICU/harfbuzz.
|
||||
# Without this, the binary links against the build host's libicuuc.so.70
|
||||
# (Ubuntu 22.04) and fails on distros shipping newer ICU (e.g. Ubuntu 25.10
|
||||
# with libicuuc.so.76). Mirrors the macOS approach (commit 9566956).
|
||||
# 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
|
||||
|
|
@ -464,7 +463,7 @@ jobs:
|
|||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ~/vcpkg/installed
|
||||
key: vcpkg-linux-x64-v1
|
||||
key: vcpkg-linux-x64-mold-v1
|
||||
|
||||
- name: Install Linux dependencies (vcpkg)
|
||||
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
|
||||
|
|
@ -472,6 +471,7 @@ jobs:
|
|||
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 \
|
||||
|
|
@ -482,7 +482,7 @@ jobs:
|
|||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ~/vcpkg/installed
|
||||
key: vcpkg-linux-x64-v1
|
||||
key: vcpkg-linux-x64-mold-v1
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
|
|
@ -508,7 +508,18 @@ jobs:
|
|||
TECTONIC_DEP_BACKEND: vcpkg
|
||||
CXXFLAGS: "-std=c++17"
|
||||
CFLAGS: ""
|
||||
run: pnpm --filter @claude-prism/desktop tauri build --target x86_64-unknown-linux-gnu
|
||||
# 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: |
|
||||
# Move system ICU .so out of the way so linker finds vcpkg's ICU first.
|
||||
# System ICU (v70/74) has different version suffix than vcpkg ICU (v78).
|
||||
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 (needed for other tools)
|
||||
sudo mv /usr/lib/x86_64-linux-gnu/icu-system-backup/libicu*.so* /usr/lib/x86_64-linux-gnu/ 2>/dev/null || true
|
||||
|
||||
- name: Collect updater artifacts
|
||||
id: collect
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue