소스 검색

add libepoxy, fribidi and lvgl (#618)

* fix cuda env

* improve corrade

* improve xorgproto

* add libepoxy

* add fribidi

* add lvgl

* fix cmake error
Hoildkv 4 년 전
부모
커밋
b4cee6bcb2
6개의 변경된 파일94개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 0
      packages/c/corrade/xmake.lua
  2. 8 1
      packages/c/cuda/xmake.lua
  3. 26 0
      packages/f/fribidi/xmake.lua
  4. 26 0
      packages/l/libepoxy/xmake.lua
  5. 31 0
      packages/l/lvgl/xmake.lua
  6. 1 1
      packages/x/xorgproto/xmake.lua

+ 2 - 0
packages/c/corrade/xmake.lua

@@ -19,9 +19,11 @@ package("corrade")
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
         import("package.tools.cmake").install(package, configs)
+        package:addenv("PATH", "bin")
     end)
 
     on_test(function (package)
+        os.vrun("corrade-rc --help")
         assert(package:check_cxxsnippets({test = [[
             #include <string>
             void test() {

+ 8 - 1
packages/c/cuda/xmake.lua

@@ -5,6 +5,14 @@ package("cuda")
 
     add_configs("utils", {description = "enabled cuda utilities.", default = {}, type = "table"})
 
+    on_load(function (package)
+        import("detect.sdks.find_cuda")
+        local cuda = find_cuda()
+        if cuda then
+            package:addenv("PATH", cuda.bindir)
+        end
+    end)
+
     on_fetch(function (package, opt)
         if opt.system then
             import("detect.sdks.find_cuda")
@@ -12,7 +20,6 @@ package("cuda")
 
             local cuda = find_cuda()
             if cuda then
-                package:addenv("PATH", cuda.bindir)
                 local result = {includedirs = cuda.includedirs, linkdirs = cuda.linkdirs, links = {}}
                 local utils = package:config("utils")
                 table.insert(utils, package:config("shared") and "cudart" or "cudart_static")

+ 26 - 0
packages/f/fribidi/xmake.lua

@@ -0,0 +1,26 @@
+package("fribidi")
+
+    set_homepage("https://github.com/fribidi/fribidi")
+    set_description("The Free Implementation of the Unicode Bidirectional Algorithm.")
+    set_license("LGPL-2.1")
+
+    add_urls("https://github.com/fribidi/fribidi/releases/download/v$(version)/fribidi-$(version).tar.xz")
+    add_versions("1.0.10", "7f1c687c7831499bcacae5e8675945a39bacbad16ecaa945e9454a32df653c01")
+
+    if is_plat("linux") then
+        add_extsources("apt::libfribidi-dev")
+    end
+
+    on_install("macosx", "linux", 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") ~= false then
+            table.insert(configs, "--with-pic")
+        end
+        import("package.tools.autoconf").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("fribidi_debug_status", {includes = "fribidi/fribidi-common.h"}))
+    end)

+ 26 - 0
packages/l/libepoxy/xmake.lua

@@ -0,0 +1,26 @@
+package("libepoxy")
+
+    set_homepage("https://download.gnome.org/sources/libepoxy/")
+    set_description("Epoxy is a library for handling OpenGL function pointer management for you.")
+    set_license("MIT")
+
+    add_urls("https://download.gnome.org/sources/libepoxy/$(version).tar.xz", {version = function (version)
+        return format("%d.%d/libepoxy-%s", version:major(), version:minor(), version)
+    end})
+    add_versions("1.5.9", "d168a19a6edfdd9977fef1308ccf516079856a4275cf876de688fb7927e365e4")
+
+    add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
+
+    if is_plat("linux") then
+        add_extsources("apt::libepoxy-dev")
+        add_deps("libx11", "pkg-config")
+    end
+
+    add_deps("meson", "ninja")
+    on_install("windows", "macosx", "linux", function (package)
+        import("package.tools.meson").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("epoxy_gl_version", {includes = "epoxy/gl.h"}))
+    end)

+ 31 - 0
packages/l/lvgl/xmake.lua

@@ -0,0 +1,31 @@
+package("lvgl")
+
+    set_homepage("https://lvgl.io")
+    set_description("Light and Versatile Graphics Library")
+    set_license("MIT")
+
+    add_urls("https://github.com/lvgl/lvgl/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/lvgl/lvgl.git")
+    add_versions("v8.0.2", "7136edd6c968b60f0554130c6903f16870fa26cda11a2290bc86d09d7138a6b4")
+
+    add_configs("shared",      {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    add_configs("color_depth", {description = "Set color depth.", default = "32", type = "string", values = {"1", "8", "16", "32"}})
+    add_configs("use_log",     {description = "Enable the log module.", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    on_install(function (package)
+        os.mv("lv_conf_template.h", "src/lv_conf.h")
+        io.replace("src/lv_conf.h", "#if 0", "#if 1")
+        io.replace("src/lv_conf.h", "#define LV_BUILD_EXAMPLES -1", "#define LV_BUILD_EXAMPLES 0")
+        io.replace("src/lv_conf.h", "#define LV_COLOR_DEPTH -16", "#define LV_COLOR_DEPTH " .. package:config("color_depth"))
+        io.replace("src/lv_conf.h", "#define LV_USE_LOG -0", "#define LV_USE_LOG " .. (package:config("use_log") and "1" or "0"))
+        io.replace("CMakeLists.txt", "add_library(lvgl STATIC ${SOURCES})", "add_library(lvgl STATIC ${SOURCES})\ninstall(TARGETS lvgl)\ninstall(FILES lvgl.h DESTINATION include)\ninstall(DIRECTORY src DESTINATION include FILES_MATCHING PATTERN \"*.h\")", {plain = true})
+        io.replace("CMakeLists.txt", "if(ESP_PLATFORM)", "cmake_minimum_required(VERSION 3.15)\nif(ESP_PLATFORM)", {plain = true})
+        local configs = {}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("lv_version_info", {includes = "lvgl.h"}))
+    end)

+ 1 - 1
packages/x/xorgproto/xmake.lua

@@ -8,7 +8,7 @@ package("xorgproto")
     add_versions("2021.3", "4c732b14fc7c7db64306374d9e8386d6172edbb93f587614df1938b9d9b9d737")
 
     if is_plat("linux") then
-        add_extsources("apt::x11proto-dev")
+        add_extsources("apt::x11proto-dev", "pkgconfig::xproto")
     end
 
     if is_plat("macosx", "linux") then