Skip to content

Commit

Permalink
Merge pull request #4 from noirbizarre/master
Browse files Browse the repository at this point in the history
Fix multiarch support on Debian/Ubuntu
  • Loading branch information
kiorky committed Aug 4, 2012
2 parents fe1bba7 + 517a50b commit b5d1a5b
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/mapnik/utils.py
Expand Up @@ -2,7 +2,7 @@

import re
import os
from subprocess import Popen, PIPE
from subprocess import Popen, PIPE, check_output
from ctypes import CDLL

def read(rnames):
Expand Down Expand Up @@ -37,7 +37,7 @@ def get_config_output(exe, args):
if ret.wait() != 0:
raise Exception(
'%s error: %s\n%s' % (
cmd,
cmd,
ret.stdout.read(),
ret.stderr.read(),
)
Expand Down Expand Up @@ -91,6 +91,21 @@ def get_boost_flags():
raise Exception('Cant find boost_python lib!')
return {'includes': includes, 'libraries': libraries}


def add_multiarch_paths(flags):
'''
Find multiarchs specifics paths for Debian/Ubuntu.
See https://wiki.ubuntu.com/MultiarchSpec
Could be fixed in Scons and/or mapnik-utils
'''
try:
arch = check_output(['dpkg-architecture', '-qDEB_HOST_MULTIARCH'])
arch = arch[:-1] if arch.endswith('\n') else arch
flags['includes'].append('-I/usr/lib/%s/sigc++-2.0/include' % arch)
except:
pass


def get_compilation_flags():
compilation_flags = {
'includes': [],
Expand All @@ -104,6 +119,8 @@ def get_compilation_flags():
compilation_flags['libraries'].extend(bf['libraries'])
compilation_flags['includes'].extend(mapnik_config(["--cflags"]).split())
compilation_flags['extra_link_args'].extend(mapnik_config(["--libs"]).split())
if sys.platform.startswith("linux"):
add_multiarch_paths(compilation_flags)
return compilation_flags


0 comments on commit b5d1a5b

Please sign in to comment.