Fix build scripts

This commit is contained in:
Tindy X committed 2023-12-11 02:13:12 +08:00
1 parent 844989d772
commit 275f77a4f6
6 files changed
+66 -9

No files matched your search

+2 -1
View File
@@ -1,7 +1,8 @@
name: Publish Docker Image name: Publish Docker Image
on: on:
push: push:
branches: [ master ] branches:
- '**'
tags: tags:
- '**' - '**'
+3 -3
View File
@@ -47,13 +47,13 @@ set -xe
## shellcheck disable=SC2046 ## 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 #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 apk add lua5.4-dev luajit-dev mbedtls-dev mbedtls-static zlib-dev
curl -fsSL https://xmake.io/shget.text | bash curl -fsSL https://xmake.io/shget.text | bash
source "$HOME/.xmake/profile" source "$HOME/.xmake/profile"
xmake f --root --static=true -m release -y xmake f --root --static=true -m release -y -v
xmake --root subconverter xmake --root -v subconverter
cp "$(find build -name subconverter -type f)" base/subconverter cp "$(find build -name subconverter -type f)" base/subconverter
python3 -m ensurepip python3 -m ensurepip
+2 -2
View File
@@ -57,8 +57,8 @@ set -xe
brew reinstall xmake rapidjson pkgconfig brew reinstall xmake rapidjson pkgconfig
xmake f --root -m release -y xmake f --root -m release -y -v
xmake --root subconverter xmake --root -v subconverter
cp "$(find build -name subconverter -type f)" base/subconverter cp "$(find build -name subconverter -type f)" base/subconverter
python -m ensurepip python -m ensurepip
+2 -2
View File
@@ -51,8 +51,8 @@ set -xe
## shellcheck disable=SC2046 ## 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 #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 f --root --static=true -m release -y -v
xmake --root subconverter xmake --root -v subconverter
cp "$(find build -name subconverter -type f)" base/subconverter cp "$(find build -name subconverter -type f)" base/subconverter
python -m ensurepip python -m ensurepip
+3 -1
View File
@@ -7,11 +7,13 @@ option("static")
set_description("Build static binary.") set_description("Build static binary.")
option_end() 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/libcron.lua")
includes("xmake/yaml-cpp-static.lua") includes("xmake/yaml-cpp-static.lua")
includes("xmake/quickjspp.lua")
add_requires("libcron", {system = false}) add_requires("libcron", {system = false})
add_requires("yaml-cpp-static", {system = false}) add_requires("yaml-cpp-static", {system = false})
add_requires("quickjspp", {system = false})
target("subconverter") target("subconverter")
set_kind("binary") set_kind("binary")
+54
View File
@@ -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)