Bläddra i källkod

add libharu and libressl (#718)

* add libharu

* add libressl

* fix license
Hoildkv 3 år sedan
förälder
incheckning
72f2c089e5
2 ändrade filer med 64 tillägg och 0 borttagningar
  1. 29 0
      packages/l/libharu/xmake.lua
  2. 35 0
      packages/l/libressl/xmake.lua

+ 29 - 0
packages/l/libharu/xmake.lua

@@ -0,0 +1,29 @@
+package("libharu")
+
+    set_homepage("http://libharu.org/")
+    set_description("libHaru is a free, cross platform, open source library for generating PDF files.")
+    set_license("zlib")
+
+    add_urls("https://github.com/libharu/libharu/archive/refs/tags/RELEASE_$(version).tar.gz", {version = function (version) return version:gsub("%.", "_") end})
+    add_urls("https://github.com/libharu/libharu.git")
+    add_versions("2.3.0", "8f9e68cc5d5f7d53d1bc61a1ed876add1faf4f91070dbc360d8b259f46d9a4d2")
+
+    add_deps("cmake", "zlib", "libpng")
+    on_load("windows", function (package)
+        if package:config("shared") then
+            package:add("defines", "HPDF_DLL")
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        io.replace("src/CMakeLists.txt", "install(FILES ${addlib}", "#", {plain = true})
+        local configs = {"-DLIBHPDF_EXAMPLES=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DLIBHPDF_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DLIBHPDF_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("HPDF_GetVersion", {includes = "hpdf.h"}))
+    end)

+ 35 - 0
packages/l/libressl/xmake.lua

@@ -0,0 +1,35 @@
+package("libressl")
+
+    set_homepage("https://www.libressl.org/")
+    set_description("LibreSSL is a version of the TLS/crypto stack forked from OpenSSL in 2014, with goals of modernizing the codebase, improving security, and applying best practice development processes.")
+
+    add_urls("https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-$(version).tar.gz")
+    add_versions("3.4.2", "cb82ca7d547336917352fbd23db2fc483c6c44d35157b32780214ec74197b3ce")
+
+    if is_plat("windows") then
+        add_deps("cmake")
+        add_syslinks("ws2_32", "bcrypt")
+    elseif is_plat("linux") then
+        add_syslinks("pthread")
+    end
+    on_install("windows", function (package)
+        local configs = {"-DLIBRESSL_TESTS=OFF", "-DLIBRESSL_APPS=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, "-DUSE_STATIC_MSVC_RUNTIMES=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_install("macosx", "linux", "bsd", function (package)
+        local configs = {}
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+        table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
+        if package:config("pic") then
+            table.insert(configs, "--with-pic")
+        end
+        import("package.tools.autoconf").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("SSL_new", {includes = "openssl/ssl.h"}))
+    end)