aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdepfixer.py24
-rwxr-xr-xmeson.py5
-rw-r--r--modules/gnome.py11
3 files changed, 39 insertions, 1 deletions
diff --git a/depfixer.py b/depfixer.py
index 8db7ab6..c240935 100755
--- a/depfixer.py
+++ b/depfixer.py
@@ -52,6 +52,7 @@ def init_datasizes(self, ptrsize, is_le):
class DynamicEntry():
def __init__(self, ifile, ptrsize, is_le):
init_datasizes(self, ptrsize, is_le)
+ self.ptrsize = ptrsize
if ptrsize == 64:
self.d_tag = struct.unpack(self.Sxword, ifile.read(self.SxwordSize))[0];
self.val = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0];
@@ -59,6 +60,14 @@ class DynamicEntry():
self.d_tag = struct.unpack(self.Sword, ifile.read(self.SwordSize))[0]
self.val = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
+ def write(self, ofile):
+ if self.ptrsize == 64:
+ ofile.write(struct.pack(self.Sxword, self.d_tag))
+ ofile.write(struct.pack(self.XWord, self.val))
+ else:
+ ofile.write(struct.pack(self.Sword, self.d_tag))
+ ofile.write(struct.pack(self.Word, self.val))
+
class SectionHeader():
def __init__(self, ifile, ptrsize, is_le):
init_datasizes(self, ptrsize, is_le)
@@ -259,6 +268,21 @@ class Elf():
self.bf.seek(rp_off)
self.bf.write(new_rpath)
self.bf.write(b'\0'*(len(old_rpath) - len(new_rpath) + 1))
+ if len(new_rpath) == 0:
+ self.remove_rpath_entry()
+
+ def remove_rpath_entry(self):
+ sec = self.find_section(b'.dynamic')
+ for (i, entry) in enumerate(self.dynamic):
+ if entry.d_tag == DT_RPATH:
+ rpentry = self.dynamic[i]
+ rpentry.d_tag = 0
+ self.dynamic = self.dynamic[:i] + self.dynamic[i+1:] + [rpentry]
+ break;
+ self.bf.seek(sec.sh_offset)
+ for entry in self.dynamic:
+ entry.write(self.bf)
+ return None
if __name__ == '__main__':
if len(sys.argv) < 2 or len(sys.argv) > 3:
diff --git a/meson.py b/meson.py
index 917840e..dc277eb 100755
--- a/meson.py
+++ b/meson.py
@@ -144,6 +144,11 @@ itself as required.'''
pickle.dump(b, open(dumpfile, 'wb'))
def run(args):
+ if sys.version_info < (3, 4):
+ print('Meson works correctly only with python 3.4+.')
+ print('You have python %s.' % sys.version)
+ print('Please update your environment')
+ return 1
if args[-1] == 'secret-handshake':
args = args[:-1]
handshake = True
diff --git a/modules/gnome.py b/modules/gnome.py
index afd07a0..55eec17 100644
--- a/modules/gnome.py
+++ b/modules/gnome.py
@@ -55,10 +55,16 @@ class GnomeModule:
nsversion = kwargs.pop('nsversion')
libsources = kwargs.pop('sources')
girfile = '%s-%s.gir' % (ns, nsversion)
+
scan_command = ['g-ir-scanner', '@INPUT@']
scan_command += pkgargs
scan_command += ['--namespace='+ns, '--nsversion=' + nsversion, '--warn-all',
'--output', '@OUTPUT@']
+
+ for incdirs in girtarget.include_dirs:
+ for incdir in incdirs.get_incdirs():
+ scan_command += ['-I%s' % os.path.join(state.environment.get_source_dir(), incdir)]
+
if 'includes' in kwargs:
includes = kwargs.pop('includes')
if isinstance(includes, str):
@@ -99,7 +105,10 @@ class GnomeModule:
if isinstance(girtarget, build.Executable):
scan_command += ['--program', girtarget]
elif isinstance(girtarget, build.SharedLibrary):
- scan_command += ['--library', girtarget.get_basename()]
+ libname = girtarget.get_basename()
+ if girtarget.soversion:
+ libname += "-%s" % girtarget.soversion
+ scan_command += ['--library', libname]
scankwargs = {'output' : girfile,
'input' : libsources,
'command' : scan_command}