ffi 1.17.2 → 1.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +25 -0
  4. data/Gemfile +7 -4
  5. data/README.md +1 -0
  6. data/Rakefile +7 -4
  7. data/Steepfile +8 -0
  8. data/ext/ffi_c/DynamicLibrary.c +1 -1
  9. data/ext/ffi_c/Function.c +2 -0
  10. data/ext/ffi_c/MethodHandle.c +4 -2
  11. data/ext/ffi_c/libffi/.ci/Containerfile.ppc64le +12 -0
  12. data/ext/ffi_c/libffi/.ci/build.sh +38 -33
  13. data/ext/ffi_c/libffi/.ci/install.sh +46 -50
  14. data/ext/ffi_c/libffi/.ci/site.exp +6 -0
  15. data/ext/ffi_c/libffi/.gail-labels +44 -0
  16. data/ext/ffi_c/libffi/.github/workflows/build.yml +212 -333
  17. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +58 -3
  18. data/ext/ffi_c/libffi/.github/workflows/label-new-issue.yaml +15 -0
  19. data/ext/ffi_c/libffi/.github/workflows/tarball.yml +55 -0
  20. data/ext/ffi_c/libffi/LICENSE +1 -1
  21. data/ext/ffi_c/libffi/Makefile.am +17 -13
  22. data/ext/ffi_c/libffi/Makefile.in +37 -30
  23. data/ext/ffi_c/libffi/README.md +22 -3
  24. data/ext/ffi_c/libffi/configure +105 -121
  25. data/ext/ffi_c/libffi/configure.ac +21 -8
  26. data/ext/ffi_c/libffi/configure.host +6 -1
  27. data/ext/ffi_c/libffi/doc/Makefile.in +3 -0
  28. data/ext/ffi_c/libffi/doc/libffi.texi +24 -1
  29. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  30. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -28
  31. data/ext/ffi_c/libffi/include/Makefile.in +3 -0
  32. data/ext/ffi_c/libffi/include/ffi.h.in +19 -1
  33. data/ext/ffi_c/libffi/libffi.map.in +13 -1
  34. data/ext/ffi_c/libffi/libtool-version +1 -1
  35. data/ext/ffi_c/libffi/m4/asmcfi.m4 +28 -11
  36. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +13 -3
  37. data/ext/ffi_c/libffi/man/Makefile.in +3 -0
  38. data/ext/ffi_c/libffi/src/aarch64/sysv.S +7 -1
  39. data/ext/ffi_c/libffi/src/arm/sysv.S +1 -1
  40. data/ext/ffi_c/libffi/src/pa/linux.S +4 -0
  41. data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -0
  42. data/ext/ffi_c/libffi/src/riscv/ffi.c +39 -16
  43. data/ext/ffi_c/libffi/src/riscv/internal.h +7 -0
  44. data/ext/ffi_c/libffi/src/riscv/sysv.S +24 -0
  45. data/ext/ffi_c/libffi/src/tramp.c +6 -1
  46. data/ext/ffi_c/libffi/src/types.c +23 -1
  47. data/ext/ffi_c/libffi/src/{wasm32 → wasm}/ffi.c +157 -54
  48. data/ext/ffi_c/libffi/src/{wasm32 → wasm}/ffitarget.h +17 -0
  49. data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -3
  50. data/ext/ffi_c/libffi/src/x86/sysv.S +1 -3
  51. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +1 -3
  52. data/ext/ffi_c/libffi/testsuite/Makefile.am +3 -2
  53. data/ext/ffi_c/libffi/testsuite/Makefile.in +6 -2
  54. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +2 -2
  55. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +4 -4
  56. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +269 -256
  57. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +1 -1
  58. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +3 -0
  59. data/ext/ffi_c/libffi/testsuite/libffi.call/longjmp.c +60 -0
  60. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +1 -1
  61. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +1 -2
  62. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +2 -0
  63. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +2 -0
  64. data/ext/ffi_c/libffi/testsuite/libffi.threads/ffitest.h +1 -0
  65. data/ext/ffi_c/libffi/testsuite/libffi.threads/threads.exp +50 -0
  66. data/ext/ffi_c/libffi/testsuite/libffi.threads/tsan.c +74 -0
  67. data/ext/ffi_c/libffi.mk +5 -0
  68. data/ffi.gemspec +4 -5
  69. data/lib/ffi/autopointer.rb +6 -0
  70. data/lib/ffi/compat.rb +11 -0
  71. data/lib/ffi/function.rb +23 -0
  72. data/lib/ffi/library.rb +19 -3
  73. data/lib/ffi/struct_by_reference.rb +1 -1
  74. data/lib/ffi/version.rb +1 -1
  75. data/samples/hello_ractor.rb +9 -1
  76. data/samples/qsort_ractor.rb +9 -1
  77. data/sig/ffi/auto_pointer.rbs +1 -1
  78. data/sig/ffi/errno.rbs +8 -0
  79. data/sig/ffi/platform.rbs +49 -0
  80. data/sig/ffi/struct.rbs +2 -2
  81. data/sig/ffi/struct_by_reference.rbs +1 -1
  82. data/sig/ffi.rbs +4 -1
  83. data.tar.gz.sig +0 -0
  84. metadata +33 -79
  85. metadata.gz.sig +0 -0
  86. data/ext/ffi_c/libffi/.appveyor/site.exp +0 -16
  87. data/ext/ffi_c/libffi/.appveyor.yml +0 -84
  88. data/lib/ffi/tools/types_generator.rb +0 -137
  89. data/rakelib/ffi_gem_helper.rb +0 -65
  90. /data/ext/ffi_c/libffi/{.appveyor → .ci}/unix-noexec.exp +0 -0
@@ -13,84 +13,44 @@ on:
13
13
 
14
14
  # A workflow run is made up of one or more jobs that can run sequentially or in parallel
15
15
  jobs:
16
+ build-linux:
17
+ name: Linux ${{ matrix.HOST }} ${{ matrix.CONFIGURE_OPTIONS }} \
18
+ ${{ matrix.MEVAL }} ${{ matrix.LIBFFI_TEST_OPTIMIZATION }}
16
19
 
17
- build-warp:
18
- name: ${{ matrix.HOST }} ${{ matrix.CONFIGURE_OPTIONS }} ${{ matrix.MEVAL }} ${{ matrix.LIBFFI_TEST_OPTIMIZATION }}
19
- runs-on: warp-ubuntu-latest-arm64-2x
20
+ runs-on: ${{ matrix.runner }}
20
21
 
21
22
  strategy:
22
23
  fail-fast: false
23
24
  matrix:
24
- include:
25
- - HOST: "aarch64-linux-gnu"
25
+ include:
26
+ # ---------- existing x86-64 variants ----------
27
+ - runner: ubuntu-latest
28
+ HOST: x86_64-pc-linux-gnu
29
+ MEVAL: 'export CC=clang CXX=clang++'
26
30
 
27
- steps:
28
- - uses: actions/checkout@v3
31
+ - runner: ubuntu-latest
32
+ HOST: i386-pc-linux-gnu
33
+ MEVAL: 'export CC="gcc -m32" CXX="g++ -m32"'
29
34
 
30
- - env:
31
- MEVAL: ${{ matrix.MEVAL }}
32
- HOST: ${{ matrix.HOST }}
33
- LDFLAGS: ${{ matrix.LDFLAGS }}
34
- RUNTESTFLAGS: ${{ matrix.RUNTESTFLAGS }}
35
- CONFIGURE_OPTIONS: ${{ matrix.CONFIGURE_OPTIONS }}
36
- run: |
37
- if test x"$MEVAL" != x; then eval ${MEVAL}; fi
38
- ./.ci/install.sh
39
- ./.ci/build.sh
35
+ - runner: ubuntu-latest
36
+ HOST: x86_64-pc-linux-gnu
37
+ CONFIGURE_OPTIONS: "--disable-shared"
40
38
 
41
- build-sim:
42
- name: ${{ matrix.HOST }} ${{ matrix.CONFIGURE_OPTIONS }} ${{ matrix.MEVAL }} ${{ matrix.LIBFFI_TEST_OPTIMIZATION }}
43
- runs-on: ubuntu-latest
39
+ - runner: ubuntu-latest
40
+ HOST: x86_64-pc-linux-gnu
41
+ CONFIGURE_OPTIONS: "--enable-shared"
44
42
 
45
- strategy:
46
- fail-fast: false
47
- matrix:
48
- include:
49
- - HOST: "x86_64-pc-linux-gnu"
50
- MEVAL: "export CC=clang CXX=clang"
51
- - HOST: "i386-pc-linux-gnu"
52
- MEVAL: 'export CC="gcc -m32" CXX="g++ -m32"'
53
- - HOST: "x86_64-pc-linux-gnu"
54
- CONFIGURE_OPTIONS: "--disable-shared"
55
- - HOST: "x86_64-pc-linux-gnu"
56
- CONFIGURE_OPTIONS: "--enable-shared"
57
- - HOST: "m68k-linux-gnu"
58
- MEVAL: 'export CC="m68k-linux-gnu-gcc-8 -mcpu=547x" CXX="m68k-linux-gnu-g++-8 -mcpu=547x"'
59
- CONFIGURE_OPTIONS: '--disable-shared'
60
- QEMU_LD_PREFIX: '/usr/m68k-linux-gnu'
61
- QEMU_CPU: 'cfv4e'
62
- - HOST: "sh4-linux-gnu"
63
- CONFIGURE_OPTIONS: "--disable-shared"
64
- QEMU_LD_PREFIX: "/usr/sh4-linux-gnu"
65
- QEMU_CPU: 'sh7785'
66
- - HOST: "alpha-linux-gnu"
67
- CONFIGURE_OPTIONS: "--disable-shared"
68
- QEMU_LD_PREFIX: "/usr/alpha-linux-gnu"
69
- QEMU_CPU: 'ev4-alpha-cpu'
70
- - HOST: "arm32v7-linux-gnu"
71
- LIBFFI_TEST_OPTIMIZATION: "-O0"
72
- QEMU_CPU: 'any'
73
- - HOST: "arm32v7-linux-gnu"
74
- LIBFFI_TEST_OPTIMIZATION: "-O2"
75
- QEMU_CPU: 'any'
76
- - HOST: "arm32v7-linux-gnu"
77
- LIBFFI_TEST_OPTIMIZATION: "-O2 -fomit-frame-pointer"
78
- QEMU_CPU: 'any'
79
- - HOST: "powerpc-eabisim"
80
- RUNTESTFLAGS: "--target_board powerpc-eabisim"
81
- - HOST: "or1k-elf"
82
- RUNTESTFLAGS: "--target_board or1k-sim"
83
- - HOST: "m32r-elf"
84
- RUNTESTFLAGS: "--target_board m32r-sim"
85
- - HOST: "bfin-elf"
86
- RUNTESTFLAGS: "--target_board bfin-sim"
87
- - MEVAL: "export PATH=/opt/moxielogic/bin:$PATH CC=moxie-elf-gcc CXX=moxie-elf-g++"
88
- HOST: "moxie-elf"
89
- LDFLAGS: "-Tsim.ld"
90
- RUNTESTFLAGS: "--target_board moxie-sim"
43
+ - runner: ubuntu-latest
44
+ HOST: x86_64-pc-linux-gnu
45
+ CONFIGURE_OPTIONS: "--disable-exec-static-tramp"
46
+
47
+ # ---------- new native arm64 build ----------
48
+ - runner: ubuntu-22.04-arm # or ubuntu-24.04-arm
49
+ HOST: aarch64-unknown-linux-gnu
50
+ MEVAL: 'export CC=clang CXX=clang++'
91
51
 
92
52
  steps:
93
- - uses: actions/checkout@v3
53
+ - uses: actions/checkout@v4
94
54
 
95
55
  - env:
96
56
  MEVAL: ${{ matrix.MEVAL }}
@@ -105,297 +65,119 @@ jobs:
105
65
  ./.ci/install.sh
106
66
  ./.ci/build.sh
107
67
 
108
- build-cfarm:
109
- name: ${{ matrix.CFARM_TRIPLE }} ${{ matrix.CFARM_CC }}
110
- runs-on: ubuntu-latest
68
+ build-macos:
69
+ name: MacOS ${{ matrix.platform }} ${{ matrix.compilers }}
70
+ runs-on: ${{ matrix.platform }}
111
71
 
112
72
  strategy:
113
73
  fail-fast: false
114
74
  matrix:
115
- include:
116
- - CFARM_HOST: cfarm185.cfarm.net
117
- CFARM_PORT: 22
118
- CFARM_TRIPLE: aarch64-linux-gnu
119
- CFARM_CC: "gcc"
120
- CFARM_CXX: "g++"
121
- - CFARM_HOST: cfarm185.fsffrance.org
122
- CFARM_PORT: 22
123
- CFARM_TRIPLE: aarch64-lto-linux-gnu
124
- CFARM_CC: "gcc -flto"
125
- CFARM_CXX: "g++ -flto"
126
- - CFARM_HOST: cfarm400.cfarm.net
127
- CFARM_PORT: 25465
128
- CFARM_TRIPLE: loongarch64-linux-gnu
129
- CFARM_CC: "gcc"
130
- CFARM_CXX: "g++"
131
- - CFARM_HOST: cfarm230.cfarm.net
132
- CFARM_PORT: 22
133
- CFARM_TRIPLE: mips-linux-gnu
134
- CFARM_CC: "gcc"
135
- CFARM_CXX: "g++"
136
- - CFARM_HOST: cfarm211.cfarm.net
137
- CFARM_PORT: 22
138
- CFARM_TRIPLE: sparc64-linux-gnu
139
- CFARM_CC: "gcc"
140
- CFARM_CXX: "g++"
141
- - CFARM_HOST: cfarm211.cfarm.net
142
- CFARM_PORT: 22
143
- CFARM_TRIPLE: sparc64-linux-gnu
144
- CFARM_CC: "gcc -m32"
145
- CFARM_CXX: "g++ -m32"
146
- - CFARM_HOST: cfarm91.cfarm.net
147
- CFARM_PORT: 22
148
- CFARM_TRIPLE: riscv64-linux-gnu
149
- CFARM_CC: "gcc"
150
- CFARM_CXX: "g++"
151
- - CFARM_HOST: cfarm103.cfarm.net
152
- CFARM_PORT: 22
153
- CFARM_TRIPLE: aarch64-m1-linux-gnu
154
- CFARM_CC: "gcc"
155
- CFARM_CXX: "g++"
156
- - CFARM_HOST: cfarm112.cfarm.net
157
- CFARM_PORT: 22
158
- CFARM_TRIPLE: powerpc64le-linux-gnu
159
- CFARM_CC: "gcc"
160
- CFARM_CXX: "g++"
161
- - CFARM_HOST: cfarm111.cfarm.net
162
- CFARM_PORT: 22
163
- CFARM_TRIPLE: powerpc-ibm-aix7.1.5.0
164
- CFARM_CC: "gcc"
165
- CFARM_CXX: "g++"
75
+ platform: [macos-13, macos-14, macos-15]
76
+ compilers: [CC=gcc-15 CXX=g++-15, CC=clang CXX=g++-15]
166
77
 
167
78
  steps:
79
+ - run: git config --global core.autocrlf input
80
+ - uses: actions/checkout@v4
81
+ - run: ./.ci/install.sh
82
+ - run: ${{ matrix.compilers }} ./.ci/build.sh
168
83
 
169
- - uses: actions/checkout@v3
170
-
171
- - name: Run autogen
172
- run: |
173
- wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0 -qO - https://ftpmirror.gnu.org/autoconf/autoconf-2.71.tar.gz | tar -xvzf -
174
- mkdir -p ~/i
175
- (cd autoconf-2.71; ./configure --prefix=$HOME/i; make; make install)
176
- rm -rf autoconf-2.71
177
- PATH=$HOME/i/bin:$PATH ./autogen.sh
178
- echo "${{ secrets.CFARM_KEY }}" > /tmp/cfk
179
- chmod go-rw /tmp/cfk
180
-
181
- - name: Generate build dir name
182
- run: |
183
- echo BUILD_DIR=t/$GITHUB_RUN_NUMBER-$RANDOM >> $GITHUB_ENV
184
-
185
- - name: Check for host availability
186
- id: check-host
187
- run: |
188
- set +e
189
- ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -p ${{ matrix.CFARM_PORT }} ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }} "mkdir -p ${{ env.BUILD_DIR }}"
190
- if test $? -ne 0; then
191
- echo "Remote host is unavailable."
192
- echo "HOST_OK=NO" >> $GITHUB_OUTPUT
193
- else
194
- echo "Remote host is available."
195
- echo "HOST_OK=YES" >> $GITHUB_OUTPUT
196
- fi
197
- set -e
198
-
199
- - name: Show host availability
200
- run: |
201
- echo ${{ steps.check-host.outputs.HOST_OK }}
202
-
203
- - name: Copy source to remote host
204
- if: ${{ steps.check-host.outputs.HOST_OK == 'YES' }}
205
- run: |
206
- echo ${{ steps.check-host.outputs.HOST_OK }}
207
- scp -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -P ${{ matrix.CFARM_PORT }} -r * ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }}:${{ env.BUILD_DIR }}
208
-
209
- - name: Run configure and make
210
- if: ${{ steps.check-host.outputs.HOST_OK == 'YES' }}
211
- run: |
212
- ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -p ${{ matrix.CFARM_PORT }} ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }} "${{ matrix.CFARM_CC }} --version"
213
- ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -p ${{ matrix.CFARM_PORT }} ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }} "(cd ${{ env.BUILD_DIR }}; if test -f ~/.profile; then source ~/.profile; fi; CC='${{ matrix.CFARM_CC }}' CXX='${{ matrix.CFARM_CXX }}' ./configure --host=${{ matrix.CFARM_TRIPLE }}) || true; exit 0"
214
- ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -p ${{ matrix.CFARM_PORT }} ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }} "(cd ${{ env.BUILD_DIR }}; if test -f ~/.profile; then source ~/.profile; fi; make;) || true; exit 0"
215
-
216
- - name: Run tests
217
- if: ${{ steps.check-host.outputs.HOST_OK == 'YES' }}
218
- run: |
219
- ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -p ${{ matrix.CFARM_PORT }} ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }} "(cd ${{ env.BUILD_DIR }}; if test -f ~/.profile; then source ~/.profile; fi; GCC_COLORS= make check & CHECKPID=\$!; while kill -0 \$CHECKPID 2>/dev/null; do echo 'Waiting for tests to finish'; sleep 5; done;)"
220
-
221
- - name: Copy results and clean up
222
- if: ${{ steps.check-host.outputs.HOST_OK == 'YES' }}
223
- run: |
224
- scp -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -P ${{ matrix.CFARM_PORT }} ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }}:${{ env.BUILD_DIR }}/*/testsuite/*.log .
225
- ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o ConnectionAttempts=3 -i /tmp/cfk -p ${{ matrix.CFARM_PORT }} ${{ secrets.CFARM_USERNAME }}@${{ matrix.CFARM_HOST }} "rm -rf ${{ env.BUILD_DIR }}"
226
-
227
- - name: Install rlgl and run
228
- if: ${{ steps.check-host.outputs.HOST_OK == 'YES' }}
229
- run: |
230
- wget -qO - https://rl.gl/cli/rlgl-linux-amd64.tgz | \
231
- tar --strip-components=2 -xvzf - ./rlgl/rlgl;
232
- ./rlgl l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
233
- ./rlgl e -l project=libffi -l sha=${GITHUB_SHA:0:7} -l CC='${{ matrix.CFARM_CC }}' -l build-host=${{ matrix.CFARM_TRIPLE }} --policy=https://github.com/libffi/rlgl-policy.git libffi.log
234
- exit $?
235
-
236
- build:
237
- name: Cygwin ${{ matrix.arch }}
84
+ build-non-msvc:
85
+ name: Windows ${{ matrix.width }}-bit ${{ matrix.compiler }}
238
86
  runs-on: windows-latest
239
87
 
240
88
  strategy:
241
89
  fail-fast: false
242
90
  matrix:
243
91
  include:
92
+ # Cygwin 32-bit
93
+ - host: i686-pc-cygwin
94
+ width: 32
95
+ arch: x86
96
+ target: i686-pc-cygwin
97
+ gcc_prefix: /usr/i686-pc-cygwin
98
+ compiler: gcc
244
99
  - host: i686-pc-cygwin
100
+ width: 32
245
101
  arch: x86
246
- - host: x86_64-pc-cygwin
102
+ target: i686-pc-cygwin
103
+ gcc_prefix: /usr/i686-pc-cygwin
104
+ compiler: clang
105
+ # MinGW-w64 64-bit
106
+ - host: x86_64-w64-mingw32
107
+ width: 64
247
108
  arch: x64
109
+ target: x86_64-w64-mingw32
110
+ gcc_prefix: /usr/${{ github.workspace }}/mingw64 # unused but keeps the table homogeneous
111
+ compiler: clang
112
+ - host: x86_64-w64-mingw32
113
+ width: 64
114
+ arch: x64
115
+ target: x86_64-w64-mingw32
116
+ gcc_prefix: /usr/${{ github.workspace }}/mingw64 # unused but keeps the table homogeneous
117
+ compiler: gcc
248
118
 
249
119
  steps:
250
120
  - run: git config --global core.autocrlf input
121
+ - uses: actions/checkout@v4
251
122
 
252
- - uses: actions/checkout@v3
253
-
254
- - name: Set up Cygwin
255
- uses: egor-tensin/setup-cygwin@v3
123
+ # ──────────────────────────────── Cygwin & tool-chains ────────────────────────────────
124
+ - uses: egor-tensin/setup-cygwin@v4
256
125
  with:
257
- platform: ${{ matrix.arch }}
258
- packages: wget gcc-core make dejagnu automake autoconf libtool texinfo dos2unix unzip
259
-
260
- - run: |
261
- set -x
262
- cd $(cygpath $RUNNER_WORKSPACE)/libffi
263
- wget https://rl.gl/cli/rlgl-windows-amd64.zip
264
- unzip rlgl-windows-amd64.zip
265
- autoreconf -f -v -i
266
- ./configure
267
- make -j 4
268
- TERM=none DEJAGNU=$(pwd)/.ci/site.exp BOARDSDIR=$(pwd)/.ci GCC_COLORS= make check || true
269
- ./rlgl/rlgl.exe l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
270
- ./rlgl/rlgl.exe e \
271
- -l project=libffi \
272
- -l sha=${GITHUB_SHA:0:7} \
273
- -l CC=gcc \
274
- -l host=${{ matrix.host }} \
275
- --policy=https://github.com/libffi/rlgl-policy.git $(find . -name libffi.log)
126
+ # gcc / g++ are needed so Clang can reuse their start-files & libraries
127
+ packages: >
128
+ wget make dejagnu automake autoconf libtool texinfo unzip dos2unix
129
+ clang gcc-core gcc-g++
130
+ cygwin32-gcc-core cygwin32-gcc-g++ cygwin32-runtime cygwin32-libgcc1
131
+
132
+ # ──────────────────────────────── Common environment ────────────────────────────────
133
+ - name: Export build env
134
+ shell: bash
135
+ run: |
136
+ echo "GCC_PREFIX=${{ matrix.gcc_prefix }}" >> $GITHUB_ENV
137
+ echo "CC=${{ matrix.compiler }} --target=${{ matrix.target }} -B${{ matrix.gcc_prefix }}/bin \
138
+ -L${{ matrix.gcc_prefix }}/lib -I${{ matrix.gcc_prefix }}/include" >> $GITHUB_ENV
139
+ echo "CXX=${{ matrix.compiler }} --target=${{ matrix.target }} -B${{ matrix.gcc_prefix }}/bin \
140
+ -L${{ matrix.gcc_prefix }}/lib -I${{ matrix.gcc_prefix }}/include" >> $GITHUB_ENV
141
+ # make sure the cross-gcc bin dir is found *before* /usr/bin (64-bit)
142
+ echo "${{ matrix.gcc_prefix }}/bin" >> $GITHUB_PATH
143
+
144
+ # ──────────────────────────────── Pick version from configure.ac ─────────────────────
145
+ - id: ver
146
+ name: Read libffi version
276
147
  shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
148
+ run: |
149
+ cd "$(cygpath $RUNNER_WORKSPACE)/libffi"
150
+ version=$(sed -nE 's/^AC_INIT\(\[libffi\],[[:space:]]*\[([^]]+)\].*/\1/p' configure.ac)
151
+ [[ $version ]] || { echo "Could not parse version"; exit 1; }
152
+ echo "version=$version" >> "$GITHUB_OUTPUT"
277
153
 
278
- build-msys2:
279
-
280
- runs-on: windows-latest
281
-
282
- strategy:
283
- fail-fast: false
284
- matrix:
285
- include:
286
- - MSYSTEM: MINGW32
287
- MSYS2_ARCH: i686
288
- - MSYSTEM: MINGW64
289
- MSYS2_ARCH: x86_64
290
- name: ${{ matrix.MSYSTEM }}
291
-
292
- steps:
293
- - run: git config --global core.autocrlf input
294
- - uses: actions/checkout@v3
295
-
296
- - uses: msys2/setup-msys2@v2
297
- with:
298
- msystem: ${{ matrix.MSYSTEM }}
299
- update: true
300
- install: >-
301
- base-devel
302
- autoconf-wrapper
303
- autoconf
304
- automake
305
- libtool
306
- make
307
- dejagnu
308
- mingw-w64-${{ matrix.MSYS2_ARCH }}-gcc
309
- mingw-w64-${{ matrix.MSYS2_ARCH }}-gcc-libs
310
- unzip
311
-
312
- - run: |
313
- set -x
314
- cd $(cygpath $RUNNER_WORKSPACE)/libffi
154
+ # ──────────────────────────────── Build & test ───────────────────────────────────────
155
+ - name: Build and test
156
+ shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
157
+ run: |
158
+ set -euo pipefail
159
+ cd "$(cygpath $RUNNER_WORKSPACE)/libffi"
315
160
  wget https://rl.gl/cli/rlgl-windows-amd64.zip
316
161
  unzip rlgl-windows-amd64.zip
317
- autoreconf -f -v -i
318
- CC=${{ matrix.MSYS2_ARCH }}-w64-mingw32-gcc CXX=${{ matrix.MSYS2_ARCH }}-w64-mingw32-g++ ./configure
319
- make
320
- TERM=none DEJAGNU=$(pwd)/.ci/site.exp BOARDSDIR=$(pwd)/.ci GCC_COLORS= make check || true
321
- ./rlgl/rlgl.exe l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
322
- ./rlgl/rlgl.exe e \
323
- -l project=libffi \
324
- -l sha=${GITHUB_SHA:0:7} \
325
- -l CC=${{ matrix.MSYS2_ARCH }}-w64-mingw32-gcc \
326
- -l host=x86_64-pc-cygwin \
327
- --policy=https://github.com/libffi/rlgl-policy.git $(find . -name libffi.log)
328
- shell: msys2 {0}
329
-
330
- build-msys2-clang:
331
-
332
- runs-on: windows-latest
333
-
334
- strategy:
335
- fail-fast: false
336
- matrix:
337
- include:
338
- - MSYSTEM: MINGW32
339
- MSYS2_ARCH: i686
340
- - MSYSTEM: MINGW64
341
- MSYS2_ARCH: x86_64
342
- name: ${{ matrix.MSYSTEM }}
343
-
344
- steps:
345
- - run: git config --global core.autocrlf input
346
- - uses: actions/checkout@v3
162
+ autoreconf -fvi
163
+ ./configure \
164
+ --enable-shared \
165
+ --build=${{ matrix.host }} --host=${{ matrix.host }} \
166
+ CPPFLAGS="-DFFI_BUILDING_DLL -DUSE_STATIC_RTL" \
167
+ CFLAGS="-DFFI_BUILDING_DLL -DUSE_STATIC_RTL"
347
168
 
348
- - uses: msys2/setup-msys2@v2
349
- with:
350
- msystem: ${{ matrix.MSYSTEM }}
351
- update: true
352
- install: >-
353
- base-devel
354
- autoconf-wrapper
355
- autoconf
356
- automake
357
- libtool
358
- make
359
- dejagnu
360
- clang
361
- mingw-w64-${{ matrix.MSYS2_ARCH }}-gcc
362
- mingw-w64-${{ matrix.MSYS2_ARCH }}-gcc-libs
363
- unzip
364
-
365
- - run: |
366
- set -x
367
- cd $(cygpath $RUNNER_WORKSPACE)/libffi
368
- wget https://rl.gl/cli/rlgl-windows-amd64.zip
369
- unzip rlgl-windows-amd64.zip
370
- autoreconf -f -v -i
371
- CC=clang CXX=clang ./configure
372
169
  make
373
- TERM=none DEJAGNU=$(pwd)/.ci/site.exp BOARDSDIR=$(pwd)/.ci make check || true
170
+ # sanity-check
171
+ file */.libs/*ffi-*.dll
172
+
173
+ TERM=none DEJAGNU=$(pwd)/.ci/site.exp BOARDSDIR=$(pwd)/.ci GCC_COLORS= make check || true
374
174
  ./rlgl/rlgl.exe l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
375
175
  ./rlgl/rlgl.exe e \
376
176
  -l project=libffi \
377
177
  -l sha=${GITHUB_SHA:0:7} \
378
- -l CC=clang \
379
- -l host=x86_64-pc-cygwin \
178
+ -l CC=${{ matrix.compiler }} \
179
+ -l host=${{ matrix.host }} \
380
180
  --policy=https://github.com/libffi/rlgl-policy.git $(find . -name libffi.log)
381
- shell: msys2 {0}
382
-
383
- build-macos:
384
- runs-on: ${{ matrix.platform }}
385
-
386
- strategy:
387
- fail-fast: false
388
- matrix:
389
- platform: [macos-11, macos-12]
390
- compilers: [CC=gcc CXX=g++, CC=clang CXX=clang]
391
-
392
- name: ${{ matrix.platform }} ${{ matrix.compilers }}
393
-
394
- steps:
395
- - run: git config --global core.autocrlf input
396
- - uses: actions/checkout@v3
397
- - run: ./.ci/install.sh
398
- - run: ${{ matrix.compilers }} ./.ci/build.sh
399
181
 
400
182
  build-msvc:
401
183
  name: Windows ${{ matrix.width }}-bit Visual C++
@@ -409,32 +191,61 @@ jobs:
409
191
  width: 32
410
192
  arch: x86
411
193
  tools: amd64_x86
412
- - host: x86_64-pc-cygwin
194
+ - host: x86_64-w64-mingw32
413
195
  width: 64
414
196
  arch: x64
415
197
  tools: amd64
416
198
 
417
199
  steps:
418
200
  - run: git config --global core.autocrlf input
419
- - uses: actions/checkout@v3
420
- - uses: egor-tensin/setup-cygwin@v3
201
+ - uses: actions/checkout@v4
202
+ - uses: egor-tensin/setup-cygwin@v4
421
203
  with:
422
204
  platform: x64
423
205
  packages: wget make dejagnu automake autoconf libtool texinfo unzip dos2unix
424
- - uses: ilammy/msvc-dev-cmd@v1.12.0
206
+ - uses: ilammy/msvc-dev-cmd@v1.13.0
425
207
  with:
426
208
  arch: ${{ matrix.tools }}
427
209
 
210
+ - name: Read libffi version from configure.ac
211
+ id: ver
212
+ shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
213
+ run: |
214
+ cd $(cygpath $RUNNER_WORKSPACE)/libffi
215
+ # Pull the second bracketed field from the AC_INIT line.
216
+ # Example line: AC_INIT([libffi],[3.5.0],[http://…])
217
+ ls -l
218
+ grep AC_INIT configure.ac
219
+ ver=$(sed -nE 's/^AC_INIT\(\[libffi\],[[:space:]]*\[([^]]+)\].*/\1/p' configure.ac)
220
+ [[ -n "$ver" ]] || { echo "Could not parse version!"; exit 1; }
221
+ echo "version=$ver" >> "$GITHUB_OUTPUT"
222
+
428
223
  - name: Build and test
429
224
  run: |
430
- # export PATH=$PATH:"/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64"
431
225
  cd $(cygpath $RUNNER_WORKSPACE)/libffi
432
226
  wget https://rl.gl/cli/rlgl-windows-amd64.zip
433
227
  unzip rlgl-windows-amd64.zip
434
228
  autoreconf -f -v -i
435
- ./configure --host=${{ matrix.host }} CC="$(pwd)/msvcc.sh -m${{ matrix.width }}" CXX="$(pwd)/msvcc.sh -m${{ matrix.width }}" LD='link' CPP='cl -nologo -EP' CXXCPP='cl -nologo -EP' CPPFLAGS='-DFFI_BUILDING_DLL' AR='$(pwd)/.ci/ar-lib lib' NM='dumpbin -symbols' STRIP=':' $DEBUG_ARG $SHARED_ARG || cat */config.log
229
+ ./configure \
230
+ --enable-shared \
231
+ --build="${{ matrix.host }}" --host="${{ matrix.host }}" \
232
+ --disable-docs \
233
+ CC="$(pwd)/msvcc.sh -m${{ matrix.width }}" \
234
+ CXX="$(pwd)/msvcc.sh -m${{ matrix.width }}" \
235
+ LD="link" \
236
+ LDFLAGS="-no-undefined" \
237
+ CPP="cl -nologo -EP" \
238
+ CXXCPP="cl -nologo -EP" \
239
+ CPPFLAGS="-DFFI_BUILDING_DLL -DUSE_STATIC_RTL" \
240
+ CFLAGS="-DFFI_BUILDING_DLL -DUSE_STATIC_RTL" \
241
+ AR='$(pwd)/.ci/ar-lib lib' \
242
+ NM='dumpbin -symbols' STRIP=':' \
243
+ $DEBUG_ARG || cat */config.log
436
244
  make
245
+ find ./ -type f -name 'libffi*'
246
+ ls -l */.libs
437
247
  cp $(find . -name 'libffi-?.dll') ${{ matrix.host }}/testsuite/
248
+ find ./ -name ffi.h
438
249
  TERM=none DEJAGNU=$(pwd)/.ci/site.exp BOARDSDIR=$(pwd)/.ci GCC_COLORS= make check || true
439
250
  ./rlgl/rlgl.exe l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
440
251
  ./rlgl/rlgl.exe e \
@@ -445,6 +256,72 @@ jobs:
445
256
  --policy=https://github.com/libffi/rlgl-policy.git $(find . -name libffi.log)
446
257
  shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
447
258
 
259
+ - name: Add meta information to DLL
260
+ shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
261
+ run: |
262
+ cd $(cygpath $RUNNER_WORKSPACE)/libffi
263
+
264
+ # Deconstruct the libffi version
265
+ ver=${{ steps.ver.outputs.version }}
266
+ echo "$ver"
267
+
268
+ base=${ver%%-*}
269
+ rc=${ver#*-}
270
+ [[ $rc == "$ver" ]] && rc="" # no rc? rc=""
271
+
272
+ maj=$(cut -d. -f1 <<<"$base")
273
+ min=$(cut -d. -f2 <<<"$base")
274
+ pat=$(cut -d. -f3 <<<"$base")
275
+
276
+ # Decide on build number
277
+ if [[ $rc =~ ^rc([0-9]+)$ ]]; then
278
+ build=${BASH_REMATCH[1]} # rc1 → 1
279
+ else
280
+ build=0
281
+ fi
282
+
283
+ # Use rcedit to edit the DLLs resources
284
+ wget -O rcedit.exe https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-${{ matrix.arch }}.exe
285
+ chmod +x ./rcedit.exe
286
+
287
+ dll_filename=libffi-8.dll
288
+ ./rcedit.exe "${{ matrix.host }}"/.libs/$dll_filename \
289
+ --set-file-version "$maj.$min.$pat.$build" \
290
+ --set-product-version "$maj.$min.$pat.$build" \
291
+ --set-version-string "CompanyName" "https://github.com/libffi/libffi" \
292
+ --set-version-string "FileDescription" "Portable foreign function interface library (${{ matrix.arch }})" \
293
+ --set-version-string "ProductName" "libffi" \
294
+ --set-version-string "FileVersion" "${{ steps.ver.outputs.version }}" \
295
+ --set-version-string "LegalCopyright" "Copyright (c) 1996-2025 Anthony Green and others" \
296
+ --set-version-string "OriginalFilename" "$dll_filename"
297
+
298
+ - name: Create binary distribution
299
+ shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
300
+ run: |
301
+ cd $(cygpath $RUNNER_WORKSPACE)/libffi
302
+ set -euxo pipefail
303
+
304
+ pkgdir="libffi-${{ steps.ver.outputs.version }}-x86-${{ matrix.width }}bit-msvc-binaries"
305
+ mkdir -p "$pkgdir"
306
+
307
+ # Copy libraries, headers, and licence into the *same* directory
308
+ cp "${{ matrix.host }}"/.libs/libffi-8.* "$pkgdir/"
309
+ cp "${{ matrix.host }}"/include/*.h "$pkgdir/"
310
+ cp LICENSE "$pkgdir/"
311
+
312
+ - name: Upload artefact
313
+ uses: actions/upload-artifact@v4
314
+ with:
315
+ name: libffi-${{ steps.ver.outputs.version }}-x86-${{ matrix.width }}bit-msvc-binaries
316
+ path: libffi-${{ steps.ver.outputs.version }}-x86-${{ matrix.width }}bit-msvc-binaries
317
+ if-no-files-found: error
318
+
319
+ - name: Upload to GitHub Release
320
+ if: github.ref_type == 'tag'
321
+ uses: softprops/action-gh-release@v2
322
+ with:
323
+ files: libffi-${{ steps.ver.outputs.version }}-x86-${{ matrix.width }}bit-msvc-binaries.zip
324
+
448
325
  build-android:
449
326
  name: Android ${{ matrix.host }}
450
327
  runs-on: ubuntu-latest
@@ -456,7 +333,7 @@ jobs:
456
333
 
457
334
  steps:
458
335
  - run: git config --global core.autocrlf input
459
- - uses: actions/checkout@v3
336
+ - uses: actions/checkout@v4
460
337
  - run: ./.ci/install.sh
461
338
  - env:
462
339
  HOST: ${{ matrix.HOST }}
@@ -469,6 +346,8 @@ jobs:
469
346
  export TOOLCHAIN="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/linux-x86_64
470
347
  export CC="${TOOLCHAIN}"/bin/${HOST}${ANDROID_API_LEVEL}-clang
471
348
  export CXX="${TOOLCHAIN}"/bin/${HOST}${ANDROID_API_LEVEL}-clang++
349
+ export CC_FOR_TARGET="${TOOLCHAIN}"/bin/${HOST}${ANDROID_API_LEVEL}-clang
350
+ export CXX_FOR_TARGET="${TOOLCHAIN}"/bin/${HOST}${ANDROID_API_LEVEL}-clang++
472
351
  export LD="${TOOLCHAIN}"/bin/ld.lld
473
352
  export AR="${TOOLCHAIN}"/bin/llvm-ar
474
353
  export AS="${CC}"