Skip to content

Commit

Permalink
Fix build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
tindy2013 committed Dec 10, 2023
1 parent 2cb7fc7 commit 8485c2c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
Expand All @@ -60,7 +61,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
outputs: type=image,push=true

Expand Down Expand Up @@ -106,7 +108,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/386
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
Expand All @@ -127,7 +130,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/386
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
outputs: type=image,push=true

Expand Down Expand Up @@ -173,7 +177,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/arm/v7
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
Expand All @@ -195,7 +200,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/arm/v7
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
build-args: |
THREADS=4
Expand Down Expand Up @@ -243,7 +249,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
Expand All @@ -265,7 +272,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
context: scripts/
context: .
file: scripts/Dockerfile
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
build-args: |
THREADS=4
Expand Down
5 changes: 3 additions & 2 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ RUN set -xe && \
# [ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\
# cmake -DCMAKE_BUILD_TYPE=Release -DUSE_EXTERNAL_CURL=ON -DUSE_EXTERNAL_RAPIDJSON=ON -DUSE_EXTERNAL_YAML_CPP=ON . && \
# make -j $THREADS && \
ls -alh && \
source "$HOME/.xmake/profile" && \
xmake f --root --static=false -m release && \
xmake --root subconverter --build release && \
xmake f --root --static=false -m release -y -v && \
xmake --root -v subconverter && \
python3 -m ensurepip && \
python3 -m pip install gitpython && \
python3 scripts/update_rules.py -c scripts/rules_config.conf
Expand Down
10 changes: 7 additions & 3 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ option("static")
option_end()

add_requires("pcre2", "yaml-cpp", "rapidjson", "toml11")
add_requires("libcurl >=8.4.0")
add_requires("xmake::libcurl >=8.4.0", {configs = {shared = not has_config("static"), mbedtls = is_plat("linux"), openssl = false}})
includes("xmake/libcron.lua")
includes("xmake/yaml-cpp-static.lua")
includes("xmake/quickjspp.lua")
includes("xmake/curl-static.lua")
add_requires("libcron", {system = false})
add_requires("yaml-cpp-static", {system = false})
add_requires("quickjspp", {system = false})
if not is_plat("macosx") and has_config("static") then
add_requires("curl-static", {system = false})
else
add_requires("libcurl")
end

target("subconverter")
set_kind("binary")
Expand All @@ -32,7 +36,7 @@ target("subconverter")
if is_plat("macosx") then
add_packages("libcurl")
else
add_packages("xmake::libcurl")
add_packages("curl-static")
end
if has_config("static") then
add_packages("yaml-cpp-static")
Expand Down
20 changes: 20 additions & 0 deletions xmake/curl-static.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package("curl-static")
add_deps("cmake")
add_versions("8.5.0", "7161cb17c01dcff1dc5bf89a18437d9d729f1ecd")
set_urls("https://github.com/curl/curl.git")
on_install(function (package)
local configs = {}
table.insert(configs, "-DCURL_USE_LIBSSH2=OFF")
table.insert(configs, "-DHAVE_LIBIDN2=OFF")
table.insert(configs, "-DCURL_USE_LIBPSL=OFF")
table.insert(configs, "-DBUILD_CURL_EXE=OFF")
table.insert(configs, "-DBUILD_TESTING=OFF")
table.insert(configs, "-DCURL_USE_MBEDTLS=" .. (package:is_plat("linux") and "ON" or "OFF"))
table.insert(configs, "-DCURL_USE_SCHANNEL=" .. (package:is_plat("windows") and "ON" or "OFF"))
table.insert(configs, "-DHTTP_ONLY=ON")
table.insert(configs, "-DCURL_USE_LIBSSH2=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"))
import("package.tools.cmake").install(package, configs)
end)
package_end()

0 comments on commit 8485c2c

Please sign in to comment.