6
6
import subprocess
7
7
import os
8
8
9
- mapnik_config = 'mapnik-config'
10
-
11
9
def check_output (args ):
12
10
output = subprocess .check_output (args ).decode ()
13
11
return output .rstrip ('\n ' )
14
12
15
13
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 (' ' ))
24
16
25
17
# Dynamically make the mapnik/paths.py file
26
18
f_paths = open ('packaging/mapnik/paths.py' , 'w' )
27
19
f_paths .write ('import os\n ' )
28
20
f_paths .write ('\n ' )
29
21
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 ' ])
32
24
33
25
if os .environ .get ('LIB_DIR_NAME' ):
34
26
mapnik_lib_path = lib_path + os .environ .get ('LIB_DIR_NAME' )
@@ -43,7 +35,7 @@ def check_output(args):
43
35
"__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n " )
44
36
f_paths .close ()
45
37
46
- extra_comp_args = check_output ([mapnik_config , '--cflags' ]).split (' ' )
38
+ extra_comp_args = check_output (['pkg-config' , '--cflags' , 'libmapnik ' ]).split (' ' )
47
39
extra_comp_args = list (filter (lambda arg : arg != "-fvisibility=hidden" , extra_comp_args ))
48
40
49
41
if sys .platform == 'darwin' :
@@ -53,6 +45,8 @@ def check_output(args):
53
45
linkflags .append ('-Wl,-z,origin' )
54
46
linkflags .append ('-Wl,-rpath=$ORIGIN/lib' )
55
47
48
+ extra_comp_args = list (filter (lambda arg : arg != "" , extra_comp_args ))
49
+ linkflags = list (filter (lambda arg : arg != "" , linkflags ))
56
50
57
51
ext_modules = [
58
52
Pybind11Extension (
@@ -112,9 +106,9 @@ def check_output(args):
112
106
]
113
107
114
108
if os .environ .get ("CC" , False ) == False :
115
- os .environ ["CC" ] = check_output ([ mapnik_config , '--cxx' ])
109
+ os .environ ["CC" ] = 'c++'
116
110
if os .environ .get ("CXX" , False ) == False :
117
- os .environ ["CXX" ] = check_output ([ mapnik_config , '--cxx' ])
111
+ os .environ ["CXX" ] = 'c++'
118
112
119
113
setup (
120
114
name = "mapnik" ,
0 commit comments