From e945d5b4a343ccddd1065941e84c9fc78226caf5 Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Sat, 20 Mar 2021 21:28:14 +0800 Subject: [PATCH] add ptex and lodepng (#332) * update cgal * add ptex * fix1 * add lodepng * update openblas * update c-ares --- .github/workflows/fedora.yml | 1 + packages/c/c-ares/xmake.lua | 13 +++---- packages/c/cgal/xmake.lua | 1 + packages/l/lodepng/xmake.lua | 28 ++++++++++++++ packages/n/ninja/xmake.lua | 11 ++++-- packages/o/openblas/xmake.lua | 2 + packages/p/ptex/xmake.lua | 69 +++++++++++++++++++++++++++++++++++ 7 files changed, 114 insertions(+), 11 deletions(-) create mode 100644 packages/l/lodepng/xmake.lua create mode 100644 packages/p/ptex/xmake.lua diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index dccdcd228..c57a319c2 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -20,6 +20,7 @@ jobs: - name: Installation run: | uname -a + dnf -y install gfortran dnf -y install mesa-libGL-devel mesa-libGLU-devel dnf -y install @development-tools @rpm-development-tools dnf -y install copr-cli make gcc-c++ diff --git a/packages/c/c-ares/xmake.lua b/packages/c/c-ares/xmake.lua index cff415703..91e73867f 100644 --- a/packages/c/c-ares/xmake.lua +++ b/packages/c/c-ares/xmake.lua @@ -4,8 +4,8 @@ package("c-ares") set_description("A C library for asynchronous DNS requests") add_urls("https://c-ares.haxx.se/download/c-ares-$(version).tar.gz") - add_versions("1.16.1", "d08312d0ecc3bd48eee0a4cc0d2137c9f194e0a28de2028928c0f6cae85f86ce") + add_versions("1.17.1", "d73dd0f6de824afd407ce10750ea081af47eba52b8a6cb307d220131ad93fc40") on_install("windows", function (package) local configs = {"-f", "Makefile.msvc"} @@ -14,12 +14,11 @@ package("c-ares") if package:config("vs_runtime"):startswith("MT") then table.insert(configs, "RTLIBCFG=static") end - import("package.tools.nmake").install(package, configs) - os.cp("include", package:installdir()) - os.cp("lib", package:installdir()) - if package:config("shared") then - package:addenv("PATH", "lib") - else + import("package.tools.nmake").build(package, configs) + os.cp(path.join("include", "*.h"), package:installdir("include")) + os.cp(path.join("msvc", "cares", cfg, "*.lib"), package:installdir("lib")) + os.trycp(path.join("msvc", "cares", cfg, "*.dll"), package:installdir("bin")) + if not package:config("shared") then package:add("defines", "CARES_STATICLIB") end end) diff --git a/packages/c/cgal/xmake.lua b/packages/c/cgal/xmake.lua index 6953f2e9f..74da2f423 100644 --- a/packages/c/cgal/xmake.lua +++ b/packages/c/cgal/xmake.lua @@ -6,6 +6,7 @@ package("cgal") add_urls("https://github.com/CGAL/cgal/releases/download/v$(version)/CGAL-$(version)-library.zip") add_versions("5.1.1", "ceca7ea896505941878f6c1fb7a7ae86653fdd9b3d87b276da72227f173a9cd2") + add_versions("5.2.1", "ccdea67db79153417504f50c534cea3bb6b0e9754e7f32fb753fc19005114db0") add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"}) diff --git a/packages/l/lodepng/xmake.lua b/packages/l/lodepng/xmake.lua new file mode 100644 index 000000000..dd03fdae9 --- /dev/null +++ b/packages/l/lodepng/xmake.lua @@ -0,0 +1,28 @@ +package("lodepng") + + set_homepage("https://lodev.org/lodepng/") + set_description("PNG encoder and decoder in C and C++.") + set_license("zlib") + + add_urls("https://github.com/lvandeve/lodepng.git") + + on_install(function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + target("lodepng") + set_kind("$(kind)") + add_files("lodepng.cpp") + add_headerfiles("lodepng.h") + ]]) + local configs = {} + if package:config("shared") then + configs.kind = "shared" + elseif not package:is_plat("windows", "mingw") and package:config("pic") ~= false then + configs.cxflags = "-fPIC" + end + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cxxfuncs("lodepng_decode_memory", {includes = "lodepng.h"})) + end) diff --git a/packages/n/ninja/xmake.lua b/packages/n/ninja/xmake.lua index a9129d1eb..60bfd5d20 100644 --- a/packages/n/ninja/xmake.lua +++ b/packages/n/ninja/xmake.lua @@ -8,20 +8,23 @@ package("ninja") set_urls("https://github.com/ninja-build/ninja/releases/download/v$(version)/ninja-win.zip") add_versions("1.9.0", "2d70010633ddaacc3af4ffbd21e22fae90d158674a09e132e06424ba3ab036e9") add_versions("1.10.1", "5d1211ea003ec9760ad7f5d313ebf0b659d4ffafa221187d2b4444bc03714a33") + add_versions("1.10.2", "bbde850d247d2737c5764c927d1071cbb1f1957dcabda4a130fa8547c12c695f") elseif is_host("macosx") then set_urls("https://github.com/ninja-build/ninja/releases/download/v$(version)/ninja-mac.zip") add_versions("1.9.0", "26d32a79f786cca1004750f59e545199bf110e21e300d3c2424c1fddd78f28ab") add_versions("1.10.1", "0bd650190d4405c15894055e349d9b59d5690b0389551d757c5ed2d3841972d1") + add_versions("1.10.2", "6fa359f491fac7e5185273c6421a000eea6a2f0febf0ac03ac900bd4d80ed2a5") elseif is_host("linux") then add_urls("https://github.com/ninja-build/ninja/archive/v$(version).tar.gz", "https://github.com/ninja-build/ninja.git") add_versions("1.9.0", "5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9") add_versions("1.10.1", "a6b6f7ac360d4aabd54e299cc1d8fa7b234cd81b9401693da21221c62569a23e") + add_versions("1.10.2", "ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed") end - if is_host("linux") then - add_deps("python2", {kind = "binary"}) - end + on_load("linux", function (package) + package:add("deps", package:version():ge("1.10.0") and "python" or "python2", {kind = "binary"}) + end) on_install("@windows", "@msys", "@cygwin", function (package) os.cp("./ninja.exe", package:installdir("bin")) @@ -32,7 +35,7 @@ package("ninja") end) on_install("@linux", function (package) - os.vrun("python2 configure.py --bootstrap") + os.vrun("python configure.py --bootstrap") os.cp("./ninja", package:installdir("bin")) end) diff --git a/packages/o/openblas/xmake.lua b/packages/o/openblas/xmake.lua index aa1d953c9..115d789ee 100644 --- a/packages/o/openblas/xmake.lua +++ b/packages/o/openblas/xmake.lua @@ -19,6 +19,8 @@ package("openblas") if is_plat("linux") then add_syslinks("pthread") + elseif is_plat("windows") then + add_links("libopenblas") end on_install("windows|x64", function (package) diff --git a/packages/p/ptex/xmake.lua b/packages/p/ptex/xmake.lua new file mode 100644 index 000000000..8a5fd1523 --- /dev/null +++ b/packages/p/ptex/xmake.lua @@ -0,0 +1,69 @@ +package("ptex") + + set_homepage("http://ptex.us/") + set_description("Per-Face Texture Mapping for Production Rendering") + set_license("BSD-3-Clause") + + add_urls("https://github.com/wdas/ptex/archive/$(version).tar.gz", + "https://github.com/wdas/ptex.git") + add_versions("v2.3.2", "30aeb85b965ca542a8945b75285cd67d8e207d23dbb57fcfeaab587bb443402b") + + add_deps("zlib") + if is_plat("linux") then + add_syslinks("pthread") + end + + on_load("windows", "mingw@windows", function (package) + if not package:config("shared") then + package:add("defines", "PTEX_STATIC") + end + end) + + on_install("windows", "linux", "macosx", function (package) + io.replace("src/ptex/PtexPlatform.h", "sys/types.h", "unistd.h", {plain = true}) + io.writefile("xmake.lua", format([[ + add_rules("mode.debug", "mode.release") + set_configvar("PTEX_MAJOR_VERSION", "%s") + set_configvar("PTEX_MINOR_VERSION", "%s") + add_requires("zlib") + target("ptex") + set_kind("$(kind)") + add_packages("zlib") + add_files("src/ptex/*.cpp") + add_includedirs("src/ptex", {public = true}) + add_headerfiles("src/ptex/(*.h)") + set_configdir("src/ptex") + add_configfiles("src/ptex/PtexVersion.h.in", {pattern = "@(.-)@"}) + if is_plat("macosx") or is_plat("linux") then + add_syslinks("pthread") + add_cxxflags("-fvisibility=default") + end + if get_config("kind") == "static" then + add_defines("PTEX_STATIC", {public = true}) + else + add_defines("PTEX_EXPORTS") + end + target("ptxinfo") + set_kind("binary") + add_deps("ptex") + add_packages("zlib") + add_files("src/utils/ptxinfo.cpp") + ]], package:version():major(), package:version():minor())) + local configs = {} + configs.mode = package:debug() and "debug" or "release" + if package:config("shared") then + configs.kind = "shared" + elseif package:is_plat("linux") and package:config("pic") ~= false then + configs.cxflags = "-fPIC" + end + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + Ptex::String error; + PtexPtr c(PtexCache::create(0,0)); + } + ]]}, {includes = "Ptexture.h"})) + end)