diff options
| author | ruki <[email protected]> | 2025-12-03 00:27:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-03 00:27:26 +0800 |
| commit | c1459f60d084d8be5d967a4353087fce0384019a (patch) | |
| tree | 2c685de53991c6336e56cc2c9aa75c471a1e3b57 | |
| parent | bc7caf95a9cfdefed930937e8450997a4cdc8191 (diff) | |
fix solaris build
| -rw-r--r-- | .github/workflows/solaris.yml | 49 | ||||
| m--------- | core/src/tbox/tbox | 0 | ||||
| -rw-r--r-- | core/xmake.lua | 5 | ||||
| -rwxr-xr-x | core/xmake.sh | 5 |
4 files changed, 10 insertions, 49 deletions
diff --git a/.github/workflows/solaris.yml b/.github/workflows/solaris.yml index 6f4dbba76..964532b1a 100644 --- a/.github/workflows/solaris.yml +++ b/.github/workflows/solaris.yml @@ -7,56 +7,7 @@ on: types: [published] jobs: - check: - runs-on: ubuntu-latest - outputs: - should-run: ${{ steps.check.outputs.should-run }} - steps: - - name: Random execution check - id: check - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const outputFile = process.env.GITHUB_OUTPUT; - - // Always run for release events - if (context.eventName === 'release') { - fs.appendFileSync(outputFile, `should-run=true\n`); - core.info('Release event detected. Will run tests.'); - return; - } - - // Execution probability (default 50%, can be overridden via env) - const probability = parseFloat(process.env.RUN_PROBABILITY || '0.5'); - - // Generate deterministic "random" number based on commit SHA, run ID, and current time - // Adding time ensures better randomness while keeping same commit/run consistent - const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); // Round to hour for consistency - const seed = context.sha + context.runId + timeSeed; - let hash = 0; - for (let i = 0; i < seed.length; i++) { - const char = seed.charCodeAt(i); - hash = ((hash << 5) - hash) + char; - hash = hash | 0; // Convert to 32-bit integer - } - // Normalize to 0-1 range - const random = Math.abs(hash) / 2147483647; - const shouldRun = random < probability; - - // Use environment file instead of deprecated set-output - fs.appendFileSync(outputFile, `should-run=${shouldRun}\n`); - if (shouldRun) { - core.info(`Random check passed (${(random * 100).toFixed(2)}% < ${(probability * 100).toFixed(0)}%). Will run tests.`); - } else { - core.info(`Random check failed (${(random * 100).toFixed(2)}% >= ${(probability * 100).toFixed(0)}%). Skipping.`); - } - env: - RUN_PROBABILITY: ${{ vars.SOLARIS_RUN_PROBABILITY || '0.5' }} - build: - needs: check - if: needs.check.outputs.should-run == 'true' runs-on: ubuntu-latest concurrency: diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox -Subproject 1d777aca24121df60d4219e08c0230e30fb0575 +Subproject 5ec46dff6581ce3b0c2b3ea42bfd766fcd91ef2 diff --git a/core/xmake.lua b/core/xmake.lua index e819f572b..216eae3eb 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -24,6 +24,11 @@ add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing", "-Wno- -- add definitions add_defines("_GNU_SOURCE=1", "_FILE_OFFSET_BITS=64", "_LARGEFILE_SOURCE") +-- ensure POSIX/XOPEN features are available on Solaris (for setenv, unsetenv, clock_gettime, etc.) +if is_plat("solaris") then + add_defines("_POSIX_C_SOURCE=200112L", "_XOPEN_SOURCE=600") +end + -- add vectorexts --[[ if is_arch("x86", "x64", "i386", "x86_64") then diff --git a/core/xmake.sh b/core/xmake.sh index 5a8fcb072..fd8291cc9 100755 --- a/core/xmake.sh +++ b/core/xmake.sh @@ -12,6 +12,11 @@ set_languages "c99" # add definitions add_defines "_GNU_SOURCE=1" "_FILE_OFFSET_BITS=64" "_LARGEFILE_SOURCE" +# ensure POSIX/XOPEN features are available on Solaris (for setenv, unsetenv, clock_gettime, etc.) +if is_plat "solaris"; then + add_defines "_POSIX_C_SOURCE=200112L" "_XOPEN_SOURCE=600" +fi + # disable some compiler errors if is_plat "macosx"; then add_cxflags "-Wno-error=deprecated-declarations" "-fno-strict-aliasing" "-Wno-error=nullability-completeness" "-Wno-error=parentheses-equality" |
