Skip to content

Commit

Permalink
dev-util/meson: new package needed by gst-transcoder (and probably ne…
Browse files Browse the repository at this point in the history
…eded by more gstreamer stuff in the future).

Package-Manager: portage-2.3.0
  • Loading branch information
pacho2 committed Aug 6, 2016
1 parent 9a4ad15 commit 288a728
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-util/meson/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST meson-0.33.0.tar.gz 482221 SHA256 2417fd27cbb1e9b1006fe9e5a1f3896285d4c925ffffdf9478638b5fe3ea7fc5 SHA512 de4bdc40574dfbbc5a29861c32984dc1c97d28992e849c32f1ec0e314d3c69861768583c29eea2b9708ec6b734759d7eac60a53015fd321e29f1e9b1dbbffc22 WHIRLPOOL f12522765dcdf035f873625c3f8dca3d5800e7f12907ac80e65b76d6f7dd54469cd91060d5b89e16b1ca088c94808901706aa98a1d53ff65429bf1b733246dcf
96 changes: 96 additions & 0 deletions dev-util/meson/files/meson-0.33.0-runpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From b42c0555ca35ebf6e97438ef414a3de62eaa2ced Mon Sep 17 00:00:00 2001
From: Jussi Pakkanen <[email protected]>
Date: Tue, 2 Aug 2016 21:45:45 +0300
Subject: [PATCH] Handle both DT_RPATH as well as DT_RUNPATH when fixing rpath
settings.

---
mesonbuild/scripts/depfixer.py | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
index 8ff0dd1..cb136f4 100644
--- a/mesonbuild/scripts/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -20,6 +20,7 @@
SHT_STRTAB = 3
DT_NEEDED = 1
DT_RPATH = 15
+DT_RUNPATH = 29
DT_STRTAB = 5
DT_SONAME = 14

@@ -211,21 +212,29 @@ def print_soname(self):
self.bf.seek(strtab.val + soname.val)
print(self.read_str())

- def get_rpath_offset(self):
+ def get_entry_offset(self, entrynum):
sec = self.find_section(b'.dynstr')
for i in self.dynamic:
- if i.d_tag == DT_RPATH:
+ if i.d_tag == entrynum:
return sec.sh_offset + i.val
return None

def print_rpath(self):
- offset = self.get_rpath_offset()
+ offset = self.get_entry_offset(DT_RPATH)
if offset is None:
print("This file does not have an rpath.")
else:
self.bf.seek(offset)
print(self.read_str())

+ def print_runpath(self):
+ offset = self.get_entry_offset(DT_RUNPATH)
+ if offset is None:
+ print("This file does not have a runpath.")
+ else:
+ self.bf.seek(offset)
+ print(self.read_str())
+
def print_deps(self):
sec = self.find_section(b'.dynstr')
deps = []
@@ -257,9 +266,15 @@ def fix_deps(self, prefix):
self.bf.write(newname)

def fix_rpath(self, new_rpath):
+ # The path to search for can be either rpath or runpath.
+ # Fix both of them to be sure.
+ self.fix_rpathtype_entry(new_rpath, DT_RPATH)
+ self.fix_rpathtype_entry(new_rpath, DT_RUNPATH)
+
+ def fix_rpathtype_entry(self, new_rpath, entrynum):
if isinstance(new_rpath, str):
new_rpath = new_rpath.encode('utf8')
- rp_off = self.get_rpath_offset()
+ rp_off = self.get_entry_offset(entrynum)
if rp_off is None:
if self.verbose:
print('File does not have rpath. It should be a fully static executable.')
@@ -272,12 +287,12 @@ def fix_rpath(self, new_rpath):
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()
+ self.remove_rpath_entry(entrynum)

- def remove_rpath_entry(self):
+ def remove_rpath_entry(self, entrynum):
sec = self.find_section(b'.dynamic')
for (i, entry) in enumerate(self.dynamic):
- if entry.d_tag == DT_RPATH:
+ if entry.d_tag == entrynum:
rpentry = self.dynamic[i]
rpentry.d_tag = 0
self.dynamic = self.dynamic[:i] + self.dynamic[i+1:] + [rpentry]
@@ -296,6 +311,7 @@ def run(args):
e = Elf(args[0])
if len(args) == 1:
e.print_rpath()
+ e.print_runpath()
else:
new_rpath = args[1]
e.fix_rpath(new_rpath)
36 changes: 36 additions & 0 deletions dev-util/meson/meson-0.33.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6
PYTHON_COMPAT=( python3_{3,4,5} )

inherit distutils-r1

DESCRIPTION="Open source build system"
HOMEPAGE="http://mesonbuild.com/"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND="${PYTHON_DEPS}
dev-util/ninja
"
RDEPEND="${DEPEND}"

DOCS=( authors.txt contributing.txt )

PATCHES=(
# https://github.com/mesonbuild/meson/pull/663
"${FILESDIR}"/${P}-runpath.patch
)

src_install() {
distutils-r1_src_install
for i in mesonconf mesonintrospect meson wraptool; do
dosym "${i}.py" "/usr/bin/${i}"
done
}
8 changes: 8 additions & 0 deletions dev-util/meson/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>[email protected]</email>
<name>GStreamer package maintainers</name>
</maintainer>
</pkgmetadata>

0 comments on commit 288a728

Please sign in to comment.