🔨 Update kernel building script

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-03-29 16:11:26 +08:00
parent 39f861e986
commit f2e6587120
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
9 changed files with 19 additions and 19 deletions

View file

@ -41,8 +41,8 @@ Note: In the development environment, the kernel process will not be automatical
### Desktop
* `cd kernel`
* Windows: `go build --tags "fts5" -o "../app/kernel/SiYuan-Kernel.exe"`
* Linux/macOS: `go build --tags "fts5" -o "../app/kernel/SiYuan-Kernel"`
* Windows: `go build -tags "fts5" -o "../app/kernel/SiYuan-Kernel.exe"`
* Linux/macOS: `go build -tags "fts5" -o "../app/kernel/SiYuan-Kernel"`
* `cd ../app/kernel`
* Windows: `./SiYuan-Kernel.exe --wd=.. --mode=dev`
* Linux/macOS: `./SiYuan-Kernel --wd=.. --mode=dev`
@ -50,14 +50,14 @@ Note: In the development environment, the kernel process will not be automatical
### iOS
* `cd kernel`
* `gomobile bind --tags fts5 -ldflags '-s -w' -v -o ./ios/iosk.xcframework -target=ios ./mobile/`
* `gomobile bind -tags fts5 -ldflags '-s -w' -v -o ./ios/iosk.xcframework -target=ios ./mobile/`
* https://github.com/siyuan-note/siyuan-ios
### Android
* `cd kernel`
* `set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8`
* `gomobile bind --tags fts5 -ldflags "-s -w" -v -o kernel.aar -target=android/arm64 -androidapi 26 ./mobile/`
* `gomobile bind -tags fts5 -ldflags "-s -w" -v -o kernel.aar -target=android/arm64 -androidapi 26 ./mobile/`
* https://github.com/siyuan-note/siyuan-android
### Harmony

View file

@ -41,8 +41,8 @@ NPM 镜像:
### 桌面端
* `cd kernel`
* Windows: `go build --tags "fts5" -o "../app/kernel/SiYuan-Kernel.exe"`
* Linux/macOS: `go build --tags "fts5" -o "../app/kernel/SiYuan-Kernel"`
* Windows: `go build -tags "fts5" -o "../app/kernel/SiYuan-Kernel.exe"`
* Linux/macOS: `go build -tags "fts5" -o "../app/kernel/SiYuan-Kernel"`
* `cd ../app/kernel`
* Windows: `./SiYuan-Kernel.exe --wd=.. --mode=dev`
* Linux/macOS: `./SiYuan-Kernel --wd=.. --mode=dev`
@ -50,14 +50,14 @@ NPM 镜像:
### iOS
* `cd kernel`
* `gomobile bind --tags fts5 -ldflags '-s -w' -v -o ./ios/iosk.xcframework -target=ios ./mobile/`
* `gomobile bind -tags fts5 -ldflags '-s -w' -v -o ./ios/iosk.xcframework -target=ios ./mobile/`
* https://github.com/siyuan-note/siyuan-ios
### Android
* `cd kernel`
* `set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8`
* `gomobile bind --tags fts5 -ldflags "-s -w" -v -o kernel.aar -target=android/arm64 -androidapi 26 ./mobile/`
* `gomobile bind -tags fts5 -ldflags "-s -w" -v -o kernel.aar -target=android/arm64 -androidapi 26 ./mobile/`
* https://github.com/siyuan-note/siyuan-android
### Harmony

View file

@ -213,7 +213,7 @@ jobs:
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel
- name: Building Kernel
run: go build --tags fts5 -o "${{ matrix.config.kernel_path }}" -v -ldflags "${{ matrix.config.build_args_prefix }} github.com/${{ github.repository }}/kernel/util.${{ matrix.config.build_args_suffix }}"
run: go build -tags fts5 -o "${{ matrix.config.kernel_path }}" -v -ldflags "${{ matrix.config.build_args_prefix }} github.com/${{ github.repository }}/kernel/util.${{ matrix.config.build_args_suffix }}"
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel
env:
GO111MODULE: on

View file

@ -37,7 +37,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/g
ADD kernel/ .
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg \
go build --tags fts5 -v -ldflags "-s -w"
go build -tags fts5 -v -ldflags "-s -w"
FROM alpine:latest
LABEL maintainer="Liang Ding<845765@qq.com>"

View file

@ -24,4 +24,4 @@ export GOARCH=amd64
export CGO_CFLAGS="-I${LOG_ADAPTOR_HOME}/include -g -O2 `$LLVMCONFIG --cflags` --target=x86_64-linux-ohos --sysroot=$OHOS_NDK_HOME/native/sysroot"
export CGO_LDFLAGS="--target=x86_64-linux-ohos -fuse-ld=lld -L${LOG_ADAPTOR_HOME}/dist/x86_64"
go build --tags fts5 -ldflags "-s -w" -buildmode=c-shared -v -o libkernel.so .
go build -tags fts5 -ldflags "-s -w" -buildmode=c-shared -v -o libkernel.so .

View file

@ -24,5 +24,5 @@ export GOARCH=arm64
export CGO_CFLAGS="-I${LOG_ADAPTOR_HOME}/include -g -O2 `$LLVMCONFIG --cflags` --target=aarch64-linux-ohos --sysroot=$OHOS_NDK_HOME/native/sysroot"
export CGO_LDFLAGS="--target=aarch64-linux-ohos -fuse-ld=lld -L${LOG_ADAPTOR_HOME}/dist/arm64-v8a"
go build --tags fts5 -ldflags "-s -w" -buildmode=c-shared -v -o libkernel.so .
#go build --tags fts5 -buildmode=c-shared -v -o libkernel.so .
go build -tags fts5 -ldflags "-s -w" -buildmode=c-shared -v -o libkernel.so .
#go build -tags fts5 -buildmode=c-shared -v -o libkernel.so .

View file

@ -70,13 +70,13 @@ if [[ "$TARGET" == 'amd64' || "$TARGET" == 'all' ]]; then
echo
echo 'Building Kernel amd64'
export GOARCH=amd64
go build --tags fts5 -v -o "../app/kernel-darwin/SiYuan-Kernel" -ldflags "-s -w" .
go build -tags fts5 -v -o "../app/kernel-darwin/SiYuan-Kernel" -ldflags "-s -w" .
fi
if [[ "$TARGET" == 'arm64' || "$TARGET" == 'all' ]]; then
echo
echo 'Building Kernel arm64'
export GOARCH=arm64
go build --tags fts5 -v -o "../app/kernel-darwin-arm64/SiYuan-Kernel" -ldflags "-s -w" .
go build -tags fts5 -v -o "../app/kernel-darwin-arm64/SiYuan-Kernel" -ldflags "-s -w" .
fi
echo

View file

@ -71,14 +71,14 @@ if [[ "$TARGET" == 'amd64' || "$TARGET" == 'all' ]]; then
echo 'Building Kernel amd64'
export GOARCH=amd64
export CC=~/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc
go build -buildmode=pie --tags fts5 -v -o "../app/kernel-linux/SiYuan-Kernel" -ldflags "-s -w -extldflags -static-pie" .
go build -buildmode=pie -tags fts5 -v -o "../app/kernel-linux/SiYuan-Kernel" -ldflags "-s -w -extldflags -static-pie" .
fi
if [[ "$TARGET" == 'arm64' || "$TARGET" == 'all' ]]; then
echo
echo 'Building Kernel arm64'
export GOARCH=arm64
export CC=~/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc
go build -buildmode=pie --tags fts5 -v -o "../app/kernel-linux-arm64/SiYuan-Kernel" -ldflags "-s -w -extldflags -static-pie" .
go build -buildmode=pie -tags fts5 -v -o "../app/kernel-linux-arm64/SiYuan-Kernel" -ldflags "-s -w -extldflags -static-pie" .
fi
echo

View file

@ -101,7 +101,7 @@ if defined BUILD_AMD64 (
echo.
echo Building Kernel amd64
set GOARCH=amd64
go build --tags fts5 -v -o "%PROJECT_ROOT%\app\kernel\SiYuan-Kernel.exe" -ldflags "-s -w -H=windowsgui" .
go build -tags fts5 -v -o "%PROJECT_ROOT%\app\kernel\SiYuan-Kernel.exe" -ldflags "-s -w -H=windowsgui" .
if errorlevel 1 (
exit /b %errorlevel%
)
@ -112,7 +112,7 @@ if defined BUILD_ARM64 (
set GOARCH=arm64
@REM if you want to build arm64, you need to install aarch64-w64-mingw32-gcc
set CC="D:/Program Files/llvm-mingw-20240518-ucrt-x86_64/bin/aarch64-w64-mingw32-gcc.exe"
go build --tags fts5 -v -o "%PROJECT_ROOT%\app\kernel-arm64\SiYuan-Kernel.exe" -ldflags "-s -w -H=windowsgui" .
go build -tags fts5 -v -o "%PROJECT_ROOT%\app\kernel-arm64\SiYuan-Kernel.exe" -ldflags "-s -w -H=windowsgui" .
if errorlevel 1 (
exit /b %errorlevel%
)