瀏覽代碼

add rhash (#1024)

* add rhash

* update libwebp
Hoildkv 3 年之前
父節點
當前提交
763ee3664c
共有 2 個文件被更改,包括 53 次插入18 次删除
  1. 16 18
      packages/l/libwebp/xmake.lua
  2. 37 0
      packages/r/rhash/xmake.lua

+ 16 - 18
packages/l/libwebp/xmake.lua

@@ -4,18 +4,22 @@ package("libwebp")
     set_description("Library to encode and decode images in WebP format.")
     set_license("BSD-3-Clause")
 
-    add_urls("https://github.com/webmproject/libwebp/archive/v$(version).tar.gz")
-    add_versions("1.1.0", "424faab60a14cb92c2a062733b6977b4cc1e875a6398887c5911b3a1a6c56c51")
+    add_urls("https://github.com/webmproject/libwebp/archive/$(version).tar.gz",
+             "https://github.com/webmproject/libwebp.git")
+    add_versions("v1.1.0", "424faab60a14cb92c2a062733b6977b4cc1e875a6398887c5911b3a1a6c56c51")
+    add_versions("v1.2.2", "51e9297aadb7d9eb99129fe0050f53a11fcce38a0848fb2b0389e385ad93695e")
 
-    add_configs("anim_utils",     { description = "Build animation utilities.", default = false, type = "boolean"})
-    add_configs("cwebp",          { description = "Build the cwebp command line tool.", default = false, type = "boolean"})
-    add_configs("dwebp",          { description = "Build the dwebp command line tool.", default = false, type = "boolean"})
-    add_configs("gif2webp",       { description = "Build the gif2webp conversion tool.", default = false, type = "boolean"})
-    add_configs("img2webp",       { description = "Build the img2webp animation tool.", default = false, type = "boolean"})
-    add_configs("vwebp",          { description = "Build the vwebp viewer tool.", default = false, type = "boolean"})
-    add_configs("webpinfo",       { description = "Build the webpinfo command line tool.", default = false, type = "boolean"})
-    add_configs("webpmux",        { description = "Build the webpmux command line tool.", default = false, type = "boolean"})
-    add_configs("extras",         { description = "Build extras.", default = false, type = "boolean"})
+    add_configs("anim_utils", {description = "Build animation utilities.", default = false, type = "boolean"})
+    add_configs("cwebp",      {description = "Build the cwebp command line tool.", default = false, type = "boolean"})
+    add_configs("dwebp",      {description = "Build the dwebp command line tool.", default = false, type = "boolean"})
+    add_configs("gif2webp",   {description = "Build the gif2webp conversion tool.", default = false, type = "boolean"})
+    add_configs("img2webp",   {description = "Build the img2webp animation tool.", default = false, type = "boolean"})
+    add_configs("vwebp",      {description = "Build the vwebp viewer tool.", default = false, type = "boolean"})
+    add_configs("webpinfo",   {description = "Build the webpinfo command line tool.", default = false, type = "boolean"})
+    add_configs("libwebpmux", {description = "Build the libwebpmux library.", default = false, type = "boolean"})
+    add_configs("webpmux",    {description = "Build the webpmux command line tool.", default = false, type = "boolean"})
+    add_configs("sharpyuv",   {description = "Build the sharpyuv library.", default = false, type = "boolean"})
+    add_configs("extras",     {description = "Build extras.", default = false, type = "boolean"})
 
     add_deps("cmake")
     add_deps("libpng", "libjpeg", "libtiff", "giflib")
@@ -40,13 +44,7 @@ package("libwebp")
         end
         local cxflags
         if package:is_plat("windows") and package:config("shared") then
-            if xmake.version():ge("2.5.1") then
-                cxflags = "-DWEBP_EXTERN=__declspec(dllexport)"
-            else
-                cxflags = package:configs().cxflags or {}
-                table.insert(cxflags, "-DWEBP_EXTERN=__declspec(dllexport)")
-                package:configs().cxflags = cxflags
-            end
+            cxflags = "-DWEBP_EXTERN=__declspec(dllexport)"
         end
         import("package.tools.cmake").install(package, configs, {cxflags = cxflags})
     end)

+ 37 - 0
packages/r/rhash/xmake.lua

@@ -0,0 +1,37 @@
+package("rhash")
+
+    set_homepage("http://rhash.sourceforge.net/")
+    set_description("RHash (Recursive Hasher) is a console utility for computing and verifying hash sums of files.")
+    
+    add_urls("https://sourceforge.net/projects/rhash/files/rhash/$(version)/rhash-$(version)-src.tar.gz")
+    add_urls("https://github.com/rhash/RHash/archive/refs/tags/v$(version).tar.gz")
+    add_versions("1.4.2", "600d00f5f91ef04194d50903d3c79412099328c42f28ff43a0bdb777b00bec62")
+
+    add_configs("gettext", {description = "Enable gettext (localization) support.", default = false, type = "boolean"})
+    add_configs("openssl", {description = "Enable OpenSSL (optimized hash functions) support.", default = false, type = "boolean"})
+
+    on_load(function (package)
+        if package:config("gettext") and package:is_plat("macosx") then
+            package:add("deps", "libintl")
+        end
+        if package:config("openssl") then
+            package:add("deps", "openssl")
+        end
+    end)
+
+    on_install("linux", function (package)
+        io.replace("Makefile", "install-lib-shared: $(LIBRHASH_SHARED)", "install-lib-shared: $(LIBRHASH_SHARED) install-lib-headers install-lib-so-link", {plain = true})
+        local configs = {"--disable-openssl-runtime"}
+        table.insert(configs, (package:config("shared") and "--enable" or "--disable") .. "-lib-shared")
+        table.insert(configs, (package:config("shared") and "--disable" or "--enable") .. "-lib-static")
+        table.insert(configs, (package:config("shared") and "--disable" or "--enable") .. "-static")
+        table.insert(configs, (package:config("gettext") and "--enable" or "--disable") .. "-gettext")
+        table.insert(configs, (package:config("openssl") and "--enable" or "--disable") .. "-openssl")
+        import("package.tools.autoconf").install(package, configs)
+        package:addenv("PATH", "bin")
+    end)
+
+    on_test(function (package)
+        os.vrun("rhash --version")
+        assert(package:has_cfuncs("rhash_library_init", {includes = "rhash.h"}))
+    end)