Parcourir la source

add redex (#1290)

* add redex

* add redex

* Update xmake.lua

* add boost 1.71.0

* add jsoncpp for redex

* improve redex

* improve redex

* update redex

* Update xmake.lua

* update redex

* fix error

* fix error

* improve shared

* disable shared

* fix shared

* add python

* Update xmake.lua

* Update xmake.lua

* improve ci
ruki il y a 3 ans
Parent
commit
cc98eec4b6
2 fichiers modifiés avec 46 ajouts et 0 suppressions
  1. 1 0
      .github/workflows/fedora.yml
  2. 45 0
      packages/r/redex/xmake.lua

+ 1 - 0
.github/workflows/fedora.yml

@@ -28,6 +28,7 @@ jobs:
           dnf -y install copr-cli make gcc-c++ libatomic
           dnf -y upgrade git
           dnf -y install perl
+          dnf -y install glibc-static libstdc++-static
           git config --global --add safe.directory /__w/xmake-repo/xmake-repo
       - uses: actions/checkout@v1
       - uses: xmake-io/github-action-setup-xmake@v1

+ 45 - 0
packages/r/redex/xmake.lua

@@ -0,0 +1,45 @@
+package("redex")
+    set_homepage("https://fbredex.com/")
+    set_description("A bytecode optimizer for Android apps")
+    set_license("MIT")
+
+    add_urls("https://github.com/facebook/redex.git")
+    add_versions("2022.6.23", "802e428923e15b36993106685798e33d64f3e057")
+
+    add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+
+    add_deps("cmake")
+    add_deps("python 3.x", {kind = "binary"})
+    add_deps("boost", {configs = {
+        system = true,
+        regex = true,
+        thread = true,
+        iostreams = true,
+        program_options = true}})
+    add_deps("jsoncpp", "zlib")
+
+    add_includedirs("include/redex/libredex",
+                    "include/redex/libresource",
+                    "include/redex/shared",
+                    "include/redex/sparta",
+                    "include/redex/tools",
+                    "include/redex/util",
+                    "include/redex/service")
+
+    on_install("linux", "macosx", function (package)
+        -- fix find boost issue, @see https://github.com/microsoft/vcpkg/issues/5936
+        local configs = {"-DBoost_NO_BOOST_CMAKE=ON"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_TYPE=" .. (package:config("shared") and "Shared" or "Static"))
+        if not package:config("shared") then
+            local jsoncpp = package:dep("jsoncpp"):fetch()
+            if jsoncpp and jsoncpp.libfiles then
+                table.insert(configs, "-DJSONCPP_LIBRARY_STATIC=" .. table.unwrap(jsoncpp.libfiles):gsub("\\", "/"))
+            end
+        end
+        import("package.tools.cmake").install(package, configs, {packagedeps = "jsoncpp"})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxtypes("DexLoader", {includes = "DexLoader.h", configs = {languages = "c++17"}}))
+    end)