Skip to content

Commit 87ab8f3

Browse files
committed
Use pkg-config instead of mapnik-config.
1 parent 5ab32f0 commit 87ab8f3

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

setup.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,30 +107,23 @@ def run(self):
107107
if os.environ.get("MASON_BUILD", "false") == "true":
108108
# run bootstrap.sh to get mason builds
109109
subprocess.call(['./bootstrap.sh'])
110-
mapnik_config = 'mason_packages/.link/bin/mapnik-config'
111110
mason_build = True
112111
else:
113-
mapnik_config = 'mapnik-config'
114112
mason_build = False
115113

116114

117115
linkflags = []
118-
lib_path = os.path.join(check_output([mapnik_config, '--prefix']),'lib')
119-
linkflags.extend(check_output([mapnik_config, '--libs']).split(' '))
120-
linkflags.extend(check_output([mapnik_config, '--ldflags']).split(' '))
121-
linkflags.extend(check_output([mapnik_config, '--dep-libs']).split(' '))
122-
linkflags.extend([
123-
'-lmapnik-wkt',
124-
'-lmapnik-json',
125-
] + ['-l%s' % i for i in get_boost_library_names()])
116+
lib_path = os.path.join(check_output(['pkg-config', '--variable=prefix', 'libmapnik']),'lib')
117+
linkflags.extend(check_output(['pkg-config', '--libs', 'libmapnik']).split(' '))
118+
linkflags.extend(['-l%s' % i for i in get_boost_library_names()])
126119

127120
# Dynamically make the mapnik/paths.py file
128121
f_paths = open('mapnik/paths.py', 'w')
129122
f_paths.write('import os\n')
130123
f_paths.write('\n')
131124

132-
input_plugin_path = check_output([mapnik_config, '--input-plugins'])
133-
font_path = check_output([mapnik_config, '--fonts'])
125+
input_plugin_path = check_output(['pkg-config', '--variable=plugins_dir', 'libmapnik'])
126+
font_path = check_output(['pkg-config', '--variable=fonts_dir', 'libmapnik'])
134127

135128
if mason_build:
136129
try:
@@ -225,7 +218,7 @@ def run(self):
225218
except shutil.Error:
226219
pass
227220

228-
extra_comp_args = check_output([mapnik_config, '--cflags']).split(' ')
221+
extra_comp_args = check_output(['pkg-config', '--cflags', 'libmapnik']).split(' ')
229222

230223
extra_comp_args = list(filter(lambda arg: arg != "-fvisibility=hidden", extra_comp_args))
231224

@@ -253,9 +246,12 @@ def run(self):
253246
linkflags.append('-Wl,-rpath=$ORIGIN/lib')
254247

255248
if os.environ.get("CC", False) == False:
256-
os.environ["CC"] = check_output([mapnik_config, '--cxx'])
249+
os.environ["CC"] = 'c++'
257250
if os.environ.get("CXX", False) == False:
258-
os.environ["CXX"] = check_output([mapnik_config, '--cxx'])
251+
os.environ["CXX"] = 'c++'
252+
253+
extra_comp_args = list(filter(lambda arg: arg != "", extra_comp_args))
254+
linkflags = list(filter(lambda arg: arg != "", linkflags))
259255

260256
setup(
261257
name="mapnik",

0 commit comments

Comments
 (0)