Browse Source

leveldb: add more platform support (#7730)

star9029 1 month ago
parent
commit
4bcf99e416
1 changed files with 10 additions and 6 deletions
  1. 10 6
      packages/l/leveldb/xmake.lua

+ 10 - 6
packages/l/leveldb/xmake.lua

@@ -1,11 +1,11 @@
 package("leveldb")
-
     set_homepage("https://github.com/google/leveldb")
     set_description("LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.")
     set_license("BSD-3-Clause")
 
-    add_urls("https://github.com/google/leveldb/archive/$(version).tar.gz",
-             "https://github.com/google/leveldb.git")
+    add_urls("https://github.com/google/leveldb/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/google/leveldb.git", {submodules = false})
+
     add_versions("1.22", "55423cac9e3306f4a9502c738a001e4a339d1a38ffbee7572d4a07d5d63949b2")
     add_versions("1.23", "9a37f8a6174f09bd622bc723b55881dc541cd50747cbd08831c2a82d620f6d76")
 
@@ -14,13 +14,17 @@ package("leveldb")
 
     add_deps("cmake")
     add_deps("snappy")
-    if is_plat("linux") then
+    if is_plat("linux", "bsd") then
         add_syslinks("pthread")
     end
 
-    on_install("macosx", "linux", "windows", "mingw", function (package)
+    on_install(function (package)
+        if package:config("shared") then
+            package:add("defines", "LEVELDB_SHARED_LIBRARY")
+        end
+
         local configs = {"-DLEVELDB_BUILD_TESTS=OFF", "-DLEVELDB_BUILD_BENCHMARKS=OFF"}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_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)