diff --git a/meson.py b/meson.py index 3080ff44e..8d9f87d1b 100755 --- a/meson.py +++ b/meson.py @@ -42,7 +42,7 @@ else: parser.add_option('--prefix', default=def_prefix, dest='prefix', help='the installation prefix (default: %default)') -parser.add_option('--libdir', default='lib', dest='libdir', +parser.add_option('--libdir', default=mesonlib.default_libdir(), dest='libdir', help='the installation subdir of libraries (default: %default)') parser.add_option('--bindir', default='bin', dest='bindir', help='the installation subdir of executables (default: %default)') diff --git a/mesonlib.py b/mesonlib.py index f2d424c90..af1d47f9c 100644 --- a/mesonlib.py +++ b/mesonlib.py @@ -86,3 +86,9 @@ def version_compare(vstr1, vstr2): varr1 = [int(x) for x in vstr1.split('.')] varr2 = [int(x) for x in vstr2.split('.')] return cmpop(varr1, varr2) + +def default_libdir(): + if os.path.isfile('/etc/debian_version'): + archpath = subprocess.check_output(['dpkg-architecture', '-qDEB_HOST_MULTIARCH']).decode().strip() + return 'lib/' + archpath + return 'lib'