Forráskód Böngészése

add graphene (#672)

* add graphene

* update libffi

* update oatpp

* fix typo
Hoildkv 3 éve
szülő
commit
97ffc08230

+ 20 - 0
packages/g/graphene/xmake.lua

@@ -0,0 +1,20 @@
+package("graphene")
+
+    set_homepage("http://ebassi.github.io/graphene/")
+    set_description("A thin layer of graphic data types")
+    set_license("MIT")
+
+    add_urls("https://github.com/ebassi/graphene/releases/download/$(version)/graphene-$(version).tar.xz")
+    add_versions("1.10.6", "80ae57723e4608e6875626a88aaa6f56dd25df75024bd16e9d77e718c3560b25")
+
+    add_deps("meson", "ninja")
+    add_includedirs("include/graphene-1.0", "lib/graphene-1.0/include")
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-Dinstalled_tests=false", "-Dgobject_types=false", "-Dintrospection=disabled"}
+        table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
+        import("package.tools.meson").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("graphene_matrix_alloc", {includes = "graphene.h"}))
+    end)

+ 155 - 0
packages/l/libffi/port/xmake.lua

@@ -0,0 +1,155 @@
+set_project("libffi")
+
+add_rules("mode.debug", "mode.release")
+
+set_configvar("PACKAGE", "libffi")
+set_configvar("PACKAGE_NAME", "libffi")
+set_configvar("PACKAGE_TARNAME", "libffi")
+set_configvar("PACKAGE_BUGREPORT", "")
+set_configvar("PACKAGE_URL", "")
+
+option("vers")
+    set_default("3.4.2")
+    set_showmenu(true)
+option_end()
+if has_config("vers") then
+    set_configvar("VERSION", get_config("vers"))
+    set_configvar("PACKAGE_VERSION", get_config("vers"))
+    set_configvar("PACKAGE_STRING", "libffi " .. get_config("vers"))
+end
+
+local targetarch = is_plat("windows") and "X86_WIN64" or "X86_64"
+if is_plat("windows") then
+    if is_arch("x86") then
+        targetarch = "X86_WIN32"
+    elseif is_arch("x64") then
+        targetarch = "X86_WIN64"
+    elseif is_arch("arm") then
+        targetarch = "ARM_WIN32"
+    elseif is_arch("arm64") then
+        targetarch = "ARM_WIN64"
+    end
+elseif is_plat("macosx") and is_arch("x86") then
+    targetarch = "X86_DARWIN"
+elseif is_plat("bsd") and is_arch("x86") then
+    targetarch = "X86_FREEBSD"
+else
+    if is_arch("x86") then
+        targetarch = "X86"
+    elseif is_arch("x64") then
+        targetarch = "X86_64"
+    elseif is_arch("arm") then
+        targetarch = "ARM"
+    elseif is_arch("arm64") then
+        targetarch = "ARM64"
+    end
+end
+set_configvar("TARGET", targetarch)
+
+includes("check_cfuncs.lua")
+includes("check_cincludes.lua")
+includes("check_csnippets.lua")
+
+set_configvar("STDC_HEADERS", 1)
+set_configvar("LT_OBJDIR", ".libs/")
+configvar_check_cincludes("HAVE_INTTYPES_H", "inttypes.h")
+configvar_check_cincludes("HAVE_MEMORY_H", "memory.h")
+configvar_check_cincludes("HAVE_STDINT_H", "stdint.h")
+configvar_check_cincludes("HAVE_STDLIB_H", "stdlib.h")
+configvar_check_cincludes("HAVE_STRINGS_H", "strings.h")
+configvar_check_cincludes("HAVE_STRING_H", "string.h")
+configvar_check_cincludes("HAVE_SYS_STAT_H", "sys/stat.h")
+configvar_check_cincludes("HAVE_SYS_TYPES_H", "sys/types.h")
+configvar_check_cincludes("HAVE_ALLOCA_H", "alloca.h")
+configvar_check_cfuncs("HAVE_ALLOCA", "alloca", {includes = "alloca.h"})
+configvar_check_csnippets("HAVE_LONG_DOUBLE", [[assert(sizeof(long double) > sizeof(double));]], {includes = "assert.h", tryrun = true, default = 0})
+configvar_check_csnippets("SIZEOF_DOUBLE", [[printf("%d", sizeof(double));]], {tryrun = true, output = true, number = true})
+configvar_check_csnippets("SIZEOF_LONG_DOUBLE", [[printf("%d", sizeof(long double));]], {tryrun = true, output = true, number = true})
+configvar_check_csnippets("SIZEOF_SIZE_T", [[printf("%d", sizeof(size_t));]], {tryrun = true, output = true, number = true})
+if not is_plat("windows") then
+    set_configvar("HAVE_AS_X86_PCREL", 1)
+end
+if is_plat("macosx") then
+    set_configvar("SYMBOL_UNDERSCORE", 1)
+end
+if is_plat("linux") then
+    set_configvar("HAVE_HIDDEN_VISIBILITY_ATTRIBUTE", 1)
+    set_configvar("EH_FRAME_FLAGS", "a")
+end
+if is_plat("macosx") and is_arch("arm64") then
+    set_configvar("FFI_EXEC_TRAMPOLINE_TABLE", 1)
+else
+    set_configvar("FFI_EXEC_TRAMPOLINE_TABLE", 0)
+end
+
+rule("asm.preprocess")
+    set_extensions(".S")
+    on_buildcmd_file(function (target, batchcmds, sourcefile, opt)
+        import("core.tool.toolchain")
+        import("lib.detect.find_tool")
+
+        local rootdir = path.join(target:autogendir(), "rules", "asm.preprocess")
+        local filename = path.basename(sourcefile) .. ".asm"
+        local sourcefile_or = path.absolute(sourcefile)
+        local sourcefile_cx = target:autogenfile(sourcefile, {rootdir = rootdir, filename = filename})
+
+        -- preprocessing
+        local envs = toolchain.load("msvc"):runenvs()
+        local cl = find_tool("cl", {envs = envs})
+        batchcmds:execv(cl.program, {"/nologo", "/EP", "/Iinclude", "/I" .. path.directory(sourcefile_or), sourcefile_or}, {stdout = sourcefile_cx})
+
+        local objectfile = target:objectfile(sourcefile_cx)
+        table.insert(target:objectfiles(), objectfile)
+
+        batchcmds:show_progress(opt.progress, "${color.build.object}compiling.%s %s", get_config("mode"), sourcefile_cx)
+        batchcmds:compile(sourcefile_cx, objectfile)
+
+        batchcmds:add_depfiles(sourcefile)
+        batchcmds:set_depmtime(os.mtime(objectfile))
+        batchcmds:set_depcache(target:dependfile(objectfile))
+    end)
+rule_end()
+if is_plat("windows") then
+    add_rules("asm.preprocess", {override = true})
+end
+
+target("ffi")
+    set_kind("$(kind)")
+    add_defines("FFI_BUILDING")
+    if is_plat("windows") and is_kind("shared") then
+        add_defines("FFI_BUILDING_DLL")
+    end
+    set_configdir("include")
+    add_configfiles("fficonfig.h.in")
+    add_configfiles("include/ffi.h.in", {pattern = "@(.-)@"})
+    add_includedirs("include")
+    add_headerfiles("include/ffi.h")
+    add_files("src/prep_cif.c", "src/types.c", "src/closures.c", "src/tramp.c")
+    if not is_arch("arm") and not is_arch("arm64") then
+        add_files("src/raw_api.c", "src/java_raw_api.c")
+    end
+    if is_plat("windows") and is_arch("x86") then
+        add_asflags("/GZ")
+    end
+    if is_arch("x86") then
+        add_files("src/x86/ffi.c")
+        add_files(is_plat("windows") and "src/x86/sysv_intel.S" or "src/x86/sysv.S")
+        add_includedirs("src/x86")
+        add_headerfiles("src/x86/ffitarget.h")
+    elseif is_arch("x86_64") then
+        add_files("src/x86/ffi64.c", "src/x86/unix64.S", "src/x86/ffiw64.c", "src/x86/win64.S")
+        add_includedirs("src/x86")
+        add_headerfiles("src/x86/ffitarget.h")
+    elseif is_arch("x64") then
+        add_files("src/x86/ffi64.c", "src/x86/ffiw64.c", "src/x86/win64_intel.S")
+        add_includedirs("src/x86")
+        add_headerfiles("src/x86/ffitarget.h")
+    elseif is_arch("arm") then
+        add_files("src/arm/ffi.c", "src/arm/sysv.S")
+        add_includedirs("src/arm")
+        add_headerfiles("src/arm/ffitarget.h")
+    elseif is_arch("arm64") then
+        add_files("src/aarch64/ffi.c", "src/aarch64/sysv.S")
+        add_includedirs("src/aarch64")
+        add_headerfiles("src/aarch64/ffitarget.h")
+    end

+ 17 - 3
packages/l/libffi/xmake.lua

@@ -3,17 +3,23 @@ package("libffi")
     set_homepage("https://sourceware.org/libffi/")
     set_description("Portable Foreign Function Interface library.")
 
-    set_urls("https://sourceware.org/pub/libffi/libffi-$(version).tar.gz",
-             "https://github.com/libffi/libffi/releases/download/v$(version)/libffi-$(version).tar.gz",
+    set_urls("https://github.com/libffi/libffi/releases/download/v$(version)/libffi-$(version).tar.gz",
              "https://github.com/libffi/libffi.git")
     add_versions("3.2.1", "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37")
     add_versions("3.3", "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056")
+    add_versions("3.4.2", "540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620")
 
     if is_plat("linux") then
         add_extsources("apt::libffi-dev")
     end
 
-    on_load(function (package)
+    on_load("windows", function (package)
+        if not package:config("shared") then
+            package:add("defines", "FFI_BUILDING")
+        end
+    end)
+
+    on_load("macosx", "linux", "iphoneos", function (package)
         if package:gitref() then
             package:add("deps", "autoconf", "automake", "libtool")
         elseif package:version():le("3.2.1") then
@@ -21,6 +27,14 @@ package("libffi")
         end
     end)
 
+    on_install("windows", function (package)
+        io.gsub("fficonfig.h.in", "# *undef (.-)\n", "${define %1}\n")
+        os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua")
+        import("package.tools.xmake").install(package, {
+            vers = package:version_str()
+        })
+    end)
+
     on_install("macosx", "linux", "iphoneos", function (package)
         local configs = {"--disable-silent-rules", "--disable-dependency-tracking"}
         table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))

+ 15 - 3
packages/o/oatpp/xmake.lua

@@ -2,21 +2,33 @@ package("oatpp")
 
     set_homepage("https://oatpp.io/")
     set_description("Modern Web Framework for C++. High performance, simple API, cross platform, zero dependency.")
+    set_license("Apache-2.0")
 
     add_urls("https://github.com/oatpp/oatpp/archive/$(version).tar.gz",
              "https://github.com/oatpp/oatpp.git")
-
     add_versions("1.0.0", "9ba7c75e3ada8ec894ec10beae712e775774a835fd3de89d8c34e17740202619")
+    add_versions("1.2.5", "36276e8b23e68ece1e6093c3f06fc80e3d42a5f4e47cdeef5e7e63f36eeddaad")
 
-    add_deps("cmake")
+    if is_plat("windows") then
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
 
+    add_deps("cmake")
+    if is_plat("windows") then
+        add_syslinks("ws2_32")
+    end
     on_load(function (package)
         package:add("includedirs", path.join("include", "oatpp-" .. package:version_str(), "oatpp"))
+        package:add("linkdirs", path.join("lib", "oatpp-" .. package:version_str()))
     end)
 
-    on_install("linux", "macosx", "windows", function (package)
+    on_install("linux", "macosx", "windows|x64", function (package)
         local configs = {"-DOATPP_BUILD_TESTS=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"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DOATPP_MSVC_LINK_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
         import("package.tools.cmake").install(package, configs)
     end)