Skip to content

Commit 0ec8841

Browse files
committed
Tweak manylinux setup.
1 parent c8ba69c commit 0ec8841

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

setup.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
Environment variables:
66
77
MPLCAIRO_MANYLINUX
8-
If set, build a manylinux wheel: pkg-config is shimmed, pycairo is not
9-
declared as setup_requires, and libstdc++ is statically linked.
8+
If set, build a manylinux wheel: pycairo is not declared as setup_requires.
109
1110
MPLCAIRO_NO_UNITY_BUILD
1211
If set, compile the various cpp files separately, instead of as a single
@@ -44,16 +43,6 @@
4443

4544

4645
def get_pkgconfig(info, lib):
47-
if MANYLINUX:
48-
if info.startswith("--atleast-version"):
49-
if lib == "raqm":
50-
raise FileNotFoundError # Trigger the header download.
51-
else:
52-
return ""
53-
if info == "--cflags":
54-
return ["-static-libgcc", "-static-libstdc++",
55-
"-I/usr/include/cairo",
56-
"-I/usr/include/freetype2"]
5746
return shlex.split(subprocess.check_output(["pkg-config", info, lib],
5847
universal_newlines=True))
5948

@@ -126,8 +115,6 @@ def finalize_options(self):
126115
*get_pkgconfig("--cflags", "cairo"),
127116
]
128117
ext.extra_link_args += ["-flto"]
129-
if MANYLINUX:
130-
ext.extra_link_args += ["-static-libgcc", "-static-libstdc++"]
131118

132119
elif os.name == "nt":
133120
# Windows conda path for FreeType.

tools/build-manylinux-wheel.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ else
4040
cairo-1.17.2%2B17%2Bg52a7c79fd-2-x86_64.pkg.tar.xz
4141
fontconfig-2%3A2.13.91%2B24%2Bg75eadca-1-x86_64.pkg.tar.xz
4242
freetype2-2.10.1-1-x86_64.pkg.tar.xz
43+
libraqm-0.7.0-1-x86_64.pkg.tar.xz
4344
python-cairo-1.18.2-3-x86_64.pkg.tar.xz
4445
)
4546
for filename in "${filenames[@]}"; do
@@ -51,21 +52,26 @@ else
5152
(tar -C "$name" -xf - 2>/dev/null || true)
5253
mv "$name/usr/include/"* /usr/include
5354
done
54-
# Provide a shim to access pycairo's header.
55+
# Shim pkg-config.
56+
echo '#!/bin/sh' >/usr/bin/pkg-config
57+
chmod a+x /usr/bin/pkg-config
58+
# Shim access to pycairo's header.
5559
mv "$(find python-cairo -name py3cairo.h)" /usr/include
5660
)
5761

5862
for py_ver in $PY_VERS; do
5963
py_prefix=("/opt/python/cp${py_ver/./}-"*)
6064
tags="$(basename "$py_prefix")"
6165
echo "Building the wheel for Python $py_ver."
62-
# Provide a shim to access pycairo's header.
66+
# Shim access to pycairo's header.
6367
echo 'def get_include(): return "/dev/null"' \
6468
>"$py_prefix/lib/python$py_ver/site-packages/cairo.py"
6569
(
6670
cd /io/mplcairo
6771
# Force a rebuild of the extension.
68-
"$py_prefix/bin/python" setup.py bdist_wheel
72+
CFLAGS="-static-libgcc -static-libstdc++ -I/usr/include/cairo -I/usr/include/freetype2" \
73+
LDFLAGS="-static-libgcc -static-libstdc++" \
74+
"$py_prefix/bin/python" setup.py bdist_wheel
6975
mplcairo_version="$("$py_prefix/bin/python" setup.py --version)"
7076
for wheel in "dist/mplcairo-$mplcairo_version-$tags-"*".whl"; do
7177
AUDITWHEEL_PLAT= auditwheel -v repair -wdist "$wheel"

0 commit comments

Comments
 (0)