Skip to content

Commit

Permalink
media-libs/libxmlbird: new package
Browse files Browse the repository at this point in the history
  • Loading branch information
vapier committed May 17, 2016
1 parent 7755e4f commit 12c4494
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 0 deletions.
1 change: 1 addition & 0 deletions media-libs/libxmlbird/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST libxmlbird-1.2.0.tar.xz 20004 SHA256 baca1d813c4a53c67a8052f8488766af7f73c38b1187fa0f7cd939899071dc24 SHA512 0677004a79194dde87f27387ae1faeb19aa2ecd985664ad4f3f7576d39f71e0d05215c92bb15f3e3f1a4053e27025fd1a4151f1ba12774cfa789d47648097e5b WHIRLPOOL 51ac2fe20fa434267dd2af968707c8370ff3b02c137554fc88e0a0147e61d2824c3381a46e016802fb6af3c16cdf950c231c3c6a01b7bda477f4c76091da3201
62 changes: 62 additions & 0 deletions media-libs/libxmlbird/files/libxmlbird-1.2.0-configure-valac.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
https://github.com/johanmattssonm/xmlbird/pull/5

From 67864656d7446b067a388c6fd2f059322d7047f0 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Tue, 17 May 2016 17:00:05 -0400
Subject: [PATCH] configure/test: respect --valac option

Make sure we don't still test `valac` when the compiler has been set to
a specific version/path.
---
configure | 6 +++---
scripts/tests.py | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index f80559f..4bbd9d5 100755
--- a/configure
+++ b/configure
@@ -44,8 +44,8 @@ def test_library_version (lib):
process.communicate()[0]
return process.returncode == 0

-def configure ():
- if not test_program_version ("valac", 0, 16, 0):
+def configure(valac):
+ if not test_program_version(valac, 0, 16, 0):
print (FAIL + "valac is too old." + ENDC)
exit (1)

@@ -105,7 +105,7 @@ if not options.nonnull:
else:
options.nonnull = True

-configure()
+configure(options.valac)

configfile.write_compile_parameters(options.prefix,
options.dest,
diff --git a/scripts/tests.py b/scripts/tests.py
index 7281e05..88483f1 100644
--- a/scripts/tests.py
+++ b/scripts/tests.py
@@ -1,6 +1,6 @@
#!/usr/bin/python3
import subprocess
-from scripts.config import PREFIX
+from scripts.config import (PREFIX, VALAC)
from scripts.run import run
from scripts.version import LIBXMLBIRD_SO_VERSION

@@ -32,7 +32,7 @@ def build_tests():
run ("mkdir -p build/tests");

for test in tests:
- run ("valac --ccode --pkg=posix --pkg=xmlbird --vapidir=./build "
+ run (VALAC + " --ccode --pkg=posix --pkg=xmlbird --vapidir=./build "
+ "--directory=./build tests/" + test + ".vala tests/Test.vala");

run ("""gcc -fPIC -c \
--
2.8.2

159 changes: 159 additions & 0 deletions media-libs/libxmlbird/files/libxmlbird-1.2.0-libdir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
From 661c84d232e8d22978dd0220f7860b149c19f2e4 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Tue, 17 May 2016 17:37:53 -0400
Subject: [PATCH] configure: respect libdir at build time

The xmlbird.pc file encodes the libdir in it, so make sure we have it
at configure & build time. That means moving the flag from install to
configure and the config module.

Also clean up the code a bit so `--libdir lib64` doesn't break things.
It previously assumed that the argument always had a leading slash.
---
configure | 19 ++++++++++++++++++-
install.py | 39 +++++++++++----------------------------
scripts/configfile.py | 3 ++-
scripts/pkgconfig.py | 2 +-
4 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 4bbd9d5..ed64f66 100755
--- a/configure
+++ b/configure
@@ -51,6 +51,7 @@ def configure(valac):

parser = OptionParser()
parser.add_option('-p', '--prefix', dest='prefix', help='Install prefix', metavar='PREFIX')
+parser.add_option('-l', '--libdir', dest='libdir', help='path to directory for shared libraries (lib or lib64).', metavar='LIBDIR')
parser.add_option('-d', '--dest', dest='dest', help='Install to this directory', metavar='DEST')
parser.add_option('-c', '--cc', dest='cc', help='C compiler', metavar='CC')
parser.add_option('-v', '--valac', dest='valac', help='Vala compiler', metavar='VALAC')
@@ -93,7 +94,22 @@ if not options.prefix:
options.prefix = '${DESTDIR}${PREFIX}'
else:
options.prefix = '/usr'
-
+
+if not options.libdir:
+ if platform.dist()[0] == 'Ubuntu' or platform.dist()[0] == 'Debian':
+ process = subprocess.Popen(['dpkg-architecture', '-qDEB_HOST_MULTIARCH'], stdout=subprocess.PIPE)
+ out, err = process.communicate()
+ options.libdir = 'lib/' + out.decode('UTF-8').rstrip('\n')
+ else:
+ p = platform.machine()
+ if p == 'i386' or p == 's390' or p == 'ppc' or p == 'armv7hl':
+ options.libdir = 'lib'
+ elif p == 'x86_64' or p == 's390x' or p == 'ppc64':
+ options.libdir = 'lib64'
+ else:
+ options.libdir = 'lib'
+options.libdir = '/' + options.libdir.lstrip('/')
+
if not options.dest:
options.dest = ''
if not options.cc:
@@ -108,6 +124,7 @@ else:
configure(options.valac)

configfile.write_compile_parameters(options.prefix,
+ options.libdir,
options.dest,
options.cc,
options.valac,
diff --git a/install.py b/install.py
index d3d3007..d8b995b 100755
--- a/install.py
+++ b/install.py
@@ -62,7 +62,6 @@ def link (dir, file, linkname):
run ('cd ' + dest + prefix + dir + ' && ln -sf ' + file + ' ' + linkname)

parser = OptionParser()
-parser.add_option ("-l", "--libdir", dest="libdir", help="path to directory for shared libraries (lib or lib64).")
parser.add_option ("-d", "--dest", dest="dest", help="install to this directory", metavar="DEST")

(options, args) = parser.parse_args()
@@ -73,40 +72,24 @@ if not options.dest:
prefix = config.PREFIX
dest = options.dest

-if not options.libdir:
- if platform.dist()[0] == 'Ubuntu' or platform.dist()[0] == 'Debian':
- process = subprocess.Popen(['dpkg-architecture', '-qDEB_HOST_MULTIARCH'], stdout=subprocess.PIPE)
- out, err = process.communicate()
- libdir = '/lib/' + out.decode('UTF-8').rstrip ('\n')
- else:
- p = platform.machine()
- if p == 'i386' or p == 's390' or p == 'ppc' or p == 'armv7hl':
- libdir = '/lib'
- elif p == 'x86_64' or p == 's390x' or p == 'ppc64':
- libdir = '/lib64'
- else:
- libdir = '/lib'
-else:
- libdir = options.libdir
-
if "openbsd" in sys.platform:
- install ('build/bin/libxmlbird.so.' + '${LIBxmlbird_VERSION}', '/lib', 644)
+ install ('build/bin/libxmlbird.so.' + '${LIBxmlbird_VERSION}', config.LIBDIR, 644)
elif os.path.isfile ('build/bin/libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION):
- install ('build/bin/libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, libdir, 644)
- link (libdir, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION_MAJOR)
- link (libdir, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so')
+ install ('build/bin/libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, config.LIBDIR, 644)
+ link (config.LIBDIR, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION_MAJOR)
+ link (config.LIBDIR, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so')
elif os.path.isfile ('build/libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION):
- install ('build/libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, libdir, 644)
- link (libdir, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION_MAJOR)
- link (libdir, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so')
+ install ('build/libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, config.LIBDIR, 644)
+ link (config.LIBDIR, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION_MAJOR)
+ link (config.LIBDIR, 'libxmlbird.so.' + version.LIBXMLBIRD_SO_VERSION, ' libxmlbird.so')
elif os.path.isfile ('build/bin/libxmlbird.' + version.LIBXMLBIRD_SO_VERSION + '.dylib'):
- install ('build/bin/libxmlbird-' + version.LIBXMLBIRD_SO_VERSION + '.dylib', libdir, 644)
- link (libdir, 'libxmlbird-' + version.LIBXMLBIRD_SO_VERSION + '.dylib', ' libxmlbird.dylib.' + version.LIBXMLBIRD_SO_VERSION_MAJOR)
- link (libdir, 'libxmlbird-' + version.LIBXMLBIRD_SO_VERSION + '.dylib', ' libxmlbird.dylib')
+ install ('build/bin/libxmlbird-' + version.LIBXMLBIRD_SO_VERSION + '.dylib', config.LIBDIR, 644)
+ link (config.LIBDIR, 'libxmlbird-' + version.LIBXMLBIRD_SO_VERSION + '.dylib', ' libxmlbird.dylib.' + version.LIBXMLBIRD_SO_VERSION_MAJOR)
+ link (config.LIBDIR, 'libxmlbird-' + version.LIBXMLBIRD_SO_VERSION + '.dylib', ' libxmlbird.dylib')
else:
print ("Can't find libxmlbird.")
exit (1)

install ('build/xmlbird/xmlbird.h', '/include', 644)
install ('build/xmlbird.vapi', '/share/vala/vapi', 644)
-install ('build/xmlbird.pc', libdir + '/pkgconfig', 644)
+install ('build/xmlbird.pc', config.LIBDIR + '/pkgconfig', 644)
diff --git a/scripts/configfile.py b/scripts/configfile.py
index 71c1e20..4a88585 100755
--- a/scripts/configfile.py
+++ b/scripts/configfile.py
@@ -1,10 +1,11 @@
#!/usr/bin/python3

-def write_compile_parameters (prefix, dest, cc, valac, non_null,
+def write_compile_parameters (prefix, libdir, dest, cc, valac, non_null,
valacflags, cflags, ldflags):
f = open('./scripts/config.py', 'w+')
f.write("#!/usr/bin/python3\n")
f.write("PREFIX = \"" + prefix + "\"\n")
+ f.write("LIBDIR = \"" + libdir + "\"\n")
f.write("DEST = \"" + dest + "\"\n")
f.write("CC = \"" + cc + "\"\n")
f.write("VALAC = \"" + valac + "\"\n")
diff --git a/scripts/pkgconfig.py b/scripts/pkgconfig.py
index c080234..c79c413 100644
--- a/scripts/pkgconfig.py
+++ b/scripts/pkgconfig.py
@@ -6,7 +6,7 @@ def generate_pkg_config_file():
f.write("prefix=" + config.PREFIX + "\n")
f.write("""exec_prefix=${prefix}
includedir=${prefix}/include
-libdir=${exec_prefix}/lib
+libdir=${exec_prefix}""" + config.LIBDIR + """

Name: xmlbird
Description: XML parser
--
2.8.2

10 changes: 10 additions & 0 deletions media-libs/libxmlbird/files/libxmlbird-1.2.0-verbose.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/scripts/run.py
+++ b/scripts/run.py
@@ -20,6 +20,7 @@ import subprocess

def run(cmd):
cmd = "sh -c \"" + cmd.replace ("\"", "\\\"") + "\""
+ print(cmd)
process = subprocess.Popen (cmd, shell=True)
process.communicate()[0]
if not process.returncode == 0:
59 changes: 59 additions & 0 deletions media-libs/libxmlbird/libxmlbird-1.2.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="5"

PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} )

inherit python-any-r1 vala toolchain-funcs multilib eutils

DESCRIPTION="XML parser written in Vala"
HOMEPAGE="https://birdfont.org/xmlbird.php"
SRC_URI="https://birdfont.org/xmlbird-releases/${P}.tar.xz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

# The test build logic needs work. Doesn't respect compiler settings.
RESTRICT="test"

src_prepare() {
vala_src_prepare

epatch "${FILESDIR}"/${PN}-1.2.0-verbose.patch
epatch "${FILESDIR}"/${PN}-1.2.0-configure-valac.patch
epatch "${FILESDIR}"/${PN}-1.2.0-libdir.patch

sed -i \
-e "s:pkg-config:$(tc-getPKG_CONFIG):" \
configure dodo.py || die
sed -i \
-e '/tests.build_tests/d' \
build.py || die
}

v() {
echo "$@"
"$@" || die
}

src_configure() {
v ./configure \
--prefix "${EPREFIX}/usr" \
--libdir "$(get_libdir)" \
--valac "${VALAC}" \
--cc "$(tc-getCC)" \
--cflags "${CFLAGS} ${CPPFLAGS}" \
--ldflags "${LDFLAGS}"
}

src_compile() {
v ./build.py
}

src_install() {
v ./install.py --dest "${D}"
dodoc NEWS README.md
}
11 changes: 11 additions & 0 deletions media-libs/libxmlbird/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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>
</maintainer>
<upstream>
<bugs-to>https://birdfont.org/bugtracker/</bugs-to>
<remote-id type="github">johanmattssonm/xmlbird</remote-id>
</upstream>
</pkgmetadata>

0 comments on commit 12c4494

Please sign in to comment.