update libffi (#2026)

* update libffi

* see detailed log

* Update xmake.lua

---------

Co-authored-by: ruki <waruqi@gmail.com>
pull/2033/head
Hoildkv 2 years ago committed by GitHub
parent ca5770dda6
commit 05150b3fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/mingw_msys2.yml
  2. 4
      .github/workflows/windows.yml
  3. 24
      packages/l/libffi/port/xmake.lua
  4. 2
      packages/l/libffi/xmake.lua

@ -47,8 +47,8 @@ jobs:
shell: msys2 {0} shell: msys2 {0}
run: | run: |
if [ "${{ matrix.arch }}" == "x86_64" ]; then if [ "${{ matrix.arch }}" == "x86_64" ]; then
xmake l ./scripts/test.lua -D -p mingw -a x86_64 -k ${{ matrix.kind }} xmake l ./scripts/test.lua -vD -p mingw -a x86_64 -k ${{ matrix.kind }}
else else
xmake l ./scripts/test.lua -D -p mingw -a i386 -k ${{ matrix.kind }} xmake l ./scripts/test.lua -vD -p mingw -a i386 -k ${{ matrix.kind }}
fi fi

@ -36,8 +36,8 @@ jobs:
- name: Tests - name: Tests
run: | run: |
if ("${{ matrix.os }}" -eq "windows-2019") { if ("${{ matrix.os }}" -eq "windows-2019") {
xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} --vs_runtime=${{ matrix.vs_runtime }} --vs_sdkver=10.0.19041.0 --linkjobs=2 xmake l ./scripts/test.lua -vD -a ${{ matrix.arch }} -k ${{ matrix.kind }} --vs_runtime=${{ matrix.vs_runtime }} --vs_sdkver=10.0.19041.0 --linkjobs=2
} else { } else {
xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} --vs_runtime=${{ matrix.vs_runtime }} --linkjobs=2 xmake l ./scripts/test.lua -vD -a ${{ matrix.arch }} -k ${{ matrix.kind }} --vs_runtime=${{ matrix.vs_runtime }} --linkjobs=2
} }

@ -45,6 +45,10 @@ else
targetarch = "ARM" targetarch = "ARM"
elseif is_arch("arm64") then elseif is_arch("arm64") then
targetarch = "ARM64" targetarch = "ARM64"
elseif is_arch("mips64") then
targetarch = "MIPS64"
elseif is_arch("riscv") then
targetarch = "RISCV"
end end
end end
set_configvar("TARGET", targetarch) set_configvar("TARGET", targetarch)
@ -88,7 +92,6 @@ end
rule("asm.preprocess") rule("asm.preprocess")
set_extensions(".S") set_extensions(".S")
on_buildcmd_file(function (target, batchcmds, sourcefile, opt) on_buildcmd_file(function (target, batchcmds, sourcefile, opt)
import("core.tool.toolchain")
import("lib.detect.find_tool") import("lib.detect.find_tool")
local rootdir = path.join(target:autogendir(), "rules", "asm.preprocess") local rootdir = path.join(target:autogendir(), "rules", "asm.preprocess")
@ -97,14 +100,15 @@ rule("asm.preprocess")
local sourcefile_cx = target:autogenfile(sourcefile, {rootdir = rootdir, filename = filename}) local sourcefile_cx = target:autogenfile(sourcefile, {rootdir = rootdir, filename = filename})
-- preprocessing -- preprocessing
local envs = toolchain.load("msvc"):runenvs() local envs = target:toolchain("msvc"):runenvs()
local cl = find_tool("cl", {envs = envs}) local cl = find_tool("cl", {envs = envs})
batchcmds:execv(cl.program, {"/nologo", "/EP", "/Iinclude", "/I" .. path.directory(sourcefile_or), sourcefile_or}, {stdout = sourcefile_cx}) batchcmds:execv(cl.program, {"/nologo", "/EP", "/Iinclude",
"/I" .. path.directory(sourcefile_or), sourcefile_or}, {envs = envs, stdout = sourcefile_cx})
local objectfile = target:objectfile(sourcefile_cx) local objectfile = target:objectfile(sourcefile_cx)
table.insert(target:objectfiles(), objectfile) table.insert(target:objectfiles(), objectfile)
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.%s %s", get_config("mode"), sourcefile_cx) batchcmds:show_progress(opt.progress, "${color.build.object}compiling.$(mode) %s", sourcefile_cx)
batchcmds:compile(sourcefile_cx, objectfile) batchcmds:compile(sourcefile_cx, objectfile)
batchcmds:add_depfiles(sourcefile) batchcmds:add_depfiles(sourcefile)
@ -147,13 +151,21 @@ target("ffi")
add_includedirs("src/x86") add_includedirs("src/x86")
add_headerfiles("src/x86/ffitarget.h") add_headerfiles("src/x86/ffitarget.h")
elseif is_arch("arm") then elseif is_arch("arm") then
add_files("src/arm/ffi.c", "src/arm/sysv.S") add_files("src/arm/ffi.c")
add_files(is_plat("windows") and "src/arm/sysv_msvc_arm32.S" or "src/arm/sysv.S")
add_includedirs("src/arm") add_includedirs("src/arm")
add_headerfiles("src/arm/ffitarget.h") add_headerfiles("src/arm/ffitarget.h")
elseif is_arch("arm64") then elseif is_arch("arm64") then
add_files("src/aarch64/ffi.c", "src/aarch64/sysv.S") add_files("src/aarch64/ffi.c")
add_files(is_plat("windows") and "src/aarch64/win64_armasm.S" or "src/aarch64/sysv.S")
add_includedirs("src/aarch64") add_includedirs("src/aarch64")
add_headerfiles("src/aarch64/ffitarget.h") add_headerfiles("src/aarch64/ffitarget.h")
elseif is_arch("mips64") then
add_files("src/mips/ffi.c", "src/mips/n32.S")
add_headerfiles("src/mips/ffitarget.h")
elseif is_arch("riscv") then
add_files("src/riscv/ffi.c", "src/riscv/sysv.S")
add_headerfiles("src/riscv/ffitarget.h")
end end
before_build(function (target) before_build(function (target)
io.replace("include/ffi.h", "!defined FFI_BUILDING", target:is_static() and "0" or "1", {plain = true}) io.replace("include/ffi.h", "!defined FFI_BUILDING", target:is_static() and "0" or "1", {plain = true})

@ -2,12 +2,14 @@ package("libffi")
set_homepage("https://sourceware.org/libffi/") set_homepage("https://sourceware.org/libffi/")
set_description("Portable Foreign Function Interface library.") set_description("Portable Foreign Function Interface library.")
set_license("MIT")
set_urls("https://github.com/libffi/libffi/releases/download/v$(version)/libffi-$(version).tar.gz", set_urls("https://github.com/libffi/libffi/releases/download/v$(version)/libffi-$(version).tar.gz",
"https://github.com/libffi/libffi.git") "https://github.com/libffi/libffi.git")
add_versions("3.2.1", "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37") add_versions("3.2.1", "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37")
add_versions("3.3", "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056") add_versions("3.3", "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056")
add_versions("3.4.2", "540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620") add_versions("3.4.2", "540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620")
add_versions("3.4.4", "d66c56ad259a82cf2a9dfc408b32bf5da52371500b84745f7fb8b645712df676")
if is_plat("linux") then if is_plat("linux") then
add_extsources("apt::libffi-dev", "pacman::libffi") add_extsources("apt::libffi-dev", "pacman::libffi")

Loading…
Cancel
Save