Преглед на файлове

add apr@{linux, macosx, windows} (#1289)

* add apr

* win & linux to fix

* update for linux

* patch nmake

* temp save

* patch for linux

* support win

* test win

* remove win patch

* format

* specific shared for win

* format apr

* fix comment

* fix win

* rm unnecessary deps
yszhou2019 преди 3 години
родител
ревизия
1b3d4fa3d5
променени са 2 файла, в които са добавени 61 реда и са изтрити 0 реда
  1. 20 0
      packages/a/apr/patches/1.7.0/common.patch
  2. 41 0
      packages/a/apr/xmake.lua

+ 20 - 0
packages/a/apr/patches/1.7.0/common.patch

@@ -0,0 +1,20 @@
+diff --git a/build/apr_common.m4 b/build/apr_common.m4
+index f4e2dfd..6f5782e 100644
+--- a/build/apr_common.m4
++++ b/build/apr_common.m4
+@@ -504,13 +504,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
+    CFLAGS="$CFLAGS -Werror"
+  fi
+  AC_COMPILE_IFELSE(
+-  [AC_LANG_SOURCE(
+-   [#include "confdefs.h"
+-   ]
+-   [[$1]]
+-   [int main(int argc, const char *const *argv) {]
++  [AC_LANG_PROGRAM(
++   [[$1]],
+    [[$2]]
+-   [   return 0; }]
+   )], [CFLAGS=$apr_save_CFLAGS
+ $3],  [CFLAGS=$apr_save_CFLAGS
+ $4])

+ 41 - 0
packages/a/apr/xmake.lua

@@ -0,0 +1,41 @@
+package("apr")
+    set_homepage("https://github.com/apache/apr")
+    set_description("Mirror of Apache Portable Runtime")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/apache/apr/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/apache/apr.git")
+    add_versions("1.7.0", "a7e2c5e6d60f6c7b1611b31a2f914a3e58f44eded5b064f0bae43ff30b16a4e6")
+
+    if is_plat("linux") then
+        add_deps("libtool", "python")
+        add_patches("1.7.0", path.join(os.scriptdir(), "patches", "1.7.0", "common.patch"), "bbfef69c914ca1ab98a9d94fc4794958334ce5f47d8c08c05e0965a48a44c50d")
+    elseif is_plat("windows") then 
+        add_deps("cmake")
+    end
+    
+    on_install("linux", "macosx", function (package)
+        local configs = {}
+        if package:is_plat("linux") then 
+            os.vrunv("sh", {"./buildconf"})
+            io.replace("configure", "RM='$RM'", "RM='$RM -f'")
+        else
+            io.replace("configure.in", "pid_t_fmt='#error Can not determine the proper size for pid_t'", "pid_t_fmt='#define APR_PID_T_FMT \"d\"'")
+            os.vrunv("sh", {"./buildconf"})
+            table.insert(configs, "CFLAGS=-DAPR_IOVEC_DEFINED")
+        end
+        import("package.tools.autoconf").install(package, configs)
+        package:add("includedirs", "include/apr-1")
+    end)
+
+    on_install("windows", function (package)
+        local configs = {"-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")}
+        import("package.tools.cmake").install(package, configs)
+        if not package:config("shared") then 
+            os.rm(package:installdir("bin/*.dll"))
+        end
+    end)
+
+    on_test(function (package)
+        assert(package:has_cincludes("apr.h"))
+    end)