mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-08 04:22:20 +08:00
Go: fix release (#16722)
### Summary Remove ragflow-cli building dependency Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
51
.github/workflows/release.yml
vendored
51
.github/workflows/release.yml
vendored
@@ -424,27 +424,7 @@ jobs:
|
||||
output="${DIST_DIR}/${CLI_NAME}-${RELEASE_TAG}-${{ matrix.goos }}-${{ matrix.goarch }}"
|
||||
echo "Building ${{ matrix.goos }}/${{ matrix.goarch }} -> ${output}"
|
||||
|
||||
case "${{ matrix.goos }}" in
|
||||
linux)
|
||||
cgo_ldflags="${OFFICE_OXIDE_PREFIX}/lib/liboffice_oxide.a -lm -ldl -lpthread"
|
||||
;;
|
||||
darwin)
|
||||
cgo_ldflags="${OFFICE_OXIDE_PREFIX}/lib/liboffice_oxide.a"
|
||||
;;
|
||||
*)
|
||||
echo "::error::Unsupported Unix target: ${{ matrix.goos }}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
cgo_cflags="-I${OFFICE_OXIDE_PREFIX}/include -I${OFFICE_OXIDE_PREFIX}/include/office_oxide_c"
|
||||
|
||||
echo "office_oxide prefix: ${OFFICE_OXIDE_PREFIX}"
|
||||
echo "CGO_CFLAGS: ${cgo_cflags}"
|
||||
echo "CGO_LDFLAGS: ${cgo_ldflags}"
|
||||
|
||||
CGO_ENABLED=1 \
|
||||
CGO_CFLAGS="${cgo_cflags}" \
|
||||
CGO_LDFLAGS="${cgo_ldflags}" \
|
||||
GOOS="${{ matrix.goos }}" \
|
||||
GOARCH="${{ matrix.goarch }}" \
|
||||
go build \
|
||||
@@ -455,15 +435,6 @@ jobs:
|
||||
|
||||
chmod +x "${output}"
|
||||
|
||||
if [[ "${{ matrix.goos }}" == "linux" ]] && command -v ldd >/dev/null 2>&1; then
|
||||
if ldd "${output}" 2>&1 | grep -q "liboffice_oxide"; then
|
||||
echo "::error::linux CLI unexpectedly links liboffice_oxide dynamically"
|
||||
ldd "${output}" || true
|
||||
exit 1
|
||||
fi
|
||||
echo "Verified linux CLI does not require liboffice_oxide.so at runtime"
|
||||
fi
|
||||
|
||||
- name: Build Go CLI release binaries
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
@@ -478,7 +449,6 @@ jobs:
|
||||
$output = Join-Path $env:DIST_DIR "${env:CLI_NAME}-${env:RELEASE_TAG}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.output_ext }}"
|
||||
Write-Host "Building ${{ matrix.goos }}/${{ matrix.goarch }} -> $output"
|
||||
|
||||
$officeOxidePrefix = $env:OFFICE_OXIDE_PREFIX -replace "\\", "/"
|
||||
$cc = $env:CC
|
||||
if ([string]::IsNullOrWhiteSpace($cc)) {
|
||||
Write-Error "CC is not set"
|
||||
@@ -488,35 +458,14 @@ jobs:
|
||||
Write-Error "C compiler does not exist: $cc"
|
||||
exit 1
|
||||
}
|
||||
if (-not (Test-Path "${officeOxidePrefix}/lib/liboffice_oxide.a")) {
|
||||
Write-Error "liboffice_oxide.a does not exist: ${officeOxidePrefix}/lib/liboffice_oxide.a"
|
||||
exit 1
|
||||
}
|
||||
if (-not (Test-Path "internal/binding/cpp/cmake-build-release/librag_tokenizer_c_api.a")) {
|
||||
Write-Error "librag_tokenizer_c_api.a does not exist"
|
||||
exit 1
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace($env:PCRE2_LIBDIR) -or -not (Test-Path $env:PCRE2_LIBDIR)) {
|
||||
Write-Error "PCRE2_LIBDIR is not set or does not exist: $env:PCRE2_LIBDIR"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$ragTokenizerLib = (Resolve-Path "internal/binding/cpp/cmake-build-release/librag_tokenizer_c_api.a").Path -replace '\\', '/'
|
||||
$pcre2LibDir = $env:PCRE2_LIBDIR -replace '\\', '/'
|
||||
$pcre2IncludeDir = $env:PCRE2_INCLUDEDIR -replace '\\', '/'
|
||||
|
||||
$env:CGO_ENABLED = "1"
|
||||
$env:CC = $cc
|
||||
$env:CGO_CFLAGS = "-I${officeOxidePrefix}/include -I${officeOxidePrefix}/include/office_oxide_c -I${pcre2IncludeDir}"
|
||||
$env:CGO_LDFLAGS = "${officeOxidePrefix}/lib/liboffice_oxide.a ${ragTokenizerLib} -L${pcre2LibDir} -lpcre2-8 -lc++ -static -static-libgcc -static-libstdc++ -lws2_32 -lbcrypt -lntdll -luserenv -ladvapi32"
|
||||
$env:GOOS = "${{ matrix.goos }}"
|
||||
$env:GOARCH = "${{ matrix.goarch }}"
|
||||
|
||||
Write-Host "CC: $env:CC"
|
||||
& $env:CC --version
|
||||
Write-Host "office_oxide prefix: $officeOxidePrefix"
|
||||
Write-Host "CGO_CFLAGS: $env:CGO_CFLAGS"
|
||||
Write-Host "CGO_LDFLAGS: $env:CGO_LDFLAGS"
|
||||
|
||||
go build `
|
||||
-trimpath `
|
||||
|
||||
Reference in New Issue
Block a user