|
| 1 | +name: Static Client Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + |
| 8 | + build-linux-static-client: |
| 9 | + name: build-linux-static-client-${{ matrix.arch }} |
| 10 | + runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }} |
| 11 | + |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + arch: [x64, x86] |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 10 |
| 22 | + |
| 23 | + - name: Write build script |
| 24 | + run: | |
| 25 | + mkdir -p gen |
| 26 | + cat > /tmp/build-static-client.sh <<'EOF' |
| 27 | + #!/bin/sh |
| 28 | + set -e |
| 29 | + gcc -v |
| 30 | + ld -v |
| 31 | + make -v |
| 32 | + cd /home/ctng/firebird-build |
| 33 | + /firebird/autogen.sh \ |
| 34 | + --host=$BUILD_ARCH \ |
| 35 | + --prefix=/opt/firebird \ |
| 36 | + --enable-binreloc \ |
| 37 | + --with-builtin-tomcrypt \ |
| 38 | + --with-termlib=:libncurses.a \ |
| 39 | + --with-atomiclib=:libatomic.a \ |
| 40 | + --enable-client-only |
| 41 | + make client_static -j$(nproc) |
| 42 | + # CXX lives in gen/make.defaults (substituted by configure). The |
| 43 | + # top-level Makefile only forwards targets to gen/ and has no CXX=. |
| 44 | + CXX=$(sed -n 's/^[[:space:]]*CXX[[:space:]]*=[[:space:]]*//p' gen/make.defaults | head -n 1) |
| 45 | + if test -z "$CXX"; then |
| 46 | + echo "error: could not determine CXX from gen/make.defaults" >&2 |
| 47 | + exit 1 |
| 48 | + fi |
| 49 | + echo "Linking example with CXX=$CXX" |
| 50 | + "$CXX" /firebird/examples/interfaces/01.create.cpp \ |
| 51 | + -I/firebird/src/include \ |
| 52 | + -I/home/ctng/firebird-build/gen/Release/firebird/include \ |
| 53 | + -L/home/ctng/firebird-build/gen/Release/firebird/lib \ |
| 54 | + -L/home/ctng/firebird-build/temp/Release \ |
| 55 | + -lfbclient -ltommath -lz -ldl -pthread \ |
| 56 | + -o /tmp/01.create |
| 57 | + EOF |
| 58 | + chmod +x /tmp/build-static-client.sh |
| 59 | +
|
| 60 | + - name: Build |
| 61 | + run: | |
| 62 | + docker run --platform ${{ (matrix.arch == 'x64' && 'amd64') || 'i386' }} --rm \ |
| 63 | + -e CTNG_UID=$(id -u) -e CTNG_GID=$(id -g) \ |
| 64 | + -v ${{ github.workspace }}:/firebird:ro \ |
| 65 | + -v ${{ github.workspace }}/gen:/home/ctng/firebird-build/gen \ |
| 66 | + -v /tmp/build-static-client.sh:/build.sh:ro \ |
| 67 | + firebirdsql/firebird-builder-linux:fb6-${{ matrix.arch }}-ng-v2 |
| 68 | +
|
| 69 | + - name: Upload static library |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: firebird-linux-${{ matrix.arch }}-static-client |
| 73 | + path: gen/Release/firebird/lib/libfbclient.a |
| 74 | + |
| 75 | + build-linux-static-client-arm64: |
| 76 | + name: build-linux-static-client-arm64 |
| 77 | + runs-on: ubuntu-24.04-arm |
| 78 | + |
| 79 | + steps: |
| 80 | + - name: Checkout |
| 81 | + uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + fetch-depth: 10 |
| 84 | + |
| 85 | + - name: Prepare |
| 86 | + run: | |
| 87 | + sudo apt-get update |
| 88 | + sudo apt-get install -y libtool-bin automake autoconf-archive libtool libicu-dev zlib1g-dev cmake |
| 89 | +
|
| 90 | + - name: Build |
| 91 | + run: | |
| 92 | + ./autogen.sh \ |
| 93 | + --with-builtin-tommath \ |
| 94 | + --with-builtin-tomcrypt \ |
| 95 | + --without-editline \ |
| 96 | + --enable-binreloc \ |
| 97 | + --prefix=/opt/firebird \ |
| 98 | + --enable-client-only |
| 99 | + make client_static -j$(nproc) |
| 100 | +
|
| 101 | + - name: Compile and link interface example |
| 102 | + run: | |
| 103 | + g++ examples/interfaces/01.create.cpp \ |
| 104 | + -Isrc/include \ |
| 105 | + -Igen/Release/firebird/include \ |
| 106 | + -Lgen/Release/firebird/lib \ |
| 107 | + -Ltemp/Release \ |
| 108 | + -lfbclient -ltommath -lz -ldl -pthread \ |
| 109 | + -o /tmp/01.create |
| 110 | +
|
| 111 | + - name: Upload static library |
| 112 | + uses: actions/upload-artifact@v4 |
| 113 | + with: |
| 114 | + name: firebird-linux-arm64-static-client |
| 115 | + path: gen/Release/firebird/lib/libfbclient.a |
| 116 | + |
| 117 | + build-macos-static-client: |
| 118 | + name: build-macos-static-client-${{ matrix.arch }} |
| 119 | + runs-on: ${{ (matrix.arch == 'arm64' && 'macos-15') || 'macos-15-intel' }} |
| 120 | + |
| 121 | + strategy: |
| 122 | + fail-fast: false |
| 123 | + matrix: |
| 124 | + arch: [x64, arm64] |
| 125 | + |
| 126 | + steps: |
| 127 | + - name: Checkout |
| 128 | + uses: actions/checkout@v4 |
| 129 | + with: |
| 130 | + fetch-depth: 10 |
| 131 | + submodules: 'true' |
| 132 | + |
| 133 | + - name: Prepare - Install tools |
| 134 | + run: | |
| 135 | + brew install --quiet automake autoconf-archive libtool ninja llvm |
| 136 | + echo "${{ (matrix.arch == 'arm64' && '/opt/homebrew/opt/llvm/bin') || '/usr/local/opt/llvm/bin' }}" >> $GITHUB_PATH |
| 137 | +
|
| 138 | + - name: Restore vcpkg cache |
| 139 | + uses: actions/cache/restore@v4 |
| 140 | + id: restore-vcpkg-cache |
| 141 | + with: |
| 142 | + path: ~/.cache/vcpkg/archives |
| 143 | + key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-staticclient-${{ hashFiles('vcpkg-custom/**', 'vcpkg.json', 'vcpkg-configuration.json') }} |
| 144 | + restore-keys: | |
| 145 | + vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-staticclient- |
| 146 | + vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}- |
| 147 | +
|
| 148 | + - name: Build |
| 149 | + run: | |
| 150 | + export LIBTOOLIZE=glibtoolize |
| 151 | + export LIBTOOL=glibtool |
| 152 | + ./autogen.sh --with-builtin-tommath --with-builtin-tomcrypt --enable-client-only |
| 153 | + make client_static -j4 |
| 154 | +
|
| 155 | + - name: Compile and link interface example |
| 156 | + run: | |
| 157 | + clang++ examples/interfaces/01.create.cpp \ |
| 158 | + -Isrc/include \ |
| 159 | + -Igen/Release/firebird/include \ |
| 160 | + -Lgen/Release/firebird/lib \ |
| 161 | + -Ltemp/Release \ |
| 162 | + -lfbclient -ltommath -lz \ |
| 163 | + -liconv -lobjc -framework CoreFoundation -framework Foundation -framework Security \ |
| 164 | + -o /tmp/01.create |
| 165 | +
|
| 166 | + - name: Upload static library |
| 167 | + uses: actions/upload-artifact@v4 |
| 168 | + with: |
| 169 | + name: firebird-macos-${{ matrix.arch }}-static-client |
| 170 | + path: gen/Release/firebird/lib/libfbclient.a |
| 171 | + |
| 172 | + - name: Save vcpkg cache |
| 173 | + uses: actions/cache/save@v4 |
| 174 | + if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true' |
| 175 | + with: |
| 176 | + path: ~/.cache/vcpkg/archives |
| 177 | + key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} |
| 178 | + |
| 179 | + build-windows-static-client: |
| 180 | + name: build-windows-static-client-${{ matrix.platform }} |
| 181 | + runs-on: ${{ (matrix.platform == 'arm64' && 'windows-11-arm') || 'windows-2025' }} |
| 182 | + env: |
| 183 | + VS_VERSION: ${{ (matrix.platform == 'arm64' && '2022') || '2026' }} |
| 184 | + |
| 185 | + strategy: |
| 186 | + fail-fast: false |
| 187 | + matrix: |
| 188 | + platform: [x64, x86, arm64] |
| 189 | + |
| 190 | + steps: |
| 191 | + - name: Checkout |
| 192 | + uses: actions/checkout@v4 |
| 193 | + with: |
| 194 | + fetch-depth: 10 |
| 195 | + |
| 196 | + - name: Prepare |
| 197 | + shell: cmd |
| 198 | + run: | |
| 199 | + for /r %%i in (*.bat) do unix2dos "%%i" |
| 200 | +
|
| 201 | + - name: Prepare envs |
| 202 | + shell: cmd |
| 203 | + env: |
| 204 | + PLATFORM: ${{ matrix.platform }} |
| 205 | + run: | |
| 206 | + if "%PLATFORM%" == "x64" set FB_VS_ARCH=amd64 |
| 207 | + if "%PLATFORM%" == "x64" set FB_PROCESSOR_ARCHITECTURE=AMD64 |
| 208 | + if "%PLATFORM%" == "x86" set FB_VS_ARCH=x86 |
| 209 | + if "%PLATFORM%" == "x86" set FB_PROCESSOR_ARCHITECTURE=x86 |
| 210 | + if "%PLATFORM%" == "x86" set FB_LIBRARY_PLATFORM=Win32 |
| 211 | + if "%PLATFORM%" == "arm64" set FB_VS_ARCH=arm64 |
| 212 | + if "%PLATFORM%" == "arm64" set FB_PROCESSOR_ARCHITECTURE=ARM64 |
| 213 | + if not "%PLATFORM%" == "x86" set FB_LIBRARY_PLATFORM=%PLATFORM% |
| 214 | + echo FB_VS_ARCH=%FB_VS_ARCH%>>%GITHUB_ENV% |
| 215 | + echo FB_PROCESSOR_ARCHITECTURE=%FB_PROCESSOR_ARCHITECTURE%>>%GITHUB_ENV% |
| 216 | + echo FB_LIBRARY_PLATFORM=%FB_LIBRARY_PLATFORM%>>%GITHUB_ENV% |
| 217 | +
|
| 218 | + - name: Build |
| 219 | + shell: cmd |
| 220 | + env: |
| 221 | + PLATFORM: ${{ matrix.platform }} |
| 222 | + VS_SCRIPT: C:\Program Files\Microsoft Visual Studio\${{ (matrix.platform == 'arm64' && '2022') || '18' }}\Enterprise\Common7\Tools\VsDevCmd.bat |
| 223 | + run: | |
| 224 | + call "%VS_SCRIPT%" -arch=%FB_VS_ARCH% |
| 225 | + set "PATH=%VSINSTALLDIR%VC\Tools\Llvm\x64\bin;%PATH%" |
| 226 | + cd builds\win32 |
| 227 | + call run_all.bat CLIENT_ONLY=STATIC JUSTBUILD NOCLEAN |
| 228 | +
|
| 229 | + - name: Compile and link interface example |
| 230 | + shell: cmd |
| 231 | + env: |
| 232 | + PLATFORM: ${{ matrix.platform }} |
| 233 | + VS_SCRIPT: C:\Program Files\Microsoft Visual Studio\${{ (matrix.platform == 'arm64' && '2022') || '18' }}\Enterprise\Common7\Tools\VsDevCmd.bat |
| 234 | + run: | |
| 235 | + call "%VS_SCRIPT%" -arch=%FB_VS_ARCH% |
| 236 | + cl /nologo /EHsc /MD /Isrc\include /Ioutput_%FB_LIBRARY_PLATFORM%_release\include examples\interfaces\01.create.cpp output_%FB_LIBRARY_PLATFORM%_release\lib\fbclient_static_ms.lib extern\libtommath\lib\%FB_LIBRARY_PLATFORM%\Release\tommath.lib advapi32.lib bcrypt.lib legacy_stdio_definitions.lib mpr.lib ole32.lib psapi.lib shell32.lib user32.lib ws2_32.lib /Fe:%TEMP%\01.create.exe |
| 237 | +
|
| 238 | + - name: Upload static library |
| 239 | + uses: actions/upload-artifact@v4 |
| 240 | + with: |
| 241 | + name: firebird-windows-${{ matrix.platform }}-static-client |
| 242 | + path: output_${{ env.FB_LIBRARY_PLATFORM }}_release\lib\fbclient_static_ms.lib |
0 commit comments