File tree Expand file tree Collapse file tree 4 files changed +31
-5
lines changed
Filter options
Expand file tree Collapse file tree 4 files changed +31
-5
lines changed
Original file line number Diff line number Diff line change @@ -76,8 +76,8 @@ install:
76
76
# Let the install prefer the static builds of the libs
77
77
- set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib
78
78
- mkdir lib || cmd /c "exit /b 0"
79
- - copy /y %LIBRARY_LIB%\zlibstatic.lib lib\z .lib
80
- - copy /y %LIBRARY_LIB%\libpng_static.lib lib\png .lib
79
+ - copy /y %LIBRARY_LIB%\zlibstatic.lib lib\zlib .lib
80
+ - copy /y %LIBRARY_LIB%\libpng_static.lib lib\libpng .lib
81
81
# These z.lib / png.lib are not static versions but files which end up as
82
82
# dependencies to the dll file. This is fine for the conda build, but not here
83
83
# and for the wheels
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ IF NOT DEFINED CONDA_PREFIX (
20
20
:: copy the libs which have "wrong" names
21
21
set LIBRARY_LIB = %CONDA_PREFIX% \Library\lib
22
22
mkdir lib || cmd /c " exit /b 0"
23
- copy %LIBRARY_LIB% \zlibstatic.lib lib\z .lib
24
- copy %LIBRARY_LIB% \libpng_static.lib lib\png .lib
23
+ copy %LIBRARY_LIB% \zlibstatic.lib lib\zlib .lib
24
+ copy %LIBRARY_LIB% \libpng_static.lib lib\libpng .lib
25
25
26
26
:: Make the header files and the rest of the static libs available during the build
27
27
:: CONDA_PREFIX is a env variable which is set to the currently active environment path
Original file line number Diff line number Diff line change
1
+ Changes to the Windows build
2
+ ````````````````````````````
3
+
4
+ Previously, when building the :mod: `matplotlib._png ` extension, the build
5
+ script would add "png" and "z" to the extensions ``.libraries `` attribute (if
6
+ pkg-config information is not available, which is in particular the case on
7
+ Windows).
8
+
9
+ In particular, this implies that the Windows build would look up files named
10
+ ``png.lib `` and ``z.lib ``; but neither libpng upstream nor zlib upstream
11
+ provides these files by default. (On Linux, this would look up ``libpng.so ``
12
+ and ``libz.so ``, which are indeed standard names.)
13
+
14
+ Instead, on Windows, we now look up ``libpng16.lib `` and ``zlib.lib ``, which
15
+ *are * the upstream names for the shared libraries (as of libpng 1.6.x).
16
+
17
+ For a statically-linked build, the upstream names are ``libpng16_static.lib ``
18
+ and ``zlibstatic.lib ``; one still needs to manually rename them if such a build
19
+ is desired.
Original file line number Diff line number Diff line change @@ -1022,7 +1022,14 @@ def get_extension(self):
1022
1022
]
1023
1023
ext = make_extension ('matplotlib._png' , sources )
1024
1024
pkg_config .setup_extension (
1025
- ext , 'libpng' , default_libraries = ['png' , 'z' ],
1025
+ ext , 'libpng' ,
1026
+ default_libraries = (
1027
+ ['png' , 'z' ] if os .name == 'posix' else
1028
+ # libpng upstream names their lib libpng16.lib, not png.lib.
1029
+ # zlib upstream names their lib zlib.lib, not z.lib.
1030
+ ['libpng16' , 'zlib' ] if os .name == 'nt' else
1031
+ []
1032
+ ),
1026
1033
alt_exec = 'libpng-config --ldflags' )
1027
1034
Numpy ().add_flags (ext )
1028
1035
return ext
You can’t perform that action at this time.
0 commit comments