Răsfoiți Sursa

cppp-reiconv: fix install (#4451)

star9029 1 an în urmă
părinte
comite
570c9dfab7

+ 49 - 0
packages/c/cppp-reiconv/patches/2.1.0/cmake.patch

@@ -0,0 +1,49 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6d3c761..0689164 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -48,7 +48,7 @@ if(MSVC)
+ endif()
+ 
+ # Generate header file for build
+-if(WIN32)
++if(WIN32 AND BUILD_SHARED_LIBS)
+     set(DLL_VARIABLE "__declspec(dllexport)")
+ elseif(HAVE_VISIBILITY)
+     set(DLL_VARIABLE "__attribute__((__visibility__(\"default\")))")
+@@ -59,7 +59,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/cppp/reiconv.hpp.in" "${outp
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/windows/libcppp-reiconv.rc.in" "${CMAKE_BINARY_DIR}/windows/libcppp-reiconv.rc")
+ 
+ # Generate header file for install
+-if(WIN32)
++if(WIN32 AND BUILD_SHARED_LIBS)
+     set(DLL_VARIABLE "__declspec(dllimport)")
+ else()
+     set(DLL_VARIABLE "")
+@@ -83,7 +83,7 @@ cppp_build_library(${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/lib/iconv.cpp" T
+ 
+ # Include test suite.
+ include("tests/tests.cmake")
+-
++if (NOT BUILD_SHARED_LIBS)
+ # Install
+ # Static
+ # PERMISSIONS 0644
+@@ -94,7 +94,7 @@ install(TARGETS libcppp-reiconv.static
+         ARCHIVE DESTINATION "${install_staticdir}"
+         RUNTIME DESTINATION "${install_bindir}"
+         INCLUDES DESTINATION "${install_includedir}" )
+-
++else()
+ # Shared
+ # PERMISSIONS 0755
+ install(TARGETS libcppp-reiconv.shared
+@@ -105,7 +105,7 @@ install(TARGETS libcppp-reiconv.shared
+         ARCHIVE DESTINATION "${install_staticdir}"
+         RUNTIME DESTINATION "${install_bindir}"
+         INCLUDES DESTINATION "${install_includedir}" )
+-
++endif()
+ # Includes
+ # install includes
+ # PERMISSIONS 0644

+ 19 - 19
packages/c/cppp-reiconv/xmake.lua

@@ -1,39 +1,39 @@
 package("cppp-reiconv")
 package("cppp-reiconv")
-
     set_homepage("https://github.com/cppp-project/cppp-reiconv")
     set_homepage("https://github.com/cppp-project/cppp-reiconv")
     set_description("A character set conversion library based on GNU LIBICONV.")
     set_description("A character set conversion library based on GNU LIBICONV.")
+    set_license("LGPL-3.0")
 
 
-    add_urls("https://github.com/cppp-project/cppp-reiconv/releases/download/$(version)/cppp-reiconv-$(version).zip")
+    add_urls("https://github.com/cppp-project/cppp-reiconv/releases/download/$(version)/cppp-reiconv-$(version).zip",
+             "https://github.com/cppp-project/cppp-reiconv.git")
 
 
     add_versions("v2.1.0", "3e539785a437843793c5ce2f8a72cb08f2b543cba11635b06db25cfc6d9cc3a4")
     add_versions("v2.1.0", "3e539785a437843793c5ce2f8a72cb08f2b543cba11635b06db25cfc6d9cc3a4")
 
 
+    add_patches("2.1.0", "patches/2.1.0/cmake.patch", "21bd2fcb5874f8774af1360aaac51073b67bf4c754096f0fe162d66632c1b7f9")
+
     add_deps("cmake", "python")
     add_deps("cmake", "python")
 
 
     on_install(function (package)
     on_install(function (package)
-        local configs = {}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        local configs = {"-DENABLE_TEST=OFF", "-DENABLE_EXTRA=ON"}
+        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"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
-        table.insert(configs, "-DENABLE_EXTRA=ON")
-        table.insert(configs, "-DENABLE_TEST=OFF")
         import("package.tools.cmake").install(package, configs)
         import("package.tools.cmake").install(package, configs)
     end)
     end)
 
 
     on_test(function (package)
     on_test(function (package)
         assert(package:check_cxxsnippets({test = [[
         assert(package:check_cxxsnippets({test = [[
-        #include <cppp/reiconv.hpp>
-        #include <iostream>
-        #include <cstdlib>
-        using namespace cppp::base::reiconv;
+            #include <cppp/reiconv.hpp>
+            #include <iostream>
+            #include <cstdlib>
+            using namespace cppp::base::reiconv;
 
 
-        void test()
-        {
-            iconv_t cd = iconv_open("UTF-8", "UTF-8");
-            if (cd == (iconv_t)(-1))
+            void test()
             {
             {
-                abort();
+                iconv_t cd = iconv_open("UTF-8", "UTF-8");
+                if (cd == (iconv_t)(-1))
+                {
+                    abort();
+                }
+                iconv_close(cd);
             }
             }
-            iconv_close(cd);
-        }
-    ]]}, {configs = {languages = "c++14"}}))
+        ]]}, {configs = {languages = "c++14"}}))
     end)
     end)
-