diff --git a/.github/workflows/cross_musl.yml b/.github/workflows/cross_musl.yml new file mode 100644 index 000000000..0a7ba48ad --- /dev/null +++ b/.github/workflows/cross_musl.yml @@ -0,0 +1,30 @@ +name: Cross (Musl) + +on: + pull_request: + push: + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest] + arch: [arm, aarch64] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v1 + - uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: branch@dev + + - name: Installation + run: | + wget https://musl.cc/${{ matrix.arch }}-linux-musleabi-cross.tgz + tar -xvf ${{ matrix.arch }}-linux-musleabi-cross.tgz + + - name: Tests + run: | + xmake l ./scripts/test.lua -D -k ${{ matrix.kind }} -p cross --sdk=`pwd`/${{ matrix.arch }}-linux-musleabi-cross + diff --git a/packages/z/zlib/xmake.lua b/packages/z/zlib/xmake.lua index 19ce3891e..876c69467 100644 --- a/packages/z/zlib/xmake.lua +++ b/packages/z/zlib/xmake.lua @@ -30,7 +30,7 @@ package("zlib") import("package.tools.autoconf").install(package, {"--static"}) end) - on_install("iphoneos", "android@linux,macosx", "mingw@linux,macosx", function (package) + on_install("iphoneos", "android@linux,macosx", "mingw@linux,macosx", "cross", function (package) import("package.tools.autoconf").configure(package, {host = "", "--static"}) io.gsub("Makefile", "\nAR=.-\n", "\nAR=" .. (package:build_getenv("ar") or "") .. "\n") io.gsub("Makefile", "\nARFLAGS=.-\n", "\nARFLAGS=cr\n") diff --git a/scripts/packages.lua b/scripts/packages.lua index 91ab4b1ca..68b49d266 100644 --- a/scripts/packages.lua +++ b/scripts/packages.lua @@ -60,7 +60,7 @@ function main(opt) local packagefile = path.join(packagedir, "xmake.lua") local instance = package.load_from_repository(packagename, nil, packagedir, packagefile) if instance then - for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw", "msys", "bsd"}) do + for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw", "msys", "bsd", "cross"}) do local archs = platform.archs(plat) if archs then local package_archs = {} diff --git a/scripts/test.lua b/scripts/test.lua index 20c433a31..5c0a433f8 100644 --- a/scripts/test.lua +++ b/scripts/test.lua @@ -6,19 +6,20 @@ import("packages", {alias = "get_packages"}) -- the options local options = { - {'v', "verbose", "k", nil, "Enable verbose information." } -, {'D', "diagnosis", "k", nil, "Enable diagnosis information." } -, {nil, "shallow", "k", nil, "Only install the root packages." } -, {'k', "kind", "kv", nil, "Enable static/shared library." } -, {'p', "plat", "kv", nil, "Set the given platform." } -, {'a', "arch", "kv", nil, "Set the given architecture." } -, {'m', "mode", "kv", nil, "Set the given mode." } -, {nil, "cflags", "kv", nil, "Set the cflags." } -, {nil, "cxxflags", "kv", nil, "Set the cxxflags." } -, {nil, "ldflags", "kv", nil, "Set the ldflags." } -, {nil, "ndk", "kv", nil, "Set the android NDK directory." } -, {nil, "mingw", "kv", nil, "Set the MingW directory." } -, {nil, "packages", "vs", nil, "The package list." } + {'v', "verbose", "k", nil, "Enable verbose information." } +, {'D', "diagnosis", "k", nil, "Enable diagnosis information." } +, {nil, "shallow", "k", nil, "Only install the root packages." } +, {'k', "kind", "kv", nil, "Enable static/shared library." } +, {'p', "plat", "kv", nil, "Set the given platform." } +, {'a', "arch", "kv", nil, "Set the given architecture." } +, {'m', "mode", "kv", nil, "Set the given mode." } +, {nil, "cflags", "kv", nil, "Set the cflags." } +, {nil, "cxxflags", "kv", nil, "Set the cxxflags." } +, {nil, "ldflags", "kv", nil, "Set the ldflags." } +, {nil, "ndk", "kv", nil, "Set the android NDK directory." } +, {nil, "sdk", "kv", nil, "Set the SDK directory of cross toolchain." } +, {nil, "mingw", "kv", nil, "Set the MingW directory." } +, {nil, "packages", "vs", nil, "The package list." } } -- require packages @@ -42,6 +43,9 @@ function _require_packages(argv, packages) if argv.ndk then table.insert(config_argv, "--ndk=" .. argv.ndk) end + if argv.sdk then + table.insert(config_argv, "--sdk=" .. argv.sdk) + end if argv.mingw then table.insert(config_argv, "--mingw=" .. argv.mingw) end