@@ -48,6 +48,19 @@ ldflags="\
4848-X 'github.com/OpenListTeam/OpenList/v4/internal/conf.WebVersion=$webVersion ' \
4949"
5050
51+ # Keep sqlite driver tag selection centralized to avoid target drift.
52+ GetBuildTagsForTarget () {
53+ local target=" $1 "
54+ case " $target " in
55+ linux-loong64|linux-mips|linux-mips64|linux-mips64le|linux-mipsle|linux-musl-loong64|linux-musl-mips|linux-musl-mips64|linux-musl-mips64le|linux-musl-mipsle|windows-386|windows7-386|windows7-amd64)
56+ echo " jsoniter,sqlite_cgo_compat"
57+ ;;
58+ * )
59+ echo " jsoniter"
60+ ;;
61+ esac
62+ }
63+
5164FetchWebRolling () {
5265 pre_release_json=$( eval " curl -fsSL --max-time 2 $githubAuthArgs -H \" Accept: application/vnd.github.v3+json\" \" https://api.github.com/repos/$frontendRepo /releases/tags/rolling\" " )
5366 pre_release_assets=$( echo " $pre_release_json " | jq -r ' .assets[].browser_download_url' )
@@ -110,6 +123,7 @@ BuildWin7() {
110123 # Build for both 386 and amd64 architectures
111124 for arch in " 386" " amd64" ; do
112125 echo " building for windows7-${arch} "
126+ build_tags=$( GetBuildTagsForTarget " windows7-${arch} " )
113127 export GOOS=windows
114128 export GOARCH=${arch}
115129 export CGO_ENABLED=1
@@ -124,7 +138,7 @@ BuildWin7() {
124138 fi
125139
126140 # Use the patched Go compiler for Win7 compatibility
127- $( pwd) /go-win7/bin/go build -o " ${1} -${arch} .exe" -ldflags=" $ldflags " -tags=jsoniter .
141+ $( pwd) /go-win7/bin/go build -o " ${1} -${arch} .exe" -ldflags=" $ldflags " -tags=" $build_tags " .
128142 done
129143}
130144
@@ -193,11 +207,12 @@ BuildDockerMultiplatform() {
193207 cgo_cc=${CGO_ARGS[$i]}
194208 os=${os_arch%% -* }
195209 arch=${os_arch##* -}
210+ build_tags=$( GetBuildTagsForTarget " $os_arch " )
196211 export GOOS=$os
197212 export GOARCH=$arch
198213 export CC=${cgo_cc}
199214 echo " building for $os_arch "
200- go build -o build/$os /$arch /" $appName " -ldflags=" $docker_lflags " -tags=jsoniter .
215+ go build -o build/$os /$arch /" $appName " -ldflags=" $docker_lflags " -tags=" $build_tags " .
201216 done
202217
203218 DOCKER_ARM_ARCHES=(linux-arm/v6 linux-arm/v7)
@@ -237,6 +252,8 @@ BuildLoongGLIBC() {
237252 local target_abi=" $2 "
238253 local output_file=" $1 "
239254 local oldWorldGoVersion=" 1.25.0"
255+ local loong_tags
256+ loong_tags=$( GetBuildTagsForTarget " linux-loong64" )
240257
241258 if [ " $target_abi " = " abi1.0" ]; then
242259 echo building for linux-loong64-abi1.0
@@ -311,7 +328,7 @@ BuildLoongGLIBC() {
311328 CXX=" $( pwd) /gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-g++" \
312329 CGO_ENABLED=1 \
313330 GOCACHE=" $abi1_cache_dir " \
314- $( pwd) /go-loong64-abi1.0/bin/go build -a -o " $output_file " -ldflags=" $ldflags " -tags=jsoniter . ; then
331+ $( pwd) /go-loong64-abi1.0/bin/go build -a -o " $output_file " -ldflags=" $ldflags " -tags=" $loong_tags " . ; then
315332 echo " Error: Build failed with patched Go compiler"
316333 echo " Attempting retry with cache cleanup..."
317334 env GOCACHE=" $abi1_cache_dir " $( pwd) /go-loong64-abi1.0/bin/go clean -cache
@@ -320,7 +337,7 @@ BuildLoongGLIBC() {
320337 CXX=" $( pwd) /gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-g++" \
321338 CGO_ENABLED=1 \
322339 GOCACHE=" $abi1_cache_dir " \
323- $( pwd) /go-loong64-abi1.0/bin/go build -a -o " $output_file " -ldflags=" $ldflags " -tags=jsoniter . ; then
340+ $( pwd) /go-loong64-abi1.0/bin/go build -a -o " $output_file " -ldflags=" $ldflags " -tags=" $loong_tags " . ; then
324341 echo " Error: Build failed again after cache cleanup"
325342 echo " Build environment details:"
326343 echo " GOOS=linux"
@@ -366,11 +383,11 @@ BuildLoongGLIBC() {
366383
367384 # Use standard Go compiler for new-world build
368385 echo " Building with standard Go compiler for new-world ABI2.0..."
369- if ! go build -a -o " $output_file " -ldflags=" $ldflags " -tags=jsoniter . ; then
386+ if ! go build -a -o " $output_file " -ldflags=" $ldflags " -tags=" $loong_tags " . ; then
370387 echo " Error: Build failed with standard Go compiler"
371388 echo " Attempting retry with cache cleanup..."
372389 go clean -cache
373- if ! go build -a -o " $output_file " -ldflags=" $ldflags " -tags=jsoniter . ; then
390+ if ! go build -a -o " $output_file " -ldflags=" $ldflags " -tags=" $loong_tags " . ; then
374391 echo " Error: Build failed again after cache cleanup"
375392 echo " Build environment details:"
376393 echo " GOOS=$GOOS "
@@ -391,6 +408,7 @@ BuildReleaseLinuxMusl() {
391408 mkdir -p " build"
392409 muslflags=" --extldflags '-static -fpic' $ldflags "
393410 BASE=" https://github.com/OpenListTeam/musl-compilers/releases/latest/download/"
411+ # Keep mips-family targets enabled; sqlite driver selection is handled by Go build tags.
394412 FILES=(x86_64-linux-musl-cross aarch64-linux-musl-cross mips-linux-musl-cross mips64-linux-musl-cross mips64el-linux-musl-cross mipsel-linux-musl-cross powerpc64le-linux-musl-cross s390x-linux-musl-cross loongarch64-linux-musl-cross)
395413 for i in " ${FILES[@]} " ; do
396414 url=" ${BASE}${i} .tgz"
@@ -403,12 +421,13 @@ BuildReleaseLinuxMusl() {
403421 for i in " ${! OS_ARCHES[@]} " ; do
404422 os_arch=${OS_ARCHES[$i]}
405423 cgo_cc=${CGO_ARGS[$i]}
424+ build_tags=$( GetBuildTagsForTarget " $os_arch " )
406425 echo building for ${os_arch}
407426 export GOOS=${os_arch%% -* }
408427 export GOARCH=${os_arch##* -}
409428 export CC=${cgo_cc}
410429 export CGO_ENABLED=1
411- go build -o ./build/$appName -$os_arch -ldflags=" $muslflags " -tags=jsoniter .
430+ go build -o ./build/$appName -$os_arch -ldflags=" $muslflags " -tags=" $build_tags " .
412431 done
413432}
414433
0 commit comments