uvwasi: fix old version build, add new version (#3434)

* uvwasi: fix old version build, add new version

* fix

* add patch

* add alias for glibtoolize

* fix
pull/3445/head
star9029 9 months ago committed by GitHub
parent 142a581326
commit f813e79e73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      packages/l/libtool/xmake.lua
  2. 71
      packages/u/uvwasi/patches/0.0.20/cmake.patch
  3. 47
      packages/u/uvwasi/xmake.lua

@ -1,5 +1,4 @@
package("libtool")
set_kind("binary")
set_homepage("https://www.gnu.org/software/libtool/")
set_description("A generic library support script.")
@ -7,18 +6,25 @@ package("libtool")
add_urls("http://ftpmirror.gnu.org/libtool/libtool-$(version).tar.gz",
"https://mirrors.ustc.edu.cn/gnu/libtool/libtool-$(version).tar.gz",
"git://git.savannah.gnu.org/libtool.git")
add_versions("2.4.6", "e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3")
add_versions("2.4.5", "509cb49c7de14ce7eaf88993cf09fd4071882699dfd874c2e95b31ab107d6987")
add_versions("2.4.7", "04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8")
if is_host("linux") then
add_extsources("apt::libtool", "pacman::libtool")
elseif is_host("macosx") then
add_extsources("brew::libtool")
end
add_deps("autoconf")
on_install("@macosx", "@linux", "@bsd", function (package)
import("package.tools.autoconf").install(package, {"--disable-dependency-tracking", "--enable-ltdl-install"})
if package:is_plat("macosx") then
local bindir = package:installdir("bin")
os.ln(path.join(bindir, "libtoolize"), path.join(bindir, "glibtoolize"))
end
end)
on_test(function (package)

@ -0,0 +1,71 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a5e87c..48db2d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ cmake_dependent_option(UVWASI_BUILD_TESTS
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out)
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
- list(APPEND uvwasi_cflags -fvisibility=hidden --std=gnu89)
+ list(APPEND uvwasi_cflags --std=gnu89)
list(APPEND uvwasi_cflags -Wall -Wsign-compare -Wextra -Wstrict-prototypes)
list(APPEND uvwasi_cflags -Wno-unused-parameter)
endif()
@@ -33,27 +33,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND uvwasi_defines _GNU_SOURCE _POSIX_C_SOURCE=200112)
endif()
-find_package(LIBUV QUIET)
-if(LIBUV_FOUND)
- include_directories(${LIBUV_INCLUDE_DIR})
-else()
- include(FetchContent)
- ## https://libuv.org
- FetchContent_Declare(
- libuv
- GIT_REPOSITORY https://github.com/libuv/libuv.git
- GIT_TAG ${LIBUV_VERSION})
-
- FetchContent_GetProperties(libuv)
- if(NOT libuv_POPULATED)
- FetchContent_Populate(libuv)
- include_directories("${libuv_SOURCE_DIR}/include")
- add_subdirectory(${libuv_SOURCE_DIR} ${libuv_BINARY_DIR} EXCLUDE_FROM_ALL)
- endif()
- set(LIBUV_INCLUDE_DIR ${libuv_SOURCE_DIR}/include)
- set(LIBUV_LIBRARIES uv_a)
-endif()
-
## uvwasi source code files.
set(uvwasi_sources
src/clocks.c
@@ -97,19 +76,7 @@ if(ASAN AND CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
endif()
-## Static library target.
-add_library(uvwasi_a STATIC ${uvwasi_sources})
-target_compile_definitions(uvwasi_a PRIVATE ${uvwasi_defines})
-target_compile_options(uvwasi_a PRIVATE ${uvwasi_cflags})
-target_include_directories(uvwasi_a PRIVATE ${PROJECT_SOURCE_DIR}/include)
-if(CODE_COVERAGE)
- target_link_libraries(uvwasi_a PUBLIC ${LIBUV_LIBRARIES} coverage_config)
-else()
- target_link_libraries(uvwasi_a PRIVATE ${LIBUV_LIBRARIES})
-endif()
-
-## Shared library target.
-add_library(uvwasi SHARED ${uvwasi_sources})
+add_library(uvwasi ${uvwasi_sources})
target_compile_definitions(uvwasi PRIVATE ${uvwasi_defines})
target_compile_options(uvwasi PRIVATE ${uvwasi_cflags})
target_include_directories(uvwasi PRIVATE ${PROJECT_SOURCE_DIR}/include)
@@ -159,7 +126,7 @@ if(INSTALL_UVWASI AND NOT CODE_COVERAGE)
configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in ${config_file} INSTALL_DESTINATION ${cmake_files_install_dir})
install(
- TARGETS uvwasi_a uvwasi
+ TARGETS uvwasi
EXPORT ${target_export_name}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}

@ -5,29 +5,42 @@ package("uvwasi")
add_urls("https://github.com/nodejs/uvwasi/archive/refs/tags/$(version).tar.gz",
"https://github.com/nodejs/uvwasi.git")
add_versions("v0.0.20", "417e5ecc40005d9c8008bad2b6a2034e109b2a0a1ebd108b231cb419cfbb980a")
add_versions("v0.0.12", "f310a628d2657b9ed523a19284f58e4a407466f2e17efb2250d2e58524d02c53")
add_patches("v0.0.20", path.join(os.scriptdir(), "patches", "0.0.20", "cmake.patch"), "50d70983aa498e63e02e66d71e3c7c78ed1c802c61063d1b085e8a12abbcf751")
add_includedirs("include", "include/uvwasi")
add_deps("cmake", "libuv")
on_install("linux", "windows", "macosx", function (package)
local configs = {"-DWITH_SYSTEM_LIBUV=ON", "-DUVWASI_BUILD_TESTS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:config("shared") then
io.replace("CMakeLists.txt", "-fvisibility=hidden", "", {plain = true})
end
if package:is_plat("windows") then
table.insert(configs, "-DLIBUV_LIBRARIES=uv_a.lib")
end
import("package.tools.cmake").install(package, configs, {buildir = "build", packagedeps = "libuv"})
os.cp("include", package:installdir())
if package:config("shared") then
os.trycp("build/*.dll", package:installdir("bin"))
os.trycp("build/*.so", package:installdir("lib"))
os.trycp("build/*.dylib", package:installdir("lib"))
local configs = {"-DUVWASI_BUILD_TESTS=OFF"}
if package:version():ge("0.0.20") then
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:is_plat("windows") and package:config("shared") then
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
end
import("package.tools.cmake").install(package, configs, {packagedeps = "libuv"})
else
os.trycp("build/*.a", package:installdir("lib"))
os.trycp("build/*.lib", package:installdir("lib"))
table.insert(configs, "-DWITH_SYSTEM_LIBUV=ON")
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:config("shared") then
io.replace("CMakeLists.txt", "-fvisibility=hidden", "", {plain = true})
end
import("package.tools.cmake").install(package, configs, {packagedeps = "libuv"})
os.cp("include", package:installdir())
if package:config("shared") then
os.trycp("build/*.dll", package:installdir("bin"))
os.trycp("build/*.so", package:installdir("lib"))
os.trycp("build/*.dylib", package:installdir("lib"))
else
os.trycp("build/*.a", package:installdir("lib"))
os.trycp("build/*.lib", package:installdir("lib"))
end
end
end)

Loading…
Cancel
Save