Browse Source

Merge pull request #1 from xmake-io/dev

Hoildkv 4 years ago
parent
commit
e2052912a6

+ 30 - 0
.github/workflows/cross_musl.yml

@@ -0,0 +1,30 @@
+name: Cross (Musl)
+
+on:
+  pull_request:
+  push:
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+        cross: [arm-linux-musleabi, aarch64-linux-musl]
+
+    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.cross }}-cross.tgz
+          tar -xvf ${{ matrix.cross }}-cross.tgz
+
+      - name: Tests
+        run: |
+          xmake l ./scripts/test.lua -D -p cross --sdk=`pwd`/${{ matrix.cross }}-cross
+

+ 19 - 2
packages/o/openssl/xmake.lua

@@ -14,10 +14,27 @@ package("openssl")
     add_versions("github:1.0.2", "b61942861405c634f86ca2b8dd1a34687e24b5036598d0fa971fac02405fdb1a")
     add_versions("github:1.0.2", "b61942861405c634f86ca2b8dd1a34687e24b5036598d0fa971fac02405fdb1a")
     add_versions("github:1.0.0", "9b67e5ad1a4234c1170ada75b66321e914da4f3ebaeaef6b28400173aaa6b378")
     add_versions("github:1.0.0", "9b67e5ad1a4234c1170ada75b66321e914da4f3ebaeaef6b28400173aaa6b378")
 
 
+    add_links("ssl", "crypto")
+
     on_install("linux", "macosx", function (package)
     on_install("linux", "macosx", function (package)
         os.vrun("./config %s --prefix=\"%s\"", package:debug() and "--debug" or "", package:installdir())
         os.vrun("./config %s --prefix=\"%s\"", package:debug() and "--debug" or "", package:installdir())
-        os.vrun("make -j4")
-        os.vrun("make install")
+        import("package.tools.make").install(package)
+    end)
+
+    on_install("cross", function (package)
+        local target = "linux-generic32"
+        if package:is_os("linux") then
+            if package:is_arch("arm64") then
+                target = "linux-aarch64"
+            else
+                target = "linux-armv4"
+            end
+        end
+        local configs = {target, "-DOPENSSL_NO_HEARTBEATS", "no-shared", "no-threads", "--prefix=" .. package:installdir()}
+        local buildenvs = import("package.tools.autoconf").buildenvs(package)
+        os.vrunv("./Configure", configs, {envs = buildenvs})
+        local makeconfigs = {CFLAGS = buildenvs.CFLAGS, ASFLAGS = buildenvs.ASFLAGS}
+        import("package.tools.make").install(package, makeconfigs)
     end)
     end)
 
 
     on_test(function (package)
     on_test(function (package)

+ 1 - 1
packages/z/zlib/xmake.lua

@@ -30,7 +30,7 @@ package("zlib")
         import("package.tools.autoconf").install(package, {"--static"})
         import("package.tools.autoconf").install(package, {"--static"})
     end)
     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"})
         import("package.tools.autoconf").configure(package, {host = "", "--static"})
         io.gsub("Makefile", "\nAR=.-\n",      "\nAR=" .. (package:build_getenv("ar") or "") .. "\n")
         io.gsub("Makefile", "\nAR=.-\n",      "\nAR=" .. (package:build_getenv("ar") or "") .. "\n")
         io.gsub("Makefile", "\nARFLAGS=.-\n", "\nARFLAGS=cr\n")
         io.gsub("Makefile", "\nARFLAGS=.-\n", "\nARFLAGS=cr\n")

+ 1 - 1
scripts/packages.lua

@@ -60,7 +60,7 @@ function main(opt)
         local packagefile = path.join(packagedir, "xmake.lua")
         local packagefile = path.join(packagedir, "xmake.lua")
         local instance = package.load_from_repository(packagename, nil, packagedir, packagefile)
         local instance = package.load_from_repository(packagename, nil, packagedir, packagefile)
         if instance then
         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)
                 local archs = platform.archs(plat)
                 if archs then
                 if archs then
                     local package_archs = {}
                     local package_archs = {}

+ 17 - 13
scripts/test.lua

@@ -6,19 +6,20 @@ import("packages", {alias = "get_packages"})
 -- the options
 -- the options
 local 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
 -- require packages
@@ -42,6 +43,9 @@ function _require_packages(argv, packages)
     if argv.ndk then
     if argv.ndk then
         table.insert(config_argv, "--ndk=" .. argv.ndk)
         table.insert(config_argv, "--ndk=" .. argv.ndk)
     end
     end
+    if argv.sdk then
+        table.insert(config_argv, "--sdk=" .. argv.sdk)
+    end
     if argv.mingw then
     if argv.mingw then
         table.insert(config_argv, "--mingw=" .. argv.mingw)
         table.insert(config_argv, "--mingw=" .. argv.mingw)
     end
     end