Hoildkv 4 anos atrás
pai
commit
3866b45897
2 arquivos alterados com 123 adições e 0 exclusões
  1. 72 0
      packages/l/libgd/patches/2.3.2/build.patch
  2. 51 0
      packages/l/libgd/xmake.lua

+ 72 - 0
packages/l/libgd/patches/2.3.2/build.patch

@@ -0,0 +1,72 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 57cd95d..67c703a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -280,8 +280,10 @@ else (USE_EXT_GD)
+ 	add_subdirectory(src)
+ endif (USE_EXT_GD)
+ 
++if(BUILD_TEST)
+ add_subdirectory(tests)
+ add_subdirectory(examples)
++endif()
+ 
+ add_custom_target(distclean ${GD_SOURCE_DIR}/cmake/distclean.sh)
+ 
+@@ -299,6 +301,7 @@ else(WIN32)
+ endif(WIN32)
+ 
+ 
++if (BUILD_DOCS)
+ INSTALL(FILES docs/INSTALL DESTINATION share/doc/gd-${GDLIB_MAJOR}.${GDLIB_MINOR})
+ INSTALL(FILES docs/README.JPN DESTINATION share/doc/gd-${GDLIB_MAJOR}.${GDLIB_MINOR})
+ INSTALL(FILES docs/README.CMAKE DESTINATION share/doc/gd-${GDLIB_MAJOR}.${GDLIB_MINOR})
+@@ -320,6 +323,7 @@ INSTALL(FILES examples/test_crop_threshold.png DESTINATION share/doc/gd-${GDLIB_
+ INSTALL(FILES examples/tgaread.c DESTINATION share/doc/gd-${GDLIB_MAJOR}.${GDLIB_MINOR})
+ INSTALL(FILES examples/tiffread.c DESTINATION share/doc/gd-${GDLIB_MAJOR}.${GDLIB_MINOR})
+ INSTALL(FILES examples/windows.c DESTINATION share/doc/gd-${GDLIB_MAJOR}.${GDLIB_MINOR})
++endif()
+ 
+ 
+ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 509c422..45c27f4 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -98,7 +98,7 @@ if (BUILD_STATIC_LIBS)
+ 	endif()
+ endif()
+ 
+-if (NOT "${GD_PROGRAMS_LIB_SRC_FILES}" STREQUAL "")
++if (BUILD_PROGRAMS AND NOT "${GD_PROGRAMS_LIB_SRC_FILES}" STREQUAL "")
+ 	add_library(gd_programs_lib STATIC ${GD_PROGRAMS_LIB_SRC_FILES})
+ endif()
+ 
+@@ -148,6 +148,7 @@ SET(LIBS_PRIVATES
+ 	${WEBP_LIBRARIES}
+ )
+ 
++if (BUILD_PROGRAMS)
+ set(GD_PROGRAMS gdcmpgif)
+ 
+ if (PNG_FOUND)
+@@ -178,6 +179,9 @@ foreach(program ${GD_PROGRAMS})
+ endforeach(program)
+ 
+ set(GD_INSTALL_TARGETS ${GD_PROGRAMS})
++else ()
++set(GD_INSTALL_TARGETS )
++endif ()
+ if (BUILD_SHARED_LIBS)
+ 	set(GD_INSTALL_TARGETS ${GD_INSTALL_TARGETS} ${GD_LIB})
+ endif()
+@@ -189,7 +193,9 @@ install(TARGETS ${GD_INSTALL_TARGETS}
+         RUNTIME DESTINATION bin
+         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
++if (UNIX)
+ install(PROGRAMS bdftogd DESTINATION bin)
++endif ()
+ install(FILES
+ 	entities.h
+ 	gd.h

+ 51 - 0
packages/l/libgd/xmake.lua

@@ -0,0 +1,51 @@
+package("libgd")
+
+    set_homepage("http://libgd.org/")
+    set_description("GD is an open source code library for the dynamic creation of images by programmers.")
+
+    add_urls("https://github.com/libgd/libgd/archive/refs/tags/gd-$(version).tar.gz")
+    add_versions("2.3.2", "dcc22244d775f469bee21dce1ea42552adbb72ba0cc423f9fa6a64601b3a1893")
+
+    add_patches("2.3.2", path.join(os.scriptdir(), "patches", "2.3.2", "build.patch"), "87ae73df7ce126f8b31e1988aae3ecf0638eeb1c0a085689bd82045704c8171c")
+
+    local configdeps = {png      = "libpng",
+                        liq      = "libimagequant",
+                        jpeg     = "libjpeg-turbo",
+                        tiff     = "libtiff",
+                        freetype = "freetype",
+                        webp     = "libwebp",
+                        avif     = "libavif",
+                        heif     = "libheif"}
+    for conf, _ in pairs(configdeps) do
+        add_configs(conf, {description = "Enable " .. conf .. " support.", default = (conf == "png"), type = "boolean"})
+    end
+
+    add_deps("cmake", "zlib")
+    on_load("windows", "linux", "macosx", function (package)
+        for conf, dep in pairs(configdeps) do
+            if package:config(conf) then
+                package:add("deps", dep)
+            end
+        end
+        if package:is_plat("windows") and not package:config("shared") then
+            package:add("defines", "BGDWIN32")
+            package:add("defines", "NONDLL")
+        end
+    end)
+
+    on_install("windows", "linux", "macosx", function (package)
+        local configs = {"-DBUILD_TEST=OFF", "-DBUILD_PROGRAMS=OFF", "-DBUILD_DOCS=OFF", "-DBUILD_EXAMPLES=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
+        for conf, dep in pairs(configdeps) do
+            if package:config(conf) then
+                table.insert(configs, "-DENABLE_" .. conf:upper() .. "=ON")
+            end
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("gdImageDestroy", {includes = "gd.h"}))
+    end)