mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +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 argparse
|
||||||
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
class Colors:
|
class Colors:
|
||||||
HEADER = '\033[95m'
|
HEADER = '\033[95m'
|
||||||
OKBLUE = '\033[94m'
|
OKBLUE = '\033[94m'
|
||||||
|
@ -47,3 +52,13 @@ def accept_command(commands):
|
||||||
return command
|
return command
|
||||||
|
|
||||||
return None
|
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
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import site
|
import site
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
from common import get_meson
|
||||||
|
|
||||||
SCRIPTDIR = os.path.abspath(os.path.dirname(__file__))
|
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")
|
env["GST_REGISTRY"] = os.path.normpath(options.builddir + "/registry.dat")
|
||||||
|
|
||||||
filename = "meson.build"
|
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$')
|
typelib_reg = re.compile(r'.*\.typelib$')
|
||||||
|
|
||||||
if os.name is 'nt':
|
if os.name is 'nt':
|
||||||
|
@ -69,23 +72,24 @@ def get_subprocess_env(options):
|
||||||
else:
|
else:
|
||||||
lib_path_envvar = 'LD_LIBRARY_PATH'
|
lib_path_envvar = 'LD_LIBRARY_PATH'
|
||||||
|
|
||||||
for root, dirnames, filenames in os.walk(os.path.join(options.builddir,
|
meson, mesonconf, mesonintrospect = get_meson()
|
||||||
'subprojects')):
|
targets_s = subprocess.check_output([mesonintrospect, options.builddir, '--targets'])
|
||||||
has_typelib = False
|
targets = json.loads(targets_s.decode())
|
||||||
has_shared = False
|
for target in targets:
|
||||||
for filename in filenames:
|
filename = target['filename']
|
||||||
if typelib_reg.search(filename) and not has_typelib:
|
root = os.path.dirname(filename)
|
||||||
has_typelib = True
|
if typelib_reg.search(filename):
|
||||||
prepend_env_var(env, "GI_TYPELIB_PATH",
|
prepend_env_var(env, "GI_TYPELIB_PATH",
|
||||||
os.path.join(options.builddir, root))
|
os.path.join(options.builddir, root))
|
||||||
if has_shared:
|
elif sharedlib_reg.search(filename):
|
||||||
break
|
if target.get('type') != "shared library":
|
||||||
elif sharedlib_reg.search(filename) and not has_shared:
|
continue
|
||||||
has_shared = True
|
|
||||||
prepend_env_var(env, lib_path_envvar,
|
if "lib/gstreamer-1.0" in os.path.normpath(target.get('install_filename')):
|
||||||
os.path.join(options.builddir, root))
|
continue
|
||||||
if has_typelib:
|
|
||||||
break
|
prepend_env_var(env, lib_path_envvar,
|
||||||
|
os.path.join(options.builddir, root))
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
12
setup
12
setup
|
@ -8,6 +8,7 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from common import git
|
from common import git
|
||||||
|
from common import get_meson
|
||||||
from common import Colors
|
from common import Colors
|
||||||
from common import accept_command
|
from common import accept_command
|
||||||
|
|
||||||
|
@ -17,22 +18,13 @@ PROJECTNAME = "GStreamer build"
|
||||||
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
|
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():
|
def get_configs():
|
||||||
return ['--werror']
|
return ['--werror']
|
||||||
|
|
||||||
|
|
||||||
def configure_meson(args, options):
|
def configure_meson(args, options):
|
||||||
"""Configures meson and generate the Makefile."""
|
"""Configures meson and generate the Makefile."""
|
||||||
meson, mesonconf = get_meson()
|
meson, mesonconf, mesonintrospect = get_meson()
|
||||||
if not meson:
|
if not meson:
|
||||||
print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
|
print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
|
||||||
"You can simply install it with:\n"
|
"You can simply install it with:\n"
|
||||||
|
|
Loading…
Reference in a new issue