Browse Source

fix libpng and zlib (#266)

ruki 4 years ago
parent
commit
adb300acba
3 changed files with 6 additions and 2 deletions
  1. 1 1
      .github/workflows/cross_musl.yml
  2. 3 1
      packages/l/libpng/xmake.lua
  3. 2 0
      packages/z/zlib/xmake.lua

+ 1 - 1
.github/workflows/cross_musl.yml

@@ -26,5 +26,5 @@ jobs:
 
 
       - name: Tests
       - name: Tests
         run: |
         run: |
-          xmake l ./scripts/test.lua -D -p cross --toolchain=musl --sdk=`pwd`/${{ matrix.cross }}-cross
+          xmake l ./scripts/test.lua -D -p cross --toolchain=muslcc --sdk=`pwd`/${{ matrix.cross }}-cross
 
 

+ 3 - 1
packages/l/libpng/xmake.lua

@@ -18,7 +18,7 @@ package("libpng")
             add_requires("zlib")
             add_requires("zlib")
             target("png")
             target("png")
                 set_kind("$(kind)")
                 set_kind("$(kind)")
-                add_files("*.c")
+                add_files("*.c|example.c")
                 if is_arch("x86", "x64", "i386", "x86_64") then
                 if is_arch("x86", "x64", "i386", "x86_64") then
                     add_files("intel/*.c")
                     add_files("intel/*.c")
                     add_defines("PNG_INTEL_SSE_OPT=1")
                     add_defines("PNG_INTEL_SSE_OPT=1")
@@ -42,6 +42,8 @@ package("libpng")
         local configs = {}
         local configs = {}
         if package:config("shared") then
         if package:config("shared") then
             configs.kind = "shared"
             configs.kind = "shared"
+        elseif not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
+            configs.cxflags = "-fPIC"
         end
         end
         os.cp("scripts/pnglibconf.h.prebuilt", "pnglibconf.h")
         os.cp("scripts/pnglibconf.h.prebuilt", "pnglibconf.h")
         import("package.tools.xmake").install(package, configs)
         import("package.tools.xmake").install(package, configs)

+ 2 - 0
packages/z/zlib/xmake.lua

@@ -50,6 +50,8 @@ package("zlib")
         local configs = {}
         local configs = {}
         if package:config("shared") then
         if package:config("shared") then
             configs.kind = "shared"
             configs.kind = "shared"
+        elseif not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
+            configs.cxflags = "-fPIC"
         end
         end
         import("package.tools.xmake").install(package, configs)
         import("package.tools.xmake").install(package, configs)
     end)
     end)