add pdfhummus (#1709)

* add pdfhummus

* disable libtiff by default

* fix hash

* format code

* remove cmake
pull/1712/head^2
ruki 2 years ago committed by GitHub
parent 809ddbbdf1
commit d4d68adea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      packages/l/libaesgm/xmake.lua
  2. 83
      packages/p/pdfhummus/xmake.lua

@ -4,18 +4,16 @@ package("libaesgm")
add_urls("https://github.com/xmake-mirror/libaesgm/archive/refs/tags/$(version).tar.gz", add_urls("https://github.com/xmake-mirror/libaesgm/archive/refs/tags/$(version).tar.gz",
"https://github.com/xmake-mirror/libaesgm.git") "https://github.com/xmake-mirror/libaesgm.git")
add_versions("2009.04.29", "9912e886c79d65e89612a5bf7d5198ee261eb6d6438af13ca5d0b668f93ba0ce") add_versions("2013.1.1", "102353a486126c91ccab791c3e718d056d8fbb1be488da81b26561bc7ef4f363")
on_install("linux", function (package) on_install("linux", "macosx", function (package)
local configs = {} local configs = {}
io.writefile("xmake.lua", [[ io.writefile("xmake.lua", [[
add_rules("mode.release", "mode.debug") add_rules("mode.release", "mode.debug")
target("libaesgm") target("aesgm")
set_kind("$(kind)") set_kind("$(kind)")
add_files("aescrypt.c", "aestab.c", "aeskey.c") add_files("*.c")
add_files("hmac.c", "sha2.c", "sha1.c", "pwd2key.c", "fileenc.c")
add_headerfiles("*.h") add_headerfiles("*.h")
add_defines("USE_SHA256")
]]) ]])
if package:config("shared") then if package:config("shared") then
configs.kind = "shared" configs.kind = "shared"

@ -0,0 +1,83 @@
package("pdfhummus")
set_homepage("https://www.pdfhummus.com/")
set_description("High performance library for creating, modiyfing and parsing PDF files in C++ ")
set_license("Apache-2.0")
add_urls("https://github.com/galkahana/PDF-Writer/archive/refs/tags/$(version).tar.gz",
"https://github.com/galkahana/PDF-Writer.git")
add_versions("4.1", "0c0d860b0ecea928709b9e4642fa21926eb2f626f702699c3b87afa2965b4857")
add_deps("freetype", "zlib", "libaesgm")
add_configs("libtiff", {description = "Supporting tiff image", default = false, type = "boolean"})
add_configs("libjpeg", {description = "Support DCT encoding", default = false, type = "boolean"})
add_configs("libpng", {description = "Support png image", default = false, type = "boolean"})
on_load(function (package)
for _, dep in ipairs({"libtiff", "libpng", "libjpeg"}) do
if package:config(dep) then
package:add("deps", dep)
end
end
end)
on_install("linux", "macosx", function (package)
io.writefile("xmake.lua", [[
option("libtiff", {description = "Enable libtiff", default = false})
option("libpng", {description = "Enable libpng", default = false})
option("libjpeg", {description = "Enable libjpeg", default = false})
add_rules("mode.debug", "mode.release")
if has_config("libtiff") then
add_requires("libtiff")
end
if has_config("libpng") then
add_requires("libpng")
end
if has_config("libjpeg") then
add_requires("libjpeg")
end
add_requires("freetype", "zlib", "libaesgm")
target("pdfwriter")
set_kind("$(kind)")
add_files("PDFWriter/*.cpp")
add_headerfiles("(PDFWriter/*.h)")
add_packages("freetype")
add_packages("libtiff", "libpng", "libjpeg")
add_packages("libaesgm", "zlib")
if has_package("libtiff") then
add_defines("_INCLUDE_TIFF_HEADER")
add_cxflags("-Wno-deprecated-declarations")
else
add_defines("PDFHUMMUS_NO_TIFF=1")
end
if not has_package("libpng") then
add_defines("PDFHUMMUS_NO_PNG=1")
end
if not has_package("libjpeg") then
add_defines("PDFHUMMUS_NO_DCT=1")
end
]])
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
for _, dep in ipairs({"libtiff", "libpng", "libjpeg"}) do
if package:config(dep) then
configs[dep] = true
end
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include "PDFWriter/PDFWriter.h"
#include <iostream>
using namespace std;
using namespace PDFHummus;
void test() {
PDFWriter pdfWriter;
pdfWriter.Reset();
}
]]}, {configs = {languages = "c++11"}}))
end)
Loading…
Cancel
Save