Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b88d6b5

Browse filesBrowse files
authored
Merge pull request #13084 from anntzer/use-upstream-libpng-zlib-windows-names
BLD: When linking against libpng/zlib on Windows, use upstream lib names.
2 parents 121fbfc + d6aeade commit b88d6b5
Copy full SHA for b88d6b5

File tree

Expand file treeCollapse file tree

4 files changed

+30
-5
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+30
-5
lines changed

‎.appveyor.yml

Copy file name to clipboardExpand all lines: .appveyor.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ install:
7777
# Let the install prefer the static builds of the libs
7878
- set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib
7979
- mkdir lib || cmd /c "exit /b 0"
80-
- copy /y %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
81-
- copy /y %LIBRARY_LIB%\libpng_static.lib lib\png.lib
80+
- copy /y %LIBRARY_LIB%\zlibstatic.lib lib\zlib.lib
81+
- copy /y %LIBRARY_LIB%\libpng16_static.lib lib\libpng16.lib
8282
# These z.lib / png.lib are not static versions but files which end up as
8383
# dependencies to the dll file. This is fine for the conda build, but not here
8484
# and for the wheels

‎build_alllocal.cmd

Copy file name to clipboardExpand all lines: build_alllocal.cmd
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ IF NOT DEFINED CONDA_PREFIX (
2020
:: copy the libs which have "wrong" names
2121
set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib
2222
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%\libpng16_static.lib lib\libpng16.lib
2525

2626
:: build the target
2727
python setup.py %TARGET%
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.

‎setupext.py

Copy file name to clipboardExpand all lines: setupext.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,13 @@ def get_extension(self):
650650
ext, 'libpng',
651651
atleast_version='1.2',
652652
alt_exec=['libpng-config', '--ldflags'],
653-
default_libraries=['png', 'z'])
653+
default_libraries=(
654+
['png', 'z'] if os.name == 'posix' else
655+
# libpng upstream names their lib libpng16.lib, not png.lib.
656+
# zlib upstream names their lib zlib.lib, not z.lib.
657+
['libpng16', 'zlib'] if os.name == 'nt' else
658+
[]
659+
))
654660
add_numpy_flags(ext)
655661
return ext
656662

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.