add libusb for mingw32/64 (#555)

* add yasm for win

* format

* add mingw support

* add p7zip in msys2 env

* move dll to bin and format
pull/560/head
hh-wu 3 years ago committed by GitHub
parent fd534a2562
commit 3402c2a981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/mingw_msys2.yml
  2. 28
      packages/l/libusb/xmake.lua

@ -25,7 +25,7 @@ jobs:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
install: git base-devel unzip mingw-w64-${{ matrix.arch }}-toolchain
install: git base-devel unzip p7zip mingw-w64-${{ matrix.arch }}-toolchain
update: true
- name: Prepare

@ -3,11 +3,18 @@ package("libusb")
set_homepage("https://libusb.info")
set_description("A cross-platform library to access USB devices.")
add_urls("https://github.com/libusb/libusb/releases/download/$(version).tar.bz2", {version = function (version)
return version .. "/libusb-" .. (version:gsub("v", ""))
end})
add_urls("https://github.com/libusb/libusb.git")
add_versions("v1.0.24", "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a")
if is_plat("mingw") then
add_urls("https://github.com/libusb/libusb/releases/download/$(version).7z", {version = function (version)
return version .. "/libusb-" .. (version:gsub("v", ""))
end})
add_versions("v1.0.24", "620CEC4DBE4868202949294157DA5ADB75C9FBB4F04266146FC833EEF85F90FB")
else
add_urls("https://github.com/libusb/libusb/releases/download/$(version).tar.bz2", {version = function (version)
return version .. "/libusb-" .. (version:gsub("v", ""))
end})
add_urls("https://github.com/libusb/libusb.git")
add_versions("v1.0.24", "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a")
end
if is_plat("macosx", "linux") then
add_deps("autoconf", "automake", "libtool", "pkg-config")
@ -53,6 +60,17 @@ package("libusb")
end
end)
on_install("mingw", function (package)
os.cp("include/libusb-1.0/*.h",package:installdir("include/libusb-1.0"))
if package:is_arch("x64", "x86_64") then
os.cp("MinGW64/dll/*", package:installdir("bin"))
os.cp("MinGW64/static/*", package:installdir("lib"))
elseif package:is_arch("x86", "i386") then
os.cp("MinGW32/dll/*", package:installdir("bin"))
os.cp("MinGW32/static/*", package:installdir("lib"))
end
end)
on_install("macosx", "linux", function (package)
local configs = {}
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))

Loading…
Cancel
Save