Browse Source

add zziplib and fix some packages (#379)

* add zziplib

* fix expat

* fix blosc

* improve assimp

* update pcre

* fix zziplib

* improve blosc
Hoildkv 4 năm trước cách đây
mục cha
commit
2d970e8ecb

+ 11 - 14
packages/a/assimp/xmake.lua

@@ -3,16 +3,14 @@ package("assimp")
     set_homepage("https://assimp.org")
     set_description("Portable Open-Source library to import various well-known 3D model formats in a uniform manner")
 
-    if is_plat("windows", "linux", "macosx") then
-        set_urls("https://github.com/assimp/assimp/archive/v$(version).zip")
-        add_versions("5.0.1", "d10542c95e3e05dece4d97bb273eba2dfeeedb37a78fb3417fd4d5e94d879192")
-    end
+    set_urls("https://github.com/assimp/assimp/archive/v$(version).zip")
+    add_versions("5.0.1", "d10542c95e3e05dece4d97bb273eba2dfeeedb37a78fb3417fd4d5e94d879192")
 
     add_configs("shared",                {description = "Generation of shared libs ( dll for windows, so for Linux ). Set this to OFF to get a static lib", default = true, type = "boolean"})
     add_configs("build_framework",       {description = "Build package as Mac OS X Framework bundle (macosx only)", default = false, type = "boolean"})
     add_configs("double_precision",      {description = "All data will be stored as double values", default = false, type = "boolean"})
     add_configs("opt_build_packages",    {description = "Set to true to generate CPack configuration files and packaging targets", default = false, type = "boolean"})
-    add_configs("android_jniiosysystem", {description = "Android JNI IOSystem support is active", default = false, type = "boolean"})
+    add_configs("android_jniiosystem",   {description = "Android JNI IOSystem support is active", default = false, type = "boolean"})
     add_configs("no_export",             {description = "Disable Assimp's export functionality", default = false, type = "boolean"})
     add_configs("build_zlib",            {description = "Build your own zlib", default = false, type = "boolean"})
     add_configs("build_assimp_tools",    {description = "If the supplementary tools for Assimp are built in addition to the library", default = false, type = "boolean"})
@@ -36,12 +34,15 @@ package("assimp")
                 package:add("deps", "freeglut")
             end
         end
-        if is_plat("linux") or package:config("build_zlib") then
+        if not package:config("build_zlib") then
             package:add("deps", "zlib")
         end
         if package:config("system_irrxml") then
             package:add("deps", "irrxml")
         end
+        if is_plat("linux") and package:config("shared") then
+            package:add("ldflags", "-Wl,--as-needed," .. package:installdir("lib", "libassimp.so"))
+        end
     end)
 
     on_install("windows", "linux", "macosx", function (package)
@@ -73,29 +74,25 @@ package("assimp")
         if is_plat("windows") then
             table.insert(config, "-DASSIMP_INSTALL_PDB=" .. ((package:debug() or package:config("install_pdb")) and "ON" or "OFF"))
         end
-
         if is_plat("linux", "macosx") then
             table.insert(config, "-DINJECT_DEBUG_POSTFIX=" .. ((package:debug() or package:config("inject_debug_postfix")) and "ON" or "OFF"))
         end
-
         if is_plat("android") then
             add_config_arg("android_jniiosysystem", "ASSIMP_ANDROID_JNIIOSYSTEM")
         end
-
         if is_plat("windows", "linux", "macosx") then
             add_config_arg("build_assimp_tools", "ASSIMP_BUILD_ASSIMP_TOOLS")
         end
-
         if is_plat("android", "iphoneos") then
             table.insert(config, "-DASSIMP_BUILD_ASSIMP_TOOLS=OFF")
         end
+        if package:config("pic") ~= false then
+            table.insert(config, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
+        end
 
         import("package.tools.cmake").install(package, config)
-        if is_plat("linux") and not package:config("system_irrxml") then
-            package:add("links", "assimp", "IrrXML")
-        end
     end)
 
     on_test(function (package)
-        assert(package:has_cfuncs("aiImportFile", {includes = "assimp/cimport.h"}))
+        assert(package:has_cxxtypes("Assimp::Importer", {configs = {languages = "c++11"}, includes = "assimp/Importer.hpp"}))
     end)

+ 4 - 3
packages/b/blosc/xmake.lua

@@ -9,7 +9,7 @@ package("blosc")
     add_versions("1.20.1", "42c4d3fcce52af9f8e2078f8f57681bfc711706a3330cb72b9b39e05ae18a413")
     add_versions("1.5.0", "208ba4db0e5116421ed2fbbdf2adfa3e1d133d29a6324a0f47cf2d71f3810c92")
 
-    add_deps("cmake")
+    add_deps("cmake", "zlib")
     if is_plat("linux") then
         add_syslinks("pthread")
     end
@@ -29,10 +29,11 @@ package("blosc")
             -- special concern for legacy versions which keep producing the shared library
             local version = package:version()
             if package:config("shared") then
-                os.cp("build/install/bin", package:installdir())
-                package:addenv("PATH", "bin")
+                os.trycp("build/install/bin", package:installdir())
+                os.trymv(path.join(package:installdir("lib"), "blosc.dll"), package:installdir("bin"))
             elseif version:le("1.10") then
                 os.rm(path.join(package:installdir("lib"), "blosc.lib"))
+                os.rm(path.join(package:installdir("lib"), "blosc.dll"))
             end
         end
     end)

+ 3 - 0
packages/e/expat/xmake.lua

@@ -23,6 +23,9 @@ package("expat")
         local configs = {"-DEXPAT_BUILD_EXAMPLES=OFF", "-DEXPAT_BUILD_TESTS=OFF", "-DEXPAT_BUILD_DOCS=OFF"}
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DEXPAT_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DEXPAT_MSVC_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
         import("package.tools.cmake").install(package, configs)
     end)
 

+ 4 - 1
packages/p/pcre/xmake.lua

@@ -5,7 +5,7 @@ package("pcre")
 
     set_urls("https://ftp.pcre.org/pub/pcre/pcre-$(version).zip",
              "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$(version).zip")
-
+    add_versions("8.44", "3464cc5effda458e1c80882e53fc710195bf0d6d923c0866cafea43c7f321d25")
     add_versions("8.40", "99e19194fa57d37c38e897d07ecb3366b18e8c395b36c6d555706a7f1df0a5d4")
     add_versions("8.41", "0e914a3a5eb3387cad6ffac591c44b24bc384c4e828643643ebac991b57dfcc5")
 
@@ -57,6 +57,9 @@ package("pcre")
         if package:debug() then
             table.insert(configs, "--enable-debug")
         end
+        if package:is_plat("linux") and package:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
+        end
         import("package.tools.autoconf").install(package, configs)
     end)
 

+ 28 - 0
packages/z/zziplib/xmake.lua

@@ -0,0 +1,28 @@
+package("zziplib")
+
+    set_homepage("http://zziplib.sourceforge.net/")
+    set_description("The zziplib library is intentionally lightweight, it offers the ability to easily extract data from files archived in a single zip file.")
+    set_license("GPL-2.0")
+
+    add_urls("https://github.com/gdraheim/zziplib/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/gdraheim/zziplib.git")
+    add_versions("v0.13.72", "93ef44bf1f1ea24fc66080426a469df82fa631d13ca3b2e4abaeab89538518dc")
+
+    add_deps("cmake", "zlib")
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-DZZIPTEST=OFF", "-DZZIPDOCS=OFF", "-DZZIPWRAP=OFF", "-DZZIPSDL=OFF", "-DZZIPMMAPPED=OFF", "-DZZIPFSEEKO=OFF", "-DZZIPBINS=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"))
+        table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DMSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
+        if package:config("pic") ~= false then
+            table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("zzip_open", {includes = "zzip/zzip.h"}))
+    end)