Browse Source

add libmng and devil (#606)

* update jasper

* add libmng

* add devil

* disable mingw
Hoildkv 4 years ago
parent
commit
7d88956cc7

+ 51 - 0
packages/d/devil/patches/1.8.0/jp2.patch

@@ -0,0 +1,51 @@
+diff --git a/DevIL/src-IL/src/il_jp2.cpp b/DevIL/src-IL/src/il_jp2.cpp
+--- a/DevIL/src-IL/src/il_jp2.cpp
++++ b/DevIL/src-IL/src/il_jp2.cpp
+@@ -313,20 +313,31 @@ ILboolean iLoadJp2Internal(jas_stream_t	*Stream, ILimage *Image)
+ }
+ 
+ 
+-
+-static int iJp2_file_read(jas_stream_obj_t *obj, char *buf, int cnt)
++#ifdef __APPLE__
++static int iJp2_file_read(void *obj, char *buf, unsigned int cnt)
++#else
++static int iJp2_file_read(jas_stream_obj_t *obj, char *buf, unsigned int cnt)
++#endif
+ {
+ 	obj;
+-	return iread(buf, 1, cnt);
++	return iread((void*)buf, 1, cnt);
+ }
+ 
+-static int iJp2_file_write(jas_stream_obj_t *obj, char *buf, int cnt)
++#ifdef __APPLE__
++static int iJp2_file_write(void *obj, const char *buf, unsigned int cnt)
++#else
++static int iJp2_file_write(jas_stream_obj_t *obj, const char *buf, unsigned int cnt)
++#endif
+ {
+ 	obj;
+ 	return iwrite(buf, 1, cnt);
+ }
+ 
++#ifdef __APPLE__
+ static long iJp2_file_seek(jas_stream_obj_t *obj, long offset, int origin)
++#else
++static long iJp2_file_seek(void *obj, long offset, int origin)
++#endif
+ {
+ 	obj;
+ 
+@@ -343,7 +354,11 @@ static long iJp2_file_seek(jas_stream_obj_t *obj, long offset, int origin)
+ 	return 0;  // Failed
+ }
+ 
++#ifdef __APPLE__
++static int iJp2_file_close(void *obj)
++#else
+ static int iJp2_file_close(jas_stream_obj_t *obj)
++#endif
+ {
+ 	obj;
+ 	return 0;  // We choose when we want to close the file.

+ 24 - 0
packages/d/devil/patches/1.8.0/static.patch

@@ -0,0 +1,24 @@
+diff --git a/DevIL/src-ILU/CMakeLists.txt b/DevIL/src-ILU/CMakeLists.txt
+--- a/DevIL/src-ILU/CMakeLists.txt
++++ b/DevIL/src-ILU/CMakeLists.txt
+@@ -43,7 +43,7 @@ source_group("Header Files" FILES ${ILU_INC} )
+ source_group("Resource Files" FILES ${ILU_RSRC} )
+ 
+ # Remove SHARED to create a static library
+-add_library(ILU SHARED ${ILU_SRCS} ${ILU_INC} ${ILU_RSRC})
++add_library(ILU ${ILU_SRCS} ${ILU_INC} ${ILU_RSRC})
+ 
+ 
+ ## ILU requires IL
+diff --git a/DevIL/src-ILUT/CMakeLists.txt b/DevIL/src-ILUT/CMakeLists.txt
+--- a/DevIL/src-ILUT/CMakeLists.txt
++++ b/DevIL/src-ILUT/CMakeLists.txt
+@@ -43,7 +43,7 @@ source_group("Header Files" FILES ${ILUT_INC} )
+ source_group("Resource Files" FILES ${ILUT_RSRC} )
+ 
+ # Remove SHARED to create a static library
+-add_library(ILUT SHARED ${ILUT_SRCS} ${ILUT_INC} ${ILUT_RSRC})
++add_library(ILUT ${ILUT_SRCS} ${ILUT_INC} ${ILUT_RSRC})
+ 
+ ## add link sub library info
+ target_link_libraries(ILUT

+ 51 - 0
packages/d/devil/xmake.lua

@@ -0,0 +1,51 @@
+package("devil")
+
+    set_homepage("https://sourceforge.net/projects/openil/")
+    set_description("Developer's Image Library (DevIL) is a cross-platform image library utilizing a simple syntax to load, save, convert, manipulate, filter and display a variety of images with ease.")
+    set_license("LGPL-2.1")
+
+    add_urls("https://sourceforge.net/projects/openil/files/DevIL/$(version)/DevIL-$(version).zip")
+    add_versions("1.8.0", "451337f392c65bfb83698a781370534dc63d7bafca21e9b37178df0518f7e895")
+
+    add_patches("1.8.0", path.join(os.scriptdir(), "patches", "1.8.0", "jp2.patch"), "cbee7e2a42b1a687fe7a2e6397611088fc2c16f897076e39db4a2be87fba5c51")
+    add_patches("1.8.0", path.join(os.scriptdir(), "patches", "1.8.0", "static.patch"), "28a4fc42e9cc735a3291d87a1cb818ea9ed07f27afa2b52353d5a1d15fc8a6f5")
+
+    add_deps("cmake")
+    local configdepopts = {png     = {"libpng", "PNG"},
+                           tiff    = {"libtiff", "TIFF"},
+                           jpeg    = {"libjpeg-turbo", "JPEG"},
+                           jasper  = {"jasper", "Jasper"},
+                           squish  = {"libsquish", "libSquish"},
+                           openexr = {"openexr", "OpenEXR"},
+                           lcms    = {"lcms", "LCMS2"},
+                           mng     = {"libmng", "MNG"}}
+    for config, depopt in pairs(configdepopts) do
+        add_configs(config, {description = "Build with " .. depopt[2] .. " support.", default = true, type = "boolean"})
+    end
+
+    on_load("windows", "macosx", "linux", function (package)
+        if package:is_plat("windows") and not package:config("shared") then
+            package:add("defines", "IL_STATIC_LIB")
+        end
+        for config, depopt in pairs(configdepopts) do
+            if package:config(config) then
+                package:add("deps", depopt[1])
+            end
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        os.cd("DevIL")
+        local configs = {"-DIL_USE_DXTC_NVIDIA=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"))
+        for config, depopt in pairs(configdepopts) do
+            table.insert(configs, "-DCMAKE_DISABLE_FIND_PACKAGE_" .. depopt[2] .. "=" .. (package:config(config) and "OFF" or "ON"))
+        end
+        import("package.tools.cmake").install(package, configs)
+        print(os.files(package:installdir("**")))
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("ilInit", {includes = "IL/il.h"}))
+    end)

+ 11 - 4
packages/j/jasper/xmake.lua

@@ -7,11 +7,17 @@ package("jasper")
     add_urls("https://github.com/jasper-software/jasper/archive/refs/tags/version-$(version).tar.gz")
     add_urls("https://github.com/jasper-software/jasper/archive/refs/tags/version-$(version).tar.gz")
     add_versions("2.0.28", "6b4e5f682be0ab1a5acb0eeb6bf41d6ce17a658bb8e2dbda95de40100939cc88")
     add_versions("2.0.28", "6b4e5f682be0ab1a5acb0eeb6bf41d6ce17a658bb8e2dbda95de40100939cc88")
     add_versions("2.0.32", "a3583a06698a6d6106f2fc413aa42d65d86bedf9a988d60e5cfa38bf72bc64b9")
     add_versions("2.0.32", "a3583a06698a6d6106f2fc413aa42d65d86bedf9a988d60e5cfa38bf72bc64b9")
+    add_versions("2.0.33", "38b8f74565ee9e7fec44657e69adb5c9b2a966ca5947ced5717cde18a7d2eca6")
+
+    add_configs("opengl", {description = "Enable the use of the OpenGL/GLUT Library.", default = false, type = "boolean"})
+
+    add_deps("cmake", "libjpeg-turbo")
+    on_load("windows", "macosx", "linux", function (package)
+        if package:config("opengl") then
+            package:add("deps", "freeglut")
+        end
+    end)
 
 
-    add_deps("cmake", "libjpeg")
-    if not is_plat("macosx") then
-        add_deps("freeglut")
-    end
     on_install("windows", "macosx", "linux", function (package)
     on_install("windows", "macosx", "linux", function (package)
         io.replace("build/cmake/modules/JasOpenGL.cmake", "find_package(GLUT", "find_package(FreeGLUT", {plain = true})
         io.replace("build/cmake/modules/JasOpenGL.cmake", "find_package(GLUT", "find_package(FreeGLUT", {plain = true})
         local configs = {"-DJAS_ENABLE_PROGRAMS=OFF", "-DJAS_ENABLE_DOC=OFF"}
         local configs = {"-DJAS_ENABLE_PROGRAMS=OFF", "-DJAS_ENABLE_DOC=OFF"}
@@ -24,6 +30,7 @@ package("jasper")
         end
         end
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DJAS_ENABLE_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DJAS_ENABLE_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DJAS_ENABLE_OPENGL=" .. (package:config("opengl") and "ON" or "OFF"))
         if package:config("pic") ~= false then
         if package:config("pic") ~= false then
             table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
             table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
         end
         end

+ 1 - 0
packages/l/libjpeg-turbo/xmake.lua

@@ -10,6 +10,7 @@ package("libjpeg-turbo")
     add_versions("2.0.6",  "005aee2fcdca252cee42271f7f90574dda64ca6505d9f8b86ae61abc2b426371")
     add_versions("2.0.6",  "005aee2fcdca252cee42271f7f90574dda64ca6505d9f8b86ae61abc2b426371")
     add_versions("2.0.90", "6a965adb02ad898b2ae48214244618fe342baea79db97157fdc70d8844ac6f09")
     add_versions("2.0.90", "6a965adb02ad898b2ae48214244618fe342baea79db97157fdc70d8844ac6f09")
     add_versions("2.1.0",  "d6b7790927d658108dfd3bee2f0c66a2924c51ee7f9dc930f62c452f4a638c52")
     add_versions("2.1.0",  "d6b7790927d658108dfd3bee2f0c66a2924c51ee7f9dc930f62c452f4a638c52")
+    add_versions("2.1.1", "20e9cd3e5f517950dfb7a300ad344543d88719c254407ffb5ad88d891bf701c4")
 
 
     add_configs("jpeg", {description = "libjpeg API/ABI emulation target version.", default = "6", type = "string", values = {"6", "7", "8"}})
     add_configs("jpeg", {description = "libjpeg API/ABI emulation target version.", default = "6", type = "string", values = {"6", "7", "8"}})
 
 

+ 29 - 0
packages/l/libmng/xmake.lua

@@ -0,0 +1,29 @@
+package("libmng")
+
+    set_homepage("https://libmng.com/")
+    set_description("libmng - The reference library for reading, displaying, writing and examining Multiple-Image Network Graphics.")
+
+    add_urls("https://sourceforge.net/projects/libmng/files/libmng-devel/$(version)/libmng-$(version).tar.gz")
+    add_versions("2.0.3", "cf112a1fb02f5b1c0fce5cab11ea8243852c139e669c44014125874b14b7dfaa")
+
+    add_deps("cmake")
+    add_deps("zlib", "libjpeg-turbo", "lcms 2.x")
+    on_load("windows", function (package)
+        if package:config("shared") then
+            package:add("defines", "MNG_USE_DLL")
+        end
+        package:add("defines", "WIN32")
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        os.rm("config.h")
+        local configs = {"-DMNG_INSTALL_LIB_DIR=lib"}
+        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"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("mng_initialize", {includes = "libmng.h"}))
+    end)