ソースを参照

acl-dev: add .sln / .vcxproj support (#6981)

* acl-dev: add .sln / .vcxproj support

* drop patch

* try create patch

* try push install path for android as patch

* try push debundle_zlib as patch

* try fix

* try fixup

* Update xmake.lua

* cl

* try cl

* Try to revert back and use iconv patch

* Update xmake.lua

* fixup

* revert

* Update xmake.lua

* Use `vs` by default

* Do not install bundled .DLL s

* Try improve readability

* fixup

* Update xmake.lua

* try to minimize patch

* LF -> CRLF

* Update xmake.lua

* CRLF diff files

* CRLF -> LF

* Update xmake.lua

* fixup

* Update xmake.lua

* fix

* fixin

* push iconv patch

* use `vs`
Saikari 3 ヶ月 前
コミット
e283431a6c

+ 253 - 0
packages/a/acl-dev/patches/v3.6.2/build_install_only_static_or_shared.diff

@@ -0,0 +1,253 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4848fd3..767ad0a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -79,6 +79,8 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ 	set(CMAKE_MACOSX_RPATH build)
+ endif()
+ 
++option (BUILD_SHARED_LIBS "Build shared libraries" ON)
++
+ add_subdirectory(lib_acl acl)
+ add_subdirectory(lib_protocol protocol)
+ add_subdirectory(lib_acl_cpp acl_cpp)
+diff --git a/lib_acl/CMakeLists.txt b/lib_acl/CMakeLists.txt
+index 287d5f3..5d42c9e 100644
+--- a/lib_acl/CMakeLists.txt
++++ b/lib_acl/CMakeLists.txt
+@@ -202,11 +202,13 @@ endif()
+ 
+ link_directories(${acl_output_path})
+ 
+-if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-	install(TARGETS acl_static
+-		EXPORT acl_static-targets
+-		ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-	)
++if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++	if (NOT BUILD_SHARED_LIBS)
++		install(TARGETS acl_static
++			EXPORT acl_static-targets
++			ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++		)
++	endif()
+ endif()
+ 
+ if (CMAKE_INSTALL_INCLUDEDIR MATCHES "")
+@@ -253,12 +255,19 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		set_target_properties(acl_shared PROPERTIES OUTPUT_NAME "acl")
+ 	endif()
+ 
+-	if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		install(TARGETS acl_shared
+-			EXPORT acl_shared-targets
+-			LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-		)
++	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++		if (BUILD_SHARED_LIBS)
++			install(TARGETS acl_shared
++				EXPORT acl_shared-targets
++				LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++			)
++		endif()
+ 	endif()
++	if (BUILD_SHARED_LIBS)
++		set_target_properties(acl_static PROPERTIES EXCLUDE_FROM_ALL 1)
++	else()
++		set_target_properties(acl_shared PROPERTIES EXCLUDE_FROM_ALL 1)
++	endif()
+ endif()
+ 
+ ##############################################################################
+diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt
+index 08c558e..ef3cf7c 100644
+--- a/lib_acl_cpp/CMakeLists.txt
++++ b/lib_acl_cpp/CMakeLists.txt
+@@ -276,11 +276,13 @@ endif()
+ 
+ link_directories(${lib_output_path})
+ 
+-if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-	install(TARGETS acl_cpp_static
+-		EXPORT acl_cpp_static-targets
+-		ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-	)
++if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++	if (NOT BUILD_SHARED_LIBS)
++		install(TARGETS acl_cpp_static
++			EXPORT acl_cpp_static-targets
++			ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++		)
++	endif()
+ endif()
+ 
+ if (CMAKE_INSTALL_INCLUDEDIR MATCHES "")
+@@ -337,12 +339,19 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		target_link_libraries(acl_cpp_shared protocol acl)
+ 	endif()
+ 
+-	if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		install(TARGETS acl_cpp_shared
+-			EXPORT acl_cpp_shared-targets
+-			LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-		)
++	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++		if (BUILD_SHARED_LIBS)
++			install(TARGETS acl_cpp_shared
++				EXPORT acl_cpp_shared-targets
++				LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++			)
++		endif()
+ 	endif()
++	if (BUILD_SHARED_LIBS)
++		set_target_properties(acl_cpp_static PROPERTIES EXCLUDE_FROM_ALL 1)
++	else()
++		set_target_properties(acl_cpp_shared PROPERTIES EXCLUDE_FROM_ALL 1)
++	endif()
+ endif()
+ 
+ ##############################################################################
+diff --git a/lib_fiber/c/CMakeLists.txt b/lib_fiber/c/CMakeLists.txt
+index c784212..fe6fb71 100644
+--- a/lib_fiber/c/CMakeLists.txt
++++ b/lib_fiber/c/CMakeLists.txt
+@@ -163,11 +163,13 @@ endif()
+ 
+ link_directories(${lib_output_path})
+ 
+-if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-	install(TARGETS fiber_static
+-		EXPORT fiber_static-targets
+-		ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-	)
++if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++	if (NOT BUILD_SHARED_LIBS)
++		install(TARGETS fiber_static
++			EXPORT fiber_static-targets
++			ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++		)
++	endif()
+ endif()
+ 
+ if (CMAKE_INSTALL_INCLUDEDIR MATCHES "")
+@@ -215,12 +217,19 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		set(CMAKE_SHARED_LINKER_FLAGS "${sys_ldflags}")
+ 	endif()
+ 
+-	if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		install(TARGETS fiber_shared
+-			EXPORT fiber_shared-targets
+-			LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-		)
++	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++		if (BUILD_SHARED_LIBS)
++			install(TARGETS fiber_shared
++				EXPORT fiber_shared-targets
++				LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++			)
++		endif()
+ 	endif()
++	if (BUILD_SHARED_LIBS)
++		set_target_properties(fiber_static PROPERTIES EXCLUDE_FROM_ALL 1)
++	else()
++		set_target_properties(fiber_shared PROPERTIES EXCLUDE_FROM_ALL 1)
++	endif()
+ endif()
+ 
+ ##############################################################################
+diff --git a/lib_fiber/cpp/CMakeLists.txt b/lib_fiber/cpp/CMakeLists.txt
+index 4d70233..87c99f1 100644
+--- a/lib_fiber/cpp/CMakeLists.txt
++++ b/lib_fiber/cpp/CMakeLists.txt
+@@ -152,11 +152,13 @@ endif()
+ 
+ link_directories(${lib_output_path})
+ 
+-if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-	install(TARGETS fiber_cpp_static
+-		EXPORT fiber_cpp_static-targets
+-		ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-	)
++if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++	if (NOT BUILD_SHARED_LIBS)
++		install(TARGETS fiber_cpp_static
++			EXPORT fiber_cpp_static-targets
++			ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++		)
++	endif()
+ endif()
+ 
+ if (CMAKE_INSTALL_INCLUDEDIR MATCHES "")
+@@ -210,12 +212,19 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber)
+ 	endif()
+ 
+-	if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		install(TARGETS fiber_cpp_shared
+-			EXPORT fiber_cpp_shared-targets
+-			LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-		)
++	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++		if (BUILD_SHARED_LIBS)
++			install(TARGETS fiber_cpp_shared
++				EXPORT fiber_cpp_shared-targets
++				LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++			)
++		endif()
+ 	endif()
++	if (BUILD_SHARED_LIBS)
++		set_target_properties(fiber_cpp_static PROPERTIES EXCLUDE_FROM_ALL 1)
++	else()
++		set_target_properties(fiber_cpp_shared PROPERTIES EXCLUDE_FROM_ALL 1)
++	endif()
+ endif()
+ 
+ ##############################################################################
+diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt
+index b53ee88..b26bdf0 100644
+--- a/lib_protocol/CMakeLists.txt
++++ b/lib_protocol/CMakeLists.txt
+@@ -153,11 +153,13 @@ endif()
+ 
+ link_directories(${lib_output_path})
+ 
+-if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-	install(TARGETS protocol_static
+-		EXPORT protocol_static-targets
+-		ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-	)
++if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++	if (NOT BUILD_SHARED_LIBS)
++		install(TARGETS protocol_static
++			EXPORT protocol_static-targets
++			ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++		)
++	endif()
+ endif()
+ 
+ if (CMAKE_INSTALL_INCLUDEDIR MATCHES "")
+@@ -211,12 +213,19 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		target_link_libraries(protocol_shared acl)
+ 	endif()
+ 
+-	if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		install(TARGETS protocol_shared
+-			EXPORT protocol_shared-targets
+-			LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+-		)
++	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
++		if (BUILD_SHARED_LIBS)
++			install(TARGETS protocol_shared
++				EXPORT protocol_shared-targets
++				LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++			)
++		endif()
+ 	endif()
++	if (BUILD_SHARED_LIBS)
++		set_target_properties(protocol_static PROPERTIES EXCLUDE_FROM_ALL 1)
++	else()
++		set_target_properties(protocol_shared PROPERTIES EXCLUDE_FROM_ALL 1)
++	endif()
+ endif()
+ 
+ ##############################################################################

+ 62 - 0
packages/a/acl-dev/patches/v3.6.2/debundle_iconv.diff

@@ -0,0 +1,62 @@
+diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt
+index 08aabee..b55c6dc 100644
+--- a/lib_acl_cpp/CMakeLists.txt
++++ b/lib_acl_cpp/CMakeLists.txt
+@@ -263,7 +263,7 @@ set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+ 
+ add_library(acl_cpp_static STATIC ${lib_src})
+-target_link_libraries(acl_cpp_static ZLIB::ZLIB)
++target_link_libraries(acl_cpp_static ZLIB::ZLIB Iconv::Iconv)
+ 
+ if (${WIN_OS})
+ 	set_target_properties(acl_cpp_static PROPERTIES
+@@ -309,7 +309,7 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		target_compile_options(acl_cpp_static PRIVATE
+ 				-fvisibility=hidden -fvisibility-inlines-hidden)
+ 	elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		set(sys_ldflags "-shared -liconv -lpthread -ldl")
++		set(sys_ldflags "-shared -lpthread -ldl")
+ 		target_compile_options(acl_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 		set(CMAKE_MACOSX_RPATH 1)
+@@ -337,7 +337,7 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		set(lc_flags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${lib_output_path}")
+ 		set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
+ 		set_target_properties(acl_cpp_shared PROPERTIES OUTPUT_NAME "acl_cpp")
+-		target_link_libraries(acl_cpp_shared protocol acl ZLIB::ZLIB)
++		target_link_libraries(acl_cpp_shared protocol acl ZLIB::ZLIB Iconv::Iconv)
+ 	endif()
+ 
+ 	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
+diff --git a/lib_fiber/cpp/CMakeLists.txt b/lib_fiber/cpp/CMakeLists.txt
+index 6b93850..2aa6804 100644
+--- a/lib_fiber/cpp/CMakeLists.txt
++++ b/lib_fiber/cpp/CMakeLists.txt
+@@ -139,7 +139,7 @@ set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+ 
+ add_library(fiber_cpp_static STATIC ${lib_src})
+-target_link_libraries(fiber_cpp_static ZLIB::ZLIB)
++target_link_libraries(fiber_cpp_static ZLIB::ZLIB Iconv::Iconv)
+ 
+ if (${WIN_OS})
+ 	set_target_properties(fiber_cpp_static PROPERTIES
+@@ -181,7 +181,7 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		target_compile_options(fiber_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 	elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		set(sys_ldflags "-shared -liconv -lpthread -ldl")
++		set(sys_ldflags "-shared -lpthread -ldl")
+ 		target_compile_options(fiber_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 		set(CMAKE_MACOSX_RPATH 1)
+@@ -210,7 +210,7 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		set_target_properties(fiber_cpp_shared PROPERTIES OUTPUT_NAME "fiber_cpp")
+ 		set(lc_ldflags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${lib_output_path}")
+ 		set(CMAKE_SHARED_LINKER_FLAGS "${lc_ldflags} ${sys_ldflags}")
+-		target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber ZLIB::ZLIB)
++		target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber ZLIB::ZLIB Iconv::Iconv)
+ 	endif()
+ 
+ 	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")

+ 137 - 0
packages/a/acl-dev/patches/v3.6.2/debundle_zlib.diff

@@ -0,0 +1,137 @@
+diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt
+index ea3868d..52f868f 100644
+--- a/lib_acl_cpp/CMakeLists.txt
++++ b/lib_acl_cpp/CMakeLists.txt
+@@ -263,6 +263,7 @@ set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+ 
+ add_library(acl_cpp_static STATIC ${lib_src})
++target_link_libraries(acl_cpp_static ZLIB::ZLIB)
+ 
+ if (${WIN_OS})
+ 	set_target_properties(acl_cpp_static PROPERTIES
+@@ -297,23 +298,23 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/acl_cpp/
+ if (ACL_BUILD_SHARED MATCHES "YES")
+ 	if (CMAKE_SYSTEM_NAME MATCHES "Android")
+ 		if (ANDROID_STL MATCHES "gnustl_shared")
+-			set(sys_ldflags "-shared -lz")
++			set(sys_ldflags "-shared")
+ 		else()
+-			set(sys_ldflags "-shared -flto -lz")
++			set(sys_ldflags "-shared -flto")
+ 		endif()
+ 		target_compile_options(acl_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 	elseif (CMAKE_SYSTEM_NAME MATCHES "OHOS")
+-		set(sys_ldflags "-shared -flto -lz")
++		set(sys_ldflags "-shared -flto")
+ 		target_compile_options(acl_cpp_static PRIVATE
+ 				-fvisibility=hidden -fvisibility-inlines-hidden)
+ 	elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		set(sys_ldflags "-shared -lz -liconv -lpthread -ldl")
++		set(sys_ldflags "-shared -liconv -lpthread -ldl")
+ 		target_compile_options(acl_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 		set(CMAKE_MACOSX_RPATH 1)
+ 	elseif (${UNIX_OS})
+-		set(sys_ldflags "-shared -lz -lpthread -ldl")
++		set(sys_ldflags "-shared -lpthread -ldl")
+ 		target_compile_options(acl_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 	endif()
+@@ -336,7 +337,7 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		set(lc_flags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${lib_output_path}")
+ 		set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
+ 		set_target_properties(acl_cpp_shared PROPERTIES OUTPUT_NAME "acl_cpp")
+-		target_link_libraries(acl_cpp_shared protocol acl)
++		target_link_libraries(acl_cpp_shared protocol acl ZLIB::ZLIB)
+ 	endif()
+ 
+ 	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
+diff --git a/lib_fiber/cpp/CMakeLists.txt b/lib_fiber/cpp/CMakeLists.txt
+index 96c1fee..5398551 100644
+--- a/lib_fiber/cpp/CMakeLists.txt
++++ b/lib_fiber/cpp/CMakeLists.txt
+@@ -139,6 +139,7 @@ set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+ 
+ add_library(fiber_cpp_static STATIC ${lib_src})
++target_link_libraries(fiber_cpp_static ZLIB::ZLIB)
+ 
+ if (${WIN_OS})
+ 	set_target_properties(fiber_cpp_static PROPERTIES
+@@ -173,19 +174,19 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/fiber/
+ if (ACL_BUILD_SHARED MATCHES "YES")
+ 	if (CMAKE_SYSTEM_NAME MATCHES "Android")
+ 		if (ANDROID_STL MATCHES "gnustl_shared")
+-			set(sys_ldflags "-shared -lz")
++			set(sys_ldflags "-shared")
+ 		else()
+-			set(sys_ldflags "-shared -O3 -flto -lz")
++			set(sys_ldflags "-shared -O3 -flto")
+ 		endif()
+ 		target_compile_options(fiber_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 	elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+-		set(sys_ldflags "-shared -liconv -lz -lpthread -ldl")
++		set(sys_ldflags "-shared -liconv -lpthread -ldl")
+ 		target_compile_options(fiber_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 		set(CMAKE_MACOSX_RPATH 1)
+ 	elseif (${UNIX_OS})
+-		set(sys_ldflags "-shared -lz -lpthread -ldl")
++		set(sys_ldflags "-shared -lpthread -ldl")
+ 		target_compile_options(fiber_cpp_static PRIVATE
+ 			-fvisibility=hidden -fvisibility-inlines-hidden)
+ 	endif()
+@@ -209,7 +210,7 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		set_target_properties(fiber_cpp_shared PROPERTIES OUTPUT_NAME "fiber_cpp")
+ 		set(lc_ldflags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${lib_output_path}")
+ 		set(CMAKE_SHARED_LINKER_FLAGS "${lc_ldflags} ${sys_ldflags}")
+-		target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber)
++		target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber ZLIB::ZLIB)
+ 	endif()
+ 
+ 	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")
+diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt
+index 545c78b..79bb706 100644
+--- a/lib_protocol/CMakeLists.txt
++++ b/lib_protocol/CMakeLists.txt
+@@ -140,6 +140,7 @@ set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+ 
+ add_library(protocol_static STATIC ${lib_src})
++target_link_libraries(protocol_static ZLIB::ZLIB)
+ 
+ if (${WIN_OS})
+ 	set_target_properties(protocol_static PROPERTIES
+@@ -174,16 +175,16 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
+ if (ACL_BUILD_SHARED MATCHES "YES")
+ 	if (CMAKE_SYSTEM_NAME MATCHES "Android")
+ 		if (ANDROID_STL MATCHES "gnustl_shared")
+-			set(sys_ldflags "-shared -lz")
++			set(sys_ldflags "-shared")
+ 		else()
+-			set(sys_ldflags "-shared -flto -lz")
++			set(sys_ldflags "-shared -flto")
+ 		endif()
+ 		target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
+ 	elseif (CMAKE_SYSTEM_NAME MATCHES "OHOS")
+-		set(sys_ldflags "-shared -flto -lz")
++		set(sys_ldflags "-shared -flto")
+ 		target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
+ 	elseif (${UNIX_OS})
+-		set(sys_ldflags "-shared -lz -lpthread -ldl")
++		set(sys_ldflags "-shared -lpthread -ldl")
+ #		target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
+ 
+ 		if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+@@ -210,7 +211,7 @@ if (ACL_BUILD_SHARED MATCHES "YES")
+ 		set_target_properties(protocol_shared PROPERTIES OUTPUT_NAME "protocol")
+ 		set(lc_flags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${lib_output_path}")
+ 		set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
+-		target_link_libraries(protocol_shared acl)
++		target_link_libraries(protocol_shared acl ZLIB::ZLIB)
+ 	endif()
+ 
+ 	if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin|iOS|Android|FreeBSD")

+ 16 - 0
packages/a/acl-dev/patches/v3.6.2/export_unix.diff

@@ -0,0 +1,16 @@
+diff --git a/lib_acl/include/stdlib/acl_define_unix.h b/lib_acl/include/stdlib/acl_define_unix.h
+index b74c872..52cdef7 100644
+--- a/lib_acl/include/stdlib/acl_define_unix.h
++++ b/lib_acl/include/stdlib/acl_define_unix.h
+@@ -55,7 +55,11 @@
+ #  define acl_assert assert
+ # endif
+ 
++#if defined(__GNUC__)
++# define ACL_API __attribute__((visibility("default")))
++#else
+ # define ACL_API
++#endif
+ 
+ #if 1
+ # define	ACL_ETIMEDOUT		ETIMEDOUT

+ 65 - 0
packages/a/acl-dev/patches/v3.6.2/fix_android_install_path.diff

@@ -0,0 +1,65 @@
+diff --git a/lib_acl/CMakeLists.txt b/lib_acl/CMakeLists.txt
+index 287d5f3..d0c8241 100644
+--- a/lib_acl/CMakeLists.txt
++++ b/lib_acl/CMakeLists.txt
+@@ -177,7 +177,7 @@ if (ACL_CLIENT_ONLY MATCHES "YES")
+ endif()
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES "Android")
+-	set(acl_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})
++	set(acl_output_path ${PROJECT_BINARY_DIR}/../lib)
+ elseif (CMAKE_SYSTEM_NAME MATCHES "OHOS")
+ 	set(acl_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../harmony/lib/${OHOS_ARCH})
+ else()
+diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt
+index 08c558e..afb3936 100644
+--- a/lib_acl_cpp/CMakeLists.txt
++++ b/lib_acl_cpp/CMakeLists.txt
+@@ -252,7 +252,7 @@ elseif (${WIN_OS})
+ endif()
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES "Android")
+-	set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})
++	set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)
+ elseif (CMAKE_SYSTEM_NAME MATCHES "OHOS")
+ 	set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../harmony/lib/${OHOS_ARCH})
+ else()
+diff --git a/lib_fiber/c/CMakeLists.txt b/lib_fiber/c/CMakeLists.txt
+index c784212..d8931f6 100644
+--- a/lib_fiber/c/CMakeLists.txt
++++ b/lib_fiber/c/CMakeLists.txt
+@@ -141,7 +141,7 @@ list(APPEND lib_src ${src}/fiber/boost/make_gas.S
+ 	${src}/fiber/boost/jump_gas.S)
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES "Android")
+-	set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../../android/lib/${ANDROID_ABI})
++	set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)
+ else()
+ 	set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)
+ endif()
+diff --git a/lib_fiber/cpp/CMakeLists.txt b/lib_fiber/cpp/CMakeLists.txt
+index 4d70233..1c41f9b 100644
+--- a/lib_fiber/cpp/CMakeLists.txt
++++ b/lib_fiber/cpp/CMakeLists.txt
+@@ -130,7 +130,7 @@ foreach(iter ${sources})
+ endforeach()
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES "Android")
+-	set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../../android/lib/${ANDROID_ABI})
++	set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)
+ else()
+ 	set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)
+ endif()
+diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt
+index b53ee88..e047e59 100644
+--- a/lib_protocol/CMakeLists.txt
++++ b/lib_protocol/CMakeLists.txt
+@@ -129,7 +129,7 @@ elseif (${WIN_OS})
+ endif()
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES "Android")
+-	set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})
++	set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)
+ elseif (CMAKE_SYSTEM_NAME MATCHES "OHOS")
+ 	set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../harmony/lib/${OHOS_ARCH})
+ else()

+ 98 - 114
packages/a/acl-dev/xmake.lua

@@ -8,6 +8,15 @@ package("acl-dev")
 
     add_versions("v3.6.2", "888fd9b8fb19db4f8e7760a12a28f37f24ba0a2952bb0409b8380413a4b6506b")
 
+    add_patches("v3.6.2", "patches/v3.6.2/build_install_only_static_or_shared.diff", "179136ceec3a54c9d8a60d92bc67d691271ffcf8214160224b0b9339a26cd0a1")
+    add_patches("v3.6.2", "patches/v3.6.2/export_unix.diff", "13376d9374de1b97ec25f709205f927a7157852075c2583e57615b617c45c62d")
+    add_patches("v3.6.2", "patches/v3.6.2/fix_android_install_path.diff", "19917bd1852af4ddecc27ef402ecf9806b89ec78d91e62c806ba00fc05f41e94")
+    add_patches("v3.6.2", "patches/v3.6.2/debundle_zlib.diff", "43043fb8fe84ef8f37a6a637e0447a849d38155e6d6ca20a9512c38023077a04")
+
+    if is_plat("windows") then
+        add_configs("vs", {description = "Use Visual Studio buildsystem (.sln/.vcxproj)", default = true, type = "boolean"})
+    end
+
     add_includedirs("include", "include/acl-lib")
 
     add_deps("cmake")
@@ -30,6 +39,9 @@ package("acl-dev")
     end
 
     on_load(function (package)
+        if package:is_plat("iphoneos", "macosx", "bsd") then
+            package:add("patches", "v3.6.2", "patches/v3.6.2/debundle_iconv.diff", "03db2a366167c865eb6bcd73d06b5d87fa3ed87307aa86bc2d0de9528dd29e10")
+        end
         if package:is_plat("android") then
             package:add("defines", "ANDROID")
         elseif package:is_plat("macosx") then
@@ -41,124 +53,96 @@ package("acl-dev")
         end
     end)
 
-    on_install("android", "iphoneos", "macosx", "linux", "cross", "bsd", "windows", function (package)
-        io.replace("lib_acl/include/stdlib/acl_define_unix.h", "# define ACL_API",
-            "#if defined(__GNUC__)\n#define ACL_API __attribute__((visibility(\"default\")))\n#else\n# define ACL_API\n#endif", {plain = true})
-        io.replace("lib_acl/include/stdlib/acl_define_win32.h", "# define ACL_API",
-            "#if defined(__GNUC__)\n#define ACL_API __attribute__((visibility(\"default\")))\n#else\n# define ACL_API\n#endif", {plain = true})
-        -- Build & install only shared or only static library
-        if package:config("shared") then
-            io.replace("lib_fiber/c/CMakeLists.txt", "add_library(fiber_static STATIC ${lib_src})",
-                "add_library(fiber_static STATIC ${lib_src})\nset_target_properties(fiber_static PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_fiber/c/CMakeLists.txt", "install%(TARGETS fiber_static.-%)", "")
-
-            io.replace("lib_fiber/cpp/CMakeLists.txt", "add_library(fiber_cpp_static STATIC ${lib_src})",
-                "add_library(fiber_cpp_static STATIC ${lib_src})\nset_target_properties(fiber_cpp_static PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_fiber/cpp/CMakeLists.txt", "install%(TARGETS fiber_cpp_static.-%)", "")
-
-            io.replace("lib_protocol/CMakeLists.txt", "add_library(protocol_static STATIC ${lib_src})",
-                "add_library(protocol_static STATIC ${lib_src})\nset_target_properties(protocol_static PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_protocol/CMakeLists.txt", "install%(TARGETS protocol_static.-%)", "")
-
-            io.replace("lib_acl_cpp/CMakeLists.txt", "add_library(acl_cpp_static STATIC ${lib_src})",
-                "add_library(acl_cpp_static STATIC ${lib_src})\nset_target_properties(acl_cpp_static PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_acl_cpp/CMakeLists.txt", "install%(TARGETS acl_cpp_static.-%)", "")
-
-            io.replace("lib_acl/CMakeLists.txt", "add_library(acl_static STATIC ${acl_src})",
-                "add_library(acl_static STATIC ${acl_src})\nset_target_properties(acl_static PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_acl/CMakeLists.txt", "install%(TARGETS acl_static.-%)", "")
+    on_install("windows", "android", "iphoneos", "macosx", "linux", "cross", "bsd", function (package)
+        if package:is_plat("windows") and package:config("vs") then
+            import("package.tools.msbuild")
+            for _, vcxproj in ipairs(os.files("**.vcxproj")) do
+                -- Switch vs_runtime MD / MDd -> MT / MTd
+                if package:has_runtime("MT", "MTd") then
+                    io.replace(vcxproj, "MultiThreadedDebugDLL", "MultiThreadedDebug", {plain = true})
+                    io.replace(vcxproj, "MultiThreadedDLL", "MultiThreaded", {plain = true})
+                    io.replace(vcxproj, "<IgnoreSpecificDefaultLibraries>libcmt;libc</IgnoreSpecificDefaultLibraries>", "", {plain = true})
+                    io.replace(vcxproj, "<IgnoreSpecificDefaultLibraries>libcmtd;libcmt;libc</IgnoreSpecificDefaultLibraries>", "", {plain = true})
+                end
+                -- Disble LTCG
+                io.replace(vcxproj, "<WholeProgramOptimization>true</WholeProgramOptimization>", "<WholeProgramOptimization>false</WholeProgramOptimization>", {plain = true})
+            end
+            os.cp("lib_fiber/c/include/fiber/**", package:installdir("include/acl-lib/fiber"))
+            os.cp("lib_protocol/include/**", package:installdir("include/acl-lib/protocol"))
+            os.cp("lib_acl_cpp/include/acl_cpp/**", package:installdir("include/acl-lib/acl_cpp"))
+            os.cp("lib_acl/include/**", package:installdir("include/acl-lib/acl"))
+            os.cp("lib_fiber/cpp/include/fiber/**", package:installdir("include/acl-lib/fiber_cpp"))
+            local arch = package:is_arch("x64") and "x64" or "Win32"
+            if package:is_arch("arm64") then
+                arch = "ARM64"
+            end
+            local mode = package:is_debug() and "Debug" or "Release"
+            if package:config("shared") then
+                mode = package:is_debug() and "DebugDll" or "ReleaseDll"
+            end
+            local configs = {"acl_cpp_vc2022.sln", "/t:lib_acl;libfiber;lib_protocol;lib_acl_cpp;libfiber_cpp"}
+            table.insert(configs, "/p:Configuration=" .. mode)
+            table.insert(configs, "/p:Platform=" .. arch)
+            msbuild.build(package, configs)
+            os.cp("**.lib", package:installdir("lib"))
+            if package:config("shared") then
+                for _, dll in ipairs(os.files("**.dll")) do
+                    if not dll:lower():find("71.dll") and not dll:lower():find("vld.dll") then
+                        os.cp(dll, package:installdir("bin"))
+                    end
+                end
+            end
         else
-            io.replace("lib_fiber/c/CMakeLists.txt", "add_library(fiber_shared SHARED ${lib_src})",
-                "add_library(fiber_shared SHARED ${lib_src})\nset_target_properties(fiber_shared PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_fiber/c/CMakeLists.txt", "install%(TARGETS fiber_shared.-%)", "")
-
-            io.replace("lib_fiber/cpp/CMakeLists.txt", "add_library(fiber_cpp_shared SHARED ${lib_src})",
-                "add_library(fiber_cpp_shared SHARED ${lib_src})\nset_target_properties(fiber_cpp_shared PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_fiber/cpp/CMakeLists.txt", "install%(TARGETS fiber_cpp_shared.-%)", "")
-
-            io.replace("lib_protocol/CMakeLists.txt", "add_library(protocol_shared SHARED ${lib_src})",
-                "add_library(protocol_shared SHARED ${lib_src})\nset_target_properties(protocol_shared PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_protocol/CMakeLists.txt", "install%(TARGETS protocol_shared.-%)", "")
-
-            io.replace("lib_acl_cpp/CMakeLists.txt", "add_library(acl_cpp_shared SHARED ${lib_src})",
-                "add_library(acl_cpp_shared SHARED ${lib_src})\nset_target_properties(acl_cpp_shared PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_acl_cpp/CMakeLists.txt", "install%(TARGETS acl_cpp_shared.-%)", "")
-
-            io.replace("lib_acl/CMakeLists.txt", "add_library(acl_shared SHARED ${acl_src})",
-                "add_library(acl_shared SHARED ${acl_src})\nset_target_properties(acl_shared PROPERTIES EXCLUDE_FROM_ALL 1)", {plain = true})
-            io.replace("lib_acl/CMakeLists.txt", "install%(TARGETS acl_shared.-%)", "")
-        end
-
-        -- Fix install path for android
-        io.replace("lib_protocol/CMakeLists.txt", [[set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})]], [[set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)]], {plain = true})
-        io.replace("lib_fiber/cpp/CMakeLists.txt", [[set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../../android/lib/${ANDROID_ABI})]], [[set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)]], {plain = true})
-        io.replace("lib_fiber/c/CMakeLists.txt", [[set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../../android/lib/${ANDROID_ABI})]], [[set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)]], {plain = true})
-        io.replace("lib_acl_cpp/CMakeLists.txt", [[set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})]], [[set(lib_output_path ${PROJECT_BINARY_DIR}/../lib)]], {plain = true})
-        io.replace("lib_acl/CMakeLists.txt", [[set(acl_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})]], [[set(acl_output_path ${PROJECT_BINARY_DIR}/../lib)]], {plain = true})
-
-        -- Fix windows .pch file
-        io.replace("lib_acl_cpp/CMakeLists.txt", [["-Ycacl_stdafx.hpp"]], [[]], {plain = true})
-        io.replace("lib_acl_cpp/CMakeLists.txt", [[add_library(acl_cpp_static STATIC ${lib_src})]],
-            "add_library(acl_cpp_static STATIC ${lib_src})\ntarget_precompile_headers(acl_cpp_static PRIVATE src/acl_stdafx.hpp)", {plain = true})
-        io.replace("lib_acl_cpp/CMakeLists.txt", [[add_library(acl_cpp_shared SHARED ${lib_src})]],
-            "add_library(acl_cpp_shared SHARED ${lib_src})\ntarget_precompile_headers(acl_cpp_shared PRIVATE src/acl_stdafx.hpp)", {plain = true})
-
-        -- Do not build .gas on windows
-        if package:is_plat("windows") then
-            io.replace("lib_fiber/c/CMakeLists.txt", [[list(APPEND lib_src ${src}/fiber/boost/make_gas.S]], [[]], {plain = true})
-            io.replace("lib_fiber/c/CMakeLists.txt", [[${src}/fiber/boost/jump_gas.S)]], [[]], {plain = true})
-        end
-        -- Disable -Wstrict-prototypes -Werror -Qunused-arguments
-        for _, file in ipairs(os.files("**.txt")) do
-            io.replace(file, [["-Wstrict-prototypes"]], "", {plain = true})
-            io.replace(file, [["-Werror"]], "", {plain = true})
-            io.replace(file, [[-Qunused-arguments]], [[]], {plain = true})
-            -- Enforce install of lib for Android/FreeBSD
-            io.replace(file, [[(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")]],
-                [[(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Android" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")]], {plain = true})
-            -- Do not enforce LTO
-            io.replace(file, [[add_definitions("-flto")]], [[]], {plain = true})
-            io.replace(file, [[-flto]], [[]], {plain = true})
-        end
-        if not package:is_plat("windows") then
-            -- Use zlib instead z
-            io.replace("CMakeLists.txt", "project(acl)", "project(acl)\nfind_package(ZLIB)", {plain = true})
-            io.replace("lib_acl_cpp/CMakeLists.txt", "-lz", "", {plain = true})
-            io.replace("lib_acl_cpp/CMakeLists.txt", "target_link_libraries(acl_cpp_shared protocol acl)", "target_link_libraries(acl_cpp_shared protocol acl ZLIB::ZLIB)", {plain = true})
-            io.replace("lib_acl_cpp/CMakeLists.txt", "add_library(acl_cpp_static STATIC ${lib_src})", "add_library(acl_cpp_static STATIC ${lib_src})\ntarget_link_libraries(acl_cpp_static ZLIB::ZLIB)", {plain = true})
-            io.replace("lib_protocol/CMakeLists.txt", "-lz", "", {plain = true})
-            io.replace("lib_protocol/CMakeLists.txt", "target_link_libraries(protocol_shared acl)", "target_link_libraries(protocol_shared acl ZLIB::ZLIB)", {plain = true})
-            io.replace("lib_protocol/CMakeLists.txt", "add_library(protocol_static STATIC ${lib_src})", "add_library(protocol_static STATIC ${lib_src})\ntarget_link_libraries(protocol_static ZLIB::ZLIB)", {plain = true})
-            io.replace("lib_fiber/cpp/CMakeLists.txt", "-lz", "", {plain = true})
-            io.replace("lib_fiber/cpp/CMakeLists.txt", "target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber)", "target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber ZLIB::ZLIB)", {plain = true})
-            io.replace("lib_fiber/cpp/CMakeLists.txt", "add_library(fiber_cpp_static STATIC ${lib_src})", "add_library(fiber_cpp_static STATIC ${lib_src})\ntarget_link_libraries(fiber_cpp_static ZLIB::ZLIB)", {plain = true})
-            -- FreeBSD enforce fallback to system iconv
-            io.replace("lib_acl_cpp/CMakeLists.txt", [[elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")]], 
-                [[elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
-                add_definitions("-DUSE_SYS_ICONV")]], {plain = true})
+            -- Fix windows .pch file
+            io.replace("lib_acl_cpp/CMakeLists.txt", [["-Ycacl_stdafx.hpp"]], [[]], {plain = true})
+            io.replace("lib_acl_cpp/CMakeLists.txt", [[add_library(acl_cpp_static STATIC ${lib_src})]],
+                "add_library(acl_cpp_static STATIC ${lib_src})\ntarget_precompile_headers(acl_cpp_static PRIVATE src/acl_stdafx.hpp)", {plain = true})
+            io.replace("lib_acl_cpp/CMakeLists.txt", [[add_library(acl_cpp_shared SHARED ${lib_src})]],
+                "add_library(acl_cpp_shared SHARED ${lib_src})\ntarget_precompile_headers(acl_cpp_shared PRIVATE src/acl_stdafx.hpp)", {plain = true})
+            if package:is_plat("windows") then
+                -- Do not build .gas on windows
+                io.replace("lib_fiber/c/CMakeLists.txt", [[list(APPEND lib_src ${src}/fiber/boost/make_gas.S]], [[]], {plain = true})
+                io.replace("lib_fiber/c/CMakeLists.txt", [[${src}/fiber/boost/jump_gas.S)]], [[]], {plain = true})
+            else
+                io.replace("CMakeLists.txt", "project(acl)", "project(acl)\nfind_package(ZLIB)", {plain = true})
+            end
             if package:is_plat("iphoneos", "macosx", "bsd") then
-                -- Use libiconv instead iconv
-                io.replace("lib_acl_cpp/CMakeLists.txt", "-liconv", "", {plain = true})
-                io.replace("lib_fiber/cpp/CMakeLists.txt", "-liconv", "", {plain = true})
+                if package:is_plat("bsd") then
+                    -- FreeBSD enforce fallback to system iconv
+                    io.replace("lib_acl_cpp/CMakeLists.txt", [[elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")]], 
+                        [[elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+                        add_definitions("-DUSE_SYS_ICONV")]], {plain = true})
+                end
                 io.replace("CMakeLists.txt", "project(acl)", "project(acl)\nfind_package(Iconv)", {plain = true})
-                io.replace("lib_acl_cpp/CMakeLists.txt", "ZLIB::ZLIB", "ZLIB::ZLIB Iconv::Iconv", {plain = true})
-                io.replace("lib_fiber/cpp/CMakeLists.txt", "ZLIB::ZLIB", "ZLIB::ZLIB Iconv::Iconv", {plain = true})
             end
-        end
-        local configs = {"-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"}
-        if package:is_plat("iphoneos") then
-            table.insert(configs, "-DCMAKE_SYSTEM_NAME=Darwin")
-        end
-        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"))
-        table.insert(configs, "-DACL_BUILD_SHARED=" .. (package:config("shared") and "YES" or "NO"))
-        import("package.tools.cmake").install(package, configs)
-        if package:is_plat("windows") then
-            if package:config("shared") then
-                os.vcp(path.join(package:buildir(), "*/shared/**.lib"), package:installdir("lib"))
-                os.vcp(path.join(package:buildir(), "*/shared/**.dll"), package:installdir("bin"))
-            else
-                os.vcp(path.join(package:buildir(), "*/static/**.lib"), package:installdir("lib"))
+            for _, file in ipairs(os.files("**.txt")) do
+                -- Disable -Wstrict-prototypes -Werror -Qunused-arguments
+                io.replace(file, [["-Wstrict-prototypes"]], "", {plain = true})
+                io.replace(file, [["-Werror"]], "", {plain = true})
+                io.replace(file, [[-Qunused-arguments]], [[]], {plain = true})
+                -- Do not enforce LTO
+                io.replace(file, [[add_definitions("-flto")]], [[]], {plain = true})
+                io.replace(file, [[-flto]], [[]], {plain = true})
+                if package:is_plat("windows") then
+                    -- Cleanup ZLIB after patch for Windows OS
+                    io.replace(file, [[ZLIB::ZLIB]], [[]], {plain = true})
+                end
+            end
+            local configs = {"-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"}
+            if package:is_plat("iphoneos") then
+                table.insert(configs, "-DCMAKE_SYSTEM_NAME=Darwin")
+            end
+            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"))
+            table.insert(configs, "-DACL_BUILD_SHARED=" .. (package:config("shared") and "YES" or "NO"))
+            import("package.tools.cmake").install(package, configs)
+            if package:is_plat("windows") then
+                if package:config("shared") then
+                    os.vcp(path.join(package:buildir(), "*/shared/**.lib"), package:installdir("lib"))
+                    os.vcp(path.join(package:buildir(), "*/shared/**.dll"), package:installdir("bin"))
+                else
+                    os.vcp(path.join(package:buildir(), "*/static/**.lib"), package:installdir("lib"))
+                end
             end
         end
     end)