mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 18:24:58 +00:00
Fix build scripts
This commit is contained in:
6 files changed
+66
-9
No files matched your search
@@ -1,7 +1,8 @@
|
||||
name: Publish Docker Image
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- '**'
|
||||
tags:
|
||||
- '**'
|
||||
|
||||
|
||||
@@ -47,13 +47,13 @@ set -xe
|
||||
## shellcheck disable=SC2046
|
||||
#g++ -o base/subconverter $(find CMakeFiles/subconverter.dir/src/ -name "*.o") -static -lpcre2-8 -lyaml-cpp -L/usr/lib64 -lcurl -lmbedtls -lmbedcrypto -lmbedx509 -lz -l:quickjs/libquickjs.a -llibcron -O3 -s
|
||||
|
||||
apk add git g++ build-base linux-headers cmake python3 curl unzip p7zip
|
||||
apk add git g++ build-base linux-headers cmake python3 curl unzip p7zip perl
|
||||
apk add lua5.4-dev luajit-dev mbedtls-dev mbedtls-static zlib-dev
|
||||
curl -fsSL https://xmake.io/shget.text | bash
|
||||
source "$HOME/.xmake/profile"
|
||||
|
||||
xmake f --root --static=true -m release -y
|
||||
xmake --root subconverter
|
||||
xmake f --root --static=true -m release -y -v
|
||||
xmake --root -v subconverter
|
||||
cp "$(find build -name subconverter -type f)" base/subconverter
|
||||
|
||||
python3 -m ensurepip
|
||||
|
||||
@@ -57,8 +57,8 @@ set -xe
|
||||
|
||||
brew reinstall xmake rapidjson pkgconfig
|
||||
|
||||
xmake f --root -m release -y
|
||||
xmake --root subconverter
|
||||
xmake f --root -m release -y -v
|
||||
xmake --root -v subconverter
|
||||
cp "$(find build -name subconverter -type f)" base/subconverter
|
||||
|
||||
python -m ensurepip
|
||||
|
||||
@@ -51,8 +51,8 @@ set -xe
|
||||
## shellcheck disable=SC2046
|
||||
#g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -lbcrypt -lpcre2-8 -l:quickjs/libquickjs.a -llibcron -lyaml-cpp -liphlpapi -lcrypt32 -lws2_32 -lwsock32 -lz -s
|
||||
|
||||
xmake f --root --static=true -m release -y
|
||||
xmake --root subconverter
|
||||
xmake f --root --static=true -m release -y -v
|
||||
xmake --root -v subconverter
|
||||
cp "$(find build -name subconverter -type f)" base/subconverter
|
||||
|
||||
python -m ensurepip
|
||||
|
||||
@@ -7,11 +7,13 @@ option("static")
|
||||
set_description("Build static binary.")
|
||||
option_end()
|
||||
|
||||
add_requires("libcurl >=8.4.0", "pcre2", "yaml-cpp", "rapidjson", "toml11", "quickjspp")
|
||||
add_requires("libcurl >=8.4.0", "pcre2", "yaml-cpp", "rapidjson", "toml11")
|
||||
includes("xmake/libcron.lua")
|
||||
includes("xmake/yaml-cpp-static.lua")
|
||||
includes("xmake/quickjspp.lua")
|
||||
add_requires("libcron", {system = false})
|
||||
add_requires("yaml-cpp-static", {system = false})
|
||||
add_requires("quickjspp", {system = false})
|
||||
|
||||
target("subconverter")
|
||||
set_kind("binary")
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package("quickjspp")
|
||||
|
||||
set_homepage("https://github.com/ftk/quickjspp")
|
||||
set_description("QuickJS C++ wrapper")
|
||||
|
||||
add_urls("https://github.com/ftk/quickjspp.git")
|
||||
add_versions("2022.7.22", "9cee4b4d27271d54b95f6f42bfdc534ebeaaeb72")
|
||||
|
||||
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
|
||||
|
||||
add_includedirs("include", "include/quickjs")
|
||||
add_linkdirs("lib/quickjs")
|
||||
add_links("quickjs")
|
||||
|
||||
add_deps("cmake")
|
||||
|
||||
if is_plat("linux") then
|
||||
add_syslinks("pthread", "dl", "m")
|
||||
end
|
||||
|
||||
on_install("linux", "macosx", "windows", function (package)
|
||||
local configs = {"-DBUILD_TESTING=OFF"}
|
||||
-- TODO, disable lto, maybe we need do it better
|
||||
io.replace("CMakeLists.txt", "set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)", "", {plain = true})
|
||||
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:check_cxxsnippets({test = [[
|
||||
#include <iostream>
|
||||
void test() {
|
||||
using namespace qjs;
|
||||
Runtime runtime;
|
||||
Context context(runtime);
|
||||
auto rt = runtime.rt;
|
||||
auto ctx = context.ctx;
|
||||
js_std_init_handlers(rt);
|
||||
js_init_module_std(ctx, "std");
|
||||
js_init_module_os(ctx, "os");
|
||||
context.eval(R"xxx(
|
||||
import * as std from 'std';
|
||||
import * as os from 'os';
|
||||
globalThis.std = std;
|
||||
globalThis.os = os;
|
||||
)xxx", "<input>", JS_EVAL_TYPE_MODULE);
|
||||
|
||||
js_std_loop(ctx);
|
||||
js_std_free_handlers(rt);
|
||||
|
||||
}
|
||||
]]}, {configs = {languages = "c++17"},
|
||||
includes = {"quickjspp.hpp","quickjs/quickjs-libc.h"}}))
|
||||
end)
|
||||
Reference in new issue
Block a user