Преглед изворни кода

add libjpeg-turbo, gn, dxc and update icu4c, glslang (#169)

* add libjpeg-turbo

* add directxshadercompiler

* update glslang

* add gn

* update icu4c

* remove google download url

* remove redundant env path
Hoildkv пре 4 година
родитељ
комит
30b3f83644

+ 21 - 0
packages/d/directxshadercompiler/xmake.lua

@@ -0,0 +1,21 @@
+package("directxshadercompiler")
+
+    set_homepage("https://github.com/microsoft/DirectXShaderCompiler/")
+    set_description("DirectX Shader Compiler")
+    set_license("LLVM")
+
+    local date = {["1.5.2010"] = "2020_10-22"}
+    add_urls("https://github.com/microsoft/DirectXShaderCompiler/releases/download/v$(version).zip", {version = function (version) return version .. "/dxc_" .. date[version] end})
+    add_versions("1.5.2010", "b691f63778f470ebeb94874426779b2f60685fc8711adf1b1f9f01535d9b67f8")
+
+    set_kind("binary")
+
+    on_install("@windows|x64", function (package)
+        os.cp("bin/x64/**", package:installdir("bin"))
+        os.cp("inc/**", package:installdir("include"))
+        os.cp("lib", package:installdir())
+    end)
+
+    on_test(function (package)
+        os.vrun("dxc -help")
+    end)

+ 3 - 0
packages/g/glslang/xmake.lua

@@ -8,6 +8,9 @@ package("glslang")
     add_versions("1.2.154+1", "bacaef3237c515e40d1a24722be48c0a0b30f75f")
 
     add_deps("cmake", "spirv-tools", "python 3.x")
+    if is_plat("linux") then
+        add_syslinks("pthread")
+    end
 
     on_install("linux", "windows", "macosx", function (package)
         package:addenv("PATH", "bin")

+ 31 - 0
packages/g/gn/xmake.lua

@@ -0,0 +1,31 @@
+package("gn")
+
+    set_homepage("https://gn.googlesource.com/gn")
+    set_description("GN is a meta-build system that generates build files for Ninja.")
+    set_kind("binary")
+
+    if is_host("windows") then
+        if os.arch() == "x64" then
+            add_urls("https://github.com/xmake-mirror/gn-releases/raw/v$(version)/gn-windows-amd64.zip")
+            add_versions("20201128", "1cf7fbda62a585925391cc551053e0c6313a9c5aabc02c3c20c138c0ea6bc2bf")
+        end
+    elseif is_host("linux") then
+        add_urls("https://github.com/xmake-mirror/gn-releases/raw/v$(version)/gn-linux-amd64.zip")
+        add_versions("20201128", "756d6a88adcb157bd80eb4cea10df9e77fa1e7a328c67858b4c0cd0ab15c9f6e")
+    elseif is_host("macosx") then
+        if os.arch() == "arm64" then
+            add_urls("https://github.com/xmake-mirror/gn-releases/raw/v$(version)/gn-mac-arm64.zip")
+            add_versions("20201128", "be0be7cc48ced8124f1da53fe3c571cefa6390ccd7f531144e3dffd4b51e1138")
+        else
+            add_urls("https://github.com/xmake-mirror/gn-releases/raw/v$(version)/gn-mac-amd64.zip")
+            add_versions("20201128", "34dc4171ec89cf7839c8ada4fec80860109b4af936688a3bfe9373c464667573")
+        end
+    end
+
+    on_install("@windows", "@linux", "@macosx", function (package)
+        os.cp("gn*", package:installdir("bin"))
+    end)
+
+    on_test(function (package)
+        os.vrun("gn --version")
+    end)

+ 48 - 6
packages/i/icu4c/xmake.lua

@@ -1,25 +1,67 @@
 package("icu4c")
 
-    set_homepage("https://ssl.icu-project.org/")
+    set_homepage("http://site.icu-project.org/")
     set_description("C/C++ libraries for Unicode and globalization.")
 
-    add_urls("https://ssl.icu-project.org/files/icu4c/$(version)-src.tgz", {version = function (version)
-            return version .. "/icu4c-" .. (version:gsub("%.", "_"))
-        end})
     add_urls("https://github.com/unicode-org/icu/releases/download/release-$(version)-src.tgz", {version = function (version)
             return (version:gsub("%.", "-")) .. "/icu4c-" .. (version:gsub("%.", "_"))
         end})
-
+    add_versions("68.1", "a9f2e3d8b4434b8e53878b4308bd1e6ee51c9c7042e2b1a376abefb6fbb29f2d")
     add_versions("64.2", "627d5d8478e6d96fc8c90fed4851239079a561a6a8b9e48b0892f24e82d31d6c")
 
     add_links("icuuc", "icutu", "icui18n", "icuio", "icudata")
     if is_plat("linux") then
         add_syslinks("dl")
     end
+    if is_plat("windows") then
+        add_deps("python 3.x", {kind = "binary"})
+    end
+
+    on_install("windows", function (package)
+        import("package.tools.msbuild")
+
+        -- set configs
+        local configs = {path.join("source", "allinone", "allinone.sln"), "/p:SkipUWP=True", "/p:_IsNativeEnvironment=true"}
+        table.insert(configs, "/p:Configuration=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "/p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32"))
+
+        -- set envs
+        local envs = msbuild.buildenvs(package)
+        envs.PATH = package:dep("python"):installdir("bin") .. path.envsep() .. envs.PATH
+
+        -- build
+        msbuild.build(package, configs, {envs = envs})
+        os.cp("include", package:installdir())
+        os.cp("bin*/*", package:installdir("bin"))
+        os.cp("lib*/*", package:installdir("lib"))
+        package:addenv("PATH", "bin")
+    end)
 
     on_install("macosx", "linux", function (package)
+        import("package.tools.autoconf")
+
         os.cd("source")
-        import("package.tools.autoconf").install(package, {"--disable-samples", "--disable-tests", "--enable-static", "--disable-shared"})
+        local configs = {"--disable-samples", "--disable-tests"}
+        if package:debug() then
+            table.insert(configs, "--enable-debug")
+            table.insert(configs, "--disable-release")
+        end
+        if package:config("shared") then
+            table.insert(configs, "--enable-shared")
+            table.insert(configs, "--disable-static")
+        else
+            table.insert(configs, "--disable-shared")
+            table.insert(configs, "--enable-static")
+        end
+
+        local envs = {}
+        if package:is_plat("linux") and not package:config("shared") then
+            envs = autoconf.buildenvs(package, {cxflags = "-fPIC"})
+        else
+            envs = autoconf.buildenvs(package)
+        end
+        autoconf.install(package, configs, {envs = envs})
+        package:addenv("PATH", "bin")
     end)
 
     on_test(function (package)

+ 39 - 0
packages/l/libjpeg-turbo/xmake.lua

@@ -0,0 +1,39 @@
+package("libjpeg-turbo")
+
+    set_homepage("https://libjpeg-turbo.org/")
+    set_description("A JPEG image codec that uses SIMD instructions (MMX, SSE2, AVX2, Neon, AltiVec) to accelerate baseline JPEG compression and decompression on x86, x86-64, Arm, and PowerPC systems.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://cfhcable.dl.sourceforge.net/project/libjpeg-turbo/$(version)/libjpeg-turbo-$(version).tar.gz", {alias = "sf"})
+    add_urls("https://github.com/libjpeg-turbo/libjpeg-turbo/archive/$(version).tar.gz", {alias = "github"})
+    add_versions("sf:2.0.5", "16f8f6f2715b3a38ab562a84357c793dd56ae9899ce130563c72cd93d8357b5d")
+    add_versions("sf:2.0.6", "d74b92ac33b0e3657123ddcf6728788c90dc84dcb6a52013d758af3c4af481bb")
+    add_versions("github:2.0.5", "b3090cd37b5a8b3e4dbd30a1311b3989a894e5d3c668f14cbc6739d77c9402b7")
+    add_versions("github:2.0.6", "005aee2fcdca252cee42271f7f90574dda64ca6505d9f8b86ae61abc2b426371")
+
+    add_configs("jpeg", {description = "libjpeg API/ABI emulation target version.", default = "6", type = "string", values = {"6", "7", "8"}})
+
+    add_deps("cmake", "nasm")
+
+    on_install("windows", "linux", "macosx", function (package)
+        local configs = {}
+        local jpeg = package:config("jpeg")
+        if jpeg == "7" then
+            table.insert(configs, "-DWITH_JPEG7=ON")
+        elseif jpeg == "8" then
+            table.insert(configs, "-DWITH_JPEG8=ON")
+        end
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        if package:config("shared") then
+            table.insert(configs, "-DENABLE_SHARED=ON")
+            table.insert(configs, "-DENABLE_STATIC=OFF")
+        else
+            table.insert(configs, "-DENABLE_SHARED=OFF")
+            table.insert(configs, "-DENABLE_STATIC=ON")
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("tjSaveImage", {includes = "turbojpeg.h"}))
+    end)

+ 24 - 3
packages/n/nasm/xmake.lua

@@ -3,11 +3,32 @@ package("nasm")
     set_kind("binary")
     set_homepage("https://www.nasm.us/")
     set_description("Netwide Assembler (NASM) is an 80x86 assembler.")
+    set_license("BSD-2-Clause")
 
-    add_urls("https://www.nasm.us/pub/nasm/releasebuilds/$(version)/nasm-$(version).tar.xz",
-             "https://repo.or.cz/nasm.git")
-    add_versions("2.13.03", "812ecfb0dcbc5bd409aaa8f61c7de94c5b8752a7b00c632883d15b2ed6452573")
+    if is_host("windows") then
+        if os.arch() == "x64" then
+            add_urls("https://www.nasm.us/pub/nasm/releasebuilds/$(version)/win64/nasm-$(version)-win64.zip")
+            add_versions("2.15.05", "f5c93c146f52b4f1664fa3ce6579f961a910e869ab0dae431bd871bdd2584ef2")
+        else
+            add_urls("https://www.nasm.us/pub/nasm/releasebuilds/$(version)/win32/nasm-$(version)-win32.zip")
+            add_versions("2.15.05", "258c7d1076e435511cf2fdf94e2281eadbdb9e3003fd57f356f446e2bce3119e")
+        end
+    else
+        add_urls("https://www.nasm.us/pub/nasm/releasebuilds/$(version)/nasm-$(version).tar.xz",
+                 "https://github.com/netwide-assembler/nasm.git")
+        add_versions("2.13.03", "812ecfb0dcbc5bd409aaa8f61c7de94c5b8752a7b00c632883d15b2ed6452573")
+        add_versions("2.15.05", "3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f")
+    end
+
+    on_install("@windows", "@mingw", "@msys", function (package)
+        os.cp("*.exe", package:installdir("bin"))
+        os.cp(path.join("rdoff", "*.exe"), package:installdir("bin"))
+    end)
 
     on_install("@linux", "@macosx", function (package)
         import("package.tools.autoconf").install(package)
     end)
+
+    on_test(function (package)
+        os.vrun("nasm --version")
+    end)