Skip to content

Commit bf00cf9

Browse files
committed
Use pkg-config instead of mapnik-config.
1 parent 10315a6 commit bf00cf9

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

setup.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,21 @@
66
import subprocess
77
import os
88

9-
mapnik_config = 'mapnik-config'
10-
119
def check_output(args):
1210
output = subprocess.check_output(args).decode()
1311
return output.rstrip('\n')
1412

1513
linkflags = []
16-
lib_path = os.path.join(check_output([mapnik_config, '--prefix']),'lib')
17-
linkflags.extend(check_output([mapnik_config, '--libs']).split(' '))
18-
linkflags.extend(check_output([mapnik_config, '--ldflags']).split(' '))
19-
linkflags.extend(check_output([mapnik_config, '--dep-libs']).split(' '))
20-
linkflags.extend([
21-
'-lmapnik-wkt',
22-
'-lmapnik-json',
23-
])
14+
lib_path = os.path.join(check_output(['pkg-config', '--variable=prefix', 'libmapnik']),'lib')
15+
linkflags.extend(check_output(['pkg-config', '--libs', 'libmapnik']).split(' '))
2416

2517
# Dynamically make the mapnik/paths.py file
2618
f_paths = open('packaging/mapnik/paths.py', 'w')
2719
f_paths.write('import os\n')
2820
f_paths.write('\n')
2921

30-
input_plugin_path = check_output([mapnik_config, '--input-plugins'])
31-
font_path = check_output([mapnik_config, '--fonts'])
22+
input_plugin_path = check_output(['pkg-config', '--variable=plugins_dir', 'libmapnik'])
23+
font_path = check_output(['pkg-config', '--variable=fonts_dir', 'libmapnik'])
3224

3325
if os.environ.get('LIB_DIR_NAME'):
3426
mapnik_lib_path = lib_path + os.environ.get('LIB_DIR_NAME')
@@ -43,7 +35,7 @@ def check_output(args):
4335
"__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n")
4436
f_paths.close()
4537

46-
extra_comp_args = check_output([mapnik_config, '--cflags']).split(' ')
38+
extra_comp_args = check_output(['pkg-config', '--cflags', 'libmapnik']).split(' ')
4739
extra_comp_args = list(filter(lambda arg: arg != "-fvisibility=hidden", extra_comp_args))
4840

4941
if sys.platform == 'darwin':
@@ -53,6 +45,8 @@ def check_output(args):
5345
linkflags.append('-Wl,-z,origin')
5446
linkflags.append('-Wl,-rpath=$ORIGIN/lib')
5547

48+
extra_comp_args = list(filter(lambda arg: arg != "", extra_comp_args))
49+
linkflags = list(filter(lambda arg: arg != "", linkflags))
5650

5751
ext_modules = [
5852
Pybind11Extension(
@@ -112,9 +106,9 @@ def check_output(args):
112106
]
113107

114108
if os.environ.get("CC", False) == False:
115-
os.environ["CC"] = check_output([mapnik_config, '--cxx'])
109+
os.environ["CC"] = 'c++'
116110
if os.environ.get("CXX", False) == False:
117-
os.environ["CXX"] = check_output([mapnik_config, '--cxx'])
111+
os.environ["CXX"] = 'c++'
118112

119113
setup(
120114
name="mapnik",

0 commit comments

Comments
 (0)