mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
Use mesonintrospect to set library path
this way the uninstalled target can be used before the libraries are built https://bugzilla.gnome.org/show_bug.cgi?id=775281
This commit is contained in:
parent
2b74d4d86d
commit
954c27641d
3 changed files with 39 additions and 28 deletions
15
common.py
15
common.py
|
@ -1,7 +1,12 @@
|
|||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
|
||||
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
class Colors:
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
|
@ -47,3 +52,13 @@ def accept_command(commands):
|
|||
return command
|
||||
|
||||
return None
|
||||
|
||||
def get_meson():
|
||||
meson = os.path.join(ROOTDIR, 'meson', 'meson.py')
|
||||
if os.path.exists(meson):
|
||||
mesonconf = os.path.join(ROOTDIR, 'meson', 'mesonconf.py')
|
||||
mesonintrospect = os.path.join(ROOTDIR, 'meson', 'mesonintrospect.py')
|
||||
return meson, mesonconf, mesonintrospect
|
||||
|
||||
return accept_command(["meson.py", "meson"]), accept_command(["mesonconf.py", "mesonconf"]), \
|
||||
accept_command(["mesonintrospect.py", "mesonintrospect"])
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import site
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
from common import get_meson
|
||||
|
||||
SCRIPTDIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
@ -59,7 +62,7 @@ def get_subprocess_env(options):
|
|||
env["GST_REGISTRY"] = os.path.normpath(options.builddir + "/registry.dat")
|
||||
|
||||
filename = "meson.build"
|
||||
sharedlib_reg = re.compile(r'\.so$|\.dylib$|\.dll$')
|
||||
sharedlib_reg = re.compile(r'\.so|\.dylib|\.dll')
|
||||
typelib_reg = re.compile(r'.*\.typelib$')
|
||||
|
||||
if os.name is 'nt':
|
||||
|
@ -69,23 +72,24 @@ def get_subprocess_env(options):
|
|||
else:
|
||||
lib_path_envvar = 'LD_LIBRARY_PATH'
|
||||
|
||||
for root, dirnames, filenames in os.walk(os.path.join(options.builddir,
|
||||
'subprojects')):
|
||||
has_typelib = False
|
||||
has_shared = False
|
||||
for filename in filenames:
|
||||
if typelib_reg.search(filename) and not has_typelib:
|
||||
has_typelib = True
|
||||
prepend_env_var(env, "GI_TYPELIB_PATH",
|
||||
os.path.join(options.builddir, root))
|
||||
if has_shared:
|
||||
break
|
||||
elif sharedlib_reg.search(filename) and not has_shared:
|
||||
has_shared = True
|
||||
prepend_env_var(env, lib_path_envvar,
|
||||
os.path.join(options.builddir, root))
|
||||
if has_typelib:
|
||||
break
|
||||
meson, mesonconf, mesonintrospect = get_meson()
|
||||
targets_s = subprocess.check_output([mesonintrospect, options.builddir, '--targets'])
|
||||
targets = json.loads(targets_s.decode())
|
||||
for target in targets:
|
||||
filename = target['filename']
|
||||
root = os.path.dirname(filename)
|
||||
if typelib_reg.search(filename):
|
||||
prepend_env_var(env, "GI_TYPELIB_PATH",
|
||||
os.path.join(options.builddir, root))
|
||||
elif sharedlib_reg.search(filename):
|
||||
if target.get('type') != "shared library":
|
||||
continue
|
||||
|
||||
if "lib/gstreamer-1.0" in os.path.normpath(target.get('install_filename')):
|
||||
continue
|
||||
|
||||
prepend_env_var(env, lib_path_envvar,
|
||||
os.path.join(options.builddir, root))
|
||||
|
||||
return env
|
||||
|
||||
|
|
12
setup
12
setup
|
@ -8,6 +8,7 @@ import shutil
|
|||
import subprocess
|
||||
|
||||
from common import git
|
||||
from common import get_meson
|
||||
from common import Colors
|
||||
from common import accept_command
|
||||
|
||||
|
@ -17,22 +18,13 @@ PROJECTNAME = "GStreamer build"
|
|||
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def get_meson():
|
||||
meson = os.path.join(ROOTDIR, 'meson', 'meson.py')
|
||||
if os.path.exists(meson):
|
||||
mesonconf = os.path.join(ROOTDIR, 'meson', 'mesonconf.py')
|
||||
return meson, mesonconf
|
||||
|
||||
return accept_command(["meson.py", "meson"]), accept_command(["mesonconf.py", "mesonconf"])
|
||||
|
||||
|
||||
def get_configs():
|
||||
return ['--werror']
|
||||
|
||||
|
||||
def configure_meson(args, options):
|
||||
"""Configures meson and generate the Makefile."""
|
||||
meson, mesonconf = get_meson()
|
||||
meson, mesonconf, mesonintrospect = get_meson()
|
||||
if not meson:
|
||||
print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
|
||||
"You can simply install it with:\n"
|
||||
|
|
Loading…
Reference in a new issue