mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-24 14:20:19 +01:00
Update LV2 host
This greatly improves the LV2 host to the point where all (non-midi) plugins distributed with Ubuntu 18.04 and Fedora 30 are supported.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.15.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -189,7 +189,7 @@ am__recursive_targets = \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
distdir
|
||||
distdir distdir-am
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
@@ -434,7 +434,6 @@ pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
@@ -984,8 +983,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
$(srcdir)/dist-libsoxr.mk $(srcdir)/dist-libvamp.mk $(srcdir)/dist-portaudio.mk $(am__empty):
|
||||
|
||||
@@ -1103,7 +1102,10 @@ cscopelist-am: $(am__tagged_files)
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
|
||||
@@ -168,11 +168,21 @@
|
||||
/* Begin PBXProject section */
|
||||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
};
|
||||
buildConfigurationList = 730F235809181A3A00AB638C /* Build configuration list for PBXProject "Ogg" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
English,
|
||||
);
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* Ogg */;
|
||||
productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8D07F2BC0486CC7A007CD1D0 /* Ogg */,
|
||||
734FB2E40B18B33E00D561D7 /* libogg (static) */,
|
||||
|
||||
@@ -524,11 +524,21 @@
|
||||
/* Begin PBXProject section */
|
||||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
};
|
||||
buildConfigurationList = 730F23F3091827B200AB638C /* Build configuration list for PBXProject "Vorbis" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
English,
|
||||
);
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* vorbis */;
|
||||
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
730F23A1091827B100AB638C /* Vorbis */,
|
||||
738835E30B18F870005C7A69 /* libvorbis (static) */,
|
||||
|
||||
1915
lib-src/lv2/Makefile
1915
lib-src/lv2/Makefile
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
srcdir=.
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
if [[ "$1" =~ --srcdir=.* ]]
|
||||
then
|
||||
srcdir=${1#*=}
|
||||
break
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
function waf
|
||||
{
|
||||
pkg=$1
|
||||
pushd >/dev/null ${pkg}
|
||||
shift
|
||||
$(which python python2 | tail -1) waf --prefix="." --include="." $@ build || exit 1
|
||||
popd >/dev/null
|
||||
|
||||
. .buildvars
|
||||
|
||||
if [ -e ${pkg}/build/*.a ]
|
||||
then
|
||||
mkdir -p obj
|
||||
pushd obj
|
||||
ar vx ../${pkg}/build/*.a
|
||||
ar vq ../liblv2.a *
|
||||
popd
|
||||
rm -rf obj
|
||||
fi
|
||||
}
|
||||
|
||||
[ -e liblv2.a ] && exit 0
|
||||
|
||||
waf lv2 --no-plugins
|
||||
waf serd --static --no-shared --no-utils
|
||||
waf sord --static --no-shared --no-utils
|
||||
waf sratom --static --no-shared
|
||||
waf lilv --static --no-shared --no-utils
|
||||
waf suil --static --no-shared --no-qt
|
||||
|
||||
exit 0
|
||||
109
lib-src/lv2/configure
vendored
109
lib-src/lv2/configure
vendored
@@ -1,13 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Search for python
|
||||
python=$(which python python2 python3 | tail -1)
|
||||
|
||||
# Define the target build directory
|
||||
prefix=$(pwd)/build
|
||||
|
||||
bypass=
|
||||
clean=
|
||||
|
||||
srcdir=.
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
if [[ "$1" =~ --srcdir=.* ]]
|
||||
then
|
||||
srcdir=${1#*=}
|
||||
break
|
||||
fi
|
||||
case "${1}" in
|
||||
--srcdir=*)
|
||||
srcdir=${1#*=}
|
||||
;;
|
||||
|
||||
--build)
|
||||
bypass=":"
|
||||
;;
|
||||
|
||||
--clean)
|
||||
clean="yes"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
@@ -15,75 +32,55 @@ function waf
|
||||
{
|
||||
pkg="$1"
|
||||
shift
|
||||
|
||||
mkdir -p ${pkg}
|
||||
pushd >/dev/null ${pkg}
|
||||
|
||||
if [ ! -e "waflib" ]
|
||||
if [ ! -e "waf" ]
|
||||
then
|
||||
cp -a "../${srcdir}/${pkg}"/waflib .
|
||||
cp -pr "../${srcdir}/${pkg}"/{waf,waflib} .
|
||||
fi
|
||||
|
||||
for f in "../${srcdir}/${pkg}"/*
|
||||
do
|
||||
if [ ! -e "${f##*/}" ]
|
||||
then
|
||||
ln -s "${f}"
|
||||
fi
|
||||
[ ! -e "${f##*/}" ] && ln -s "${f}"
|
||||
done
|
||||
|
||||
$(which python python2 | tail -1) waf --prefix="." --include="." $@ configure || exit 1
|
||||
popd >/dev/null
|
||||
export PKG_CONFIG_PATH="${prefix}/lib/pkgconfig"
|
||||
export LDFLAGS="${LDFLAGS} -ldl -lm"
|
||||
|
||||
if [ "${pkg}" == "lv2" ]
|
||||
common="--prefix=${prefix} --out=build --destdir=/"
|
||||
|
||||
if [ "${clean}" = "yes" ]
|
||||
then
|
||||
eval $(sed -e '/^VERSION/!d;s/ //g;s/.*VERSION/version/' ${pkg}/wscript)
|
||||
major=""
|
||||
lib=""
|
||||
${python} waf clean ${common} || exit 1
|
||||
else
|
||||
eval $(sed -e '/^[A-Z]*_VERSION/!d;s/ //g;s/.*VERSION/version/' ${pkg}/wscript)
|
||||
major="-${version%%.*}"
|
||||
lib="-l${pkg}${major}"
|
||||
${bypass} ${python} waf configure ${common} $@ || exit 1
|
||||
|
||||
trap "rm -f .build-timestamp" EXIT
|
||||
touch .build-timestamp
|
||||
|
||||
${python} waf build ${common} $@ || exit 1
|
||||
if [ -n "$(find . -newer .build-timestamp -type f ! -name compile_commands.json)" ]
|
||||
then
|
||||
${python} waf install ${common} $@ || exit 1
|
||||
fi
|
||||
|
||||
rm .build-timestamp
|
||||
trap - EXIT
|
||||
fi
|
||||
|
||||
cat <<EOF >${pkg}/build/${pkg}${major}.pc
|
||||
prefix=$(pwd)/${pkg}
|
||||
exec_prefix=\${prefix}
|
||||
libdir=\${exec_prefix}/lib
|
||||
includedir=.
|
||||
|
||||
Name: ${pkg}
|
||||
Version: ${version}
|
||||
Description: Temporary fake config file
|
||||
Libs: -L\${libdir} ${lib} -ldl -lm
|
||||
Cflags: -I\${includedir}/${pkg}${major}
|
||||
EOF
|
||||
|
||||
export PKG_CONFIG_PATH="$(pwd)/${pkg}/build:${PKG_CONFIG_PATH}"
|
||||
export CFLAGS="-I$(pwd)/${pkg} -I$(pwd)/${pkg}/build ${CFLAGS}"
|
||||
export LDFLAGS="-L$(pwd)/${pkg}/build ${lib} ${LDFLAGS}"
|
||||
|
||||
ln -s ../${pkg}/${pkg} include
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
rm -rf include
|
||||
mkdir -p include
|
||||
|
||||
[ ! -e Makefile ] && ln -s "${srcdir}/Makefile"
|
||||
[ ! -e build ] && ln -s "${srcdir}/build"
|
||||
echo >srcdir.mk "srcdir = ${srcdir}"
|
||||
[ ! -e configure ] && ln -s "${srcdir}/configure"
|
||||
|
||||
waf lv2 --no-plugins
|
||||
waf serd --static --no-shared --no-utils
|
||||
waf sord --static --no-shared --no-utils
|
||||
waf sratom --static --no-shared
|
||||
waf lilv --static --no-shared --no-utils
|
||||
waf suil --static --no-shared --no-qt
|
||||
sed -i'' -e "s@suil/lib/suil-0@suil/build@" suil/build/suil_config.h
|
||||
|
||||
cat >.buildvars <<EOF
|
||||
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
|
||||
export CFLAGS="${CFLAGS}"
|
||||
export LDFLAGS="${LDFLAGS}"
|
||||
EOF
|
||||
waf lv2 --no-plugins --no-coverage
|
||||
waf serd --static --no-shared --no-coverage --no-utils --largefile
|
||||
waf sord --static --no-shared --no-coverage --no-utils
|
||||
waf sratom --static --no-shared --no-coverage
|
||||
waf lilv --static --no-shared --no-coverage --no-utils
|
||||
waf suil --static --no-shared
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,351 +0,0 @@
|
||||
diff -ruN src.orig/serdnode.c src/serdnode.c
|
||||
--- src.orig/serdnode.c 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ src/serdnode.c 2013-10-27 06:02:53.825178800 -0500
|
||||
@@ -0,0 +1,347 @@
|
||||
+/*
|
||||
+ Copyright 2011-2012 David Robillard <http://drobilla.net>
|
||||
+
|
||||
+ Permission to use, copy, modify, and/or distribute this software for any
|
||||
+ purpose with or without fee is hereby granted, provided that the above
|
||||
+ copyright notice and this permission notice appear in all copies.
|
||||
+
|
||||
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
+*/
|
||||
+
|
||||
+#include "serd_internal.h"
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <math.h>
|
||||
+#include <float.h>
|
||||
+
|
||||
+#ifdef _WIN32
|
||||
+# define isnan(x) _isnan(x)
|
||||
+# define isinf(x) (!_finite(x))
|
||||
+#endif
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_from_string(SerdType type, const uint8_t* buf)
|
||||
+{
|
||||
+ if (!buf) {
|
||||
+ return SERD_NODE_NULL;
|
||||
+ }
|
||||
+
|
||||
+ uint32_t flags = 0;
|
||||
+ size_t buf_n_bytes = 0;
|
||||
+ const size_t buf_n_chars = serd_strlen(buf, &buf_n_bytes, &flags);
|
||||
+ SerdNode ret = { buf, buf_n_bytes, buf_n_chars, flags, type };
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_copy(const SerdNode* node)
|
||||
+{
|
||||
+ if (!node || !node->buf) {
|
||||
+ return SERD_NODE_NULL;
|
||||
+ }
|
||||
+
|
||||
+ SerdNode copy = *node;
|
||||
+ uint8_t* buf = (uint8_t*)malloc(copy.n_bytes + 1);
|
||||
+ memcpy(buf, node->buf, copy.n_bytes + 1);
|
||||
+ copy.buf = buf;
|
||||
+ return copy;
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+bool
|
||||
+serd_node_equals(const SerdNode* a, const SerdNode* b)
|
||||
+{
|
||||
+ return (a == b)
|
||||
+ || (a->type == b->type
|
||||
+ && a->n_bytes == b->n_bytes
|
||||
+ && a->n_chars == b->n_chars
|
||||
+ && ((a->buf == b->buf) || !memcmp((const char*)a->buf,
|
||||
+ (const char*)b->buf,
|
||||
+ a->n_bytes + 1)));
|
||||
+}
|
||||
+
|
||||
+static size_t
|
||||
+serd_uri_string_length(const SerdURI* uri)
|
||||
+{
|
||||
+ size_t len = uri->path_base.len;
|
||||
+
|
||||
+#define ADD_LEN(field, n_delims) \
|
||||
+ if ((field).len) { len += (field).len + (n_delims); }
|
||||
+
|
||||
+ ADD_LEN(uri->path, 1); // + possible leading `/'
|
||||
+ ADD_LEN(uri->scheme, 1); // + trailing `:'
|
||||
+ ADD_LEN(uri->authority, 2); // + leading `//'
|
||||
+ ADD_LEN(uri->query, 1); // + leading `?'
|
||||
+ ADD_LEN(uri->fragment, 1); // + leading `#'
|
||||
+
|
||||
+ return len + 2; // + 2 for authority `//'
|
||||
+}
|
||||
+
|
||||
+static size_t
|
||||
+string_sink(const void* buf, size_t len, void* stream)
|
||||
+{
|
||||
+ uint8_t** ptr = (uint8_t**)stream;
|
||||
+ memcpy(*ptr, buf, len);
|
||||
+ *ptr += len;
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_new_uri_from_node(const SerdNode* uri_node,
|
||||
+ const SerdURI* base,
|
||||
+ SerdURI* out)
|
||||
+{
|
||||
+ return (uri_node->type == SERD_URI)
|
||||
+ ? serd_node_new_uri_from_string(uri_node->buf, base, out)
|
||||
+ : SERD_NODE_NULL;
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_new_uri_from_string(const uint8_t* str,
|
||||
+ const SerdURI* base,
|
||||
+ SerdURI* out)
|
||||
+{
|
||||
+ if (!str || str[0] == '\0') {
|
||||
+ return serd_node_new_uri(base, NULL, out); // Empty URI => Base URI
|
||||
+ }
|
||||
+ SerdURI uri;
|
||||
+ serd_uri_parse(str, &uri);
|
||||
+ return serd_node_new_uri(&uri, base, out); // Resolve/Serialise
|
||||
+}
|
||||
+
|
||||
+static inline bool
|
||||
+is_uri_path_char(const uint8_t c)
|
||||
+{
|
||||
+ if (is_alpha(c) || is_digit(c)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ switch (c) {
|
||||
+ case '-': case '.': case '_': case '~': // unreserved
|
||||
+ case ':': case '@': // pchar
|
||||
+ case '/': // separator
|
||||
+ // sub-delims
|
||||
+ case '!': case '$': case '&': case '\'': case '(': case ')':
|
||||
+ case '*': case '+': case ',': case ';': case '=':
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_new_file_uri(const uint8_t* path,
|
||||
+ const uint8_t* hostname,
|
||||
+ SerdURI* out,
|
||||
+ bool escape)
|
||||
+{
|
||||
+ const size_t path_len = strlen((const char*)path);
|
||||
+ const size_t hostname_len = hostname ? strlen((const char*)hostname) : 0;
|
||||
+ const bool evil = is_windows_path(path);
|
||||
+ size_t uri_len = 0;
|
||||
+ uint8_t* uri = NULL;
|
||||
+
|
||||
+ if (path[0] == '/' || is_windows_path(path)) {
|
||||
+ uri_len = strlen("file://") + hostname_len + evil;
|
||||
+ uri = (uint8_t*)malloc(uri_len + 1);
|
||||
+ snprintf((char*)uri, uri_len + 1, "file://%s%s",
|
||||
+ hostname ? (const char*)hostname : "",
|
||||
+ evil ? "/" : "");
|
||||
+ }
|
||||
+
|
||||
+ SerdChunk chunk = { uri, uri_len };
|
||||
+ for (size_t i = 0; i < path_len; ++i) {
|
||||
+ if (evil && path[i] == '\\') {
|
||||
+ serd_chunk_sink("/", 1, &chunk);
|
||||
+ } else if (path[i] == '%') {
|
||||
+ serd_chunk_sink("%%", 2, &chunk);
|
||||
+ } else if (!escape || is_uri_path_char(path[i])) {
|
||||
+ serd_chunk_sink(path + i, 1, &chunk);
|
||||
+ } else {
|
||||
+ char escape_str[4] = { '%', 0, 0, 0 };
|
||||
+ snprintf(escape_str + 1, sizeof(escape_str) - 1, "%X", path[i]);
|
||||
+ serd_chunk_sink(escape_str, 3, &chunk);
|
||||
+ }
|
||||
+ }
|
||||
+ serd_chunk_sink_finish(&chunk);
|
||||
+
|
||||
+ if (out) {
|
||||
+ serd_uri_parse(chunk.buf, out);
|
||||
+ }
|
||||
+
|
||||
+ return serd_node_from_string(SERD_URI, chunk.buf);
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_new_uri(const SerdURI* uri, const SerdURI* base, SerdURI* out)
|
||||
+{
|
||||
+ SerdURI abs_uri = *uri;
|
||||
+ if (base) {
|
||||
+ serd_uri_resolve(uri, base, &abs_uri);
|
||||
+ }
|
||||
+
|
||||
+ const size_t len = serd_uri_string_length(&abs_uri);
|
||||
+ uint8_t* buf = (uint8_t*)malloc(len + 1);
|
||||
+
|
||||
+ SerdNode node = { buf, len, len, 0, SERD_URI }; // FIXME: UTF-8
|
||||
+
|
||||
+ uint8_t* ptr = buf;
|
||||
+ const size_t actual_len = serd_uri_serialise(&abs_uri, string_sink, &ptr);
|
||||
+
|
||||
+ buf[actual_len] = '\0';
|
||||
+ node.n_bytes = actual_len;
|
||||
+ node.n_chars = actual_len;
|
||||
+
|
||||
+ if (out) {
|
||||
+ serd_uri_parse(buf, out); // TODO: cleverly avoid double parse
|
||||
+ }
|
||||
+
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_new_decimal(double d, unsigned frac_digits)
|
||||
+{
|
||||
+ if (isnan(d) || isinf(d)) {
|
||||
+ return SERD_NODE_NULL;
|
||||
+ }
|
||||
+
|
||||
+ const double abs_d = fabs(d);
|
||||
+ const unsigned int_digits = (unsigned)fmax(1.0, ceil(log10(abs_d + 1)));
|
||||
+ char* buf = (char*)calloc(int_digits + frac_digits + 3, 1);
|
||||
+ SerdNode node = { (const uint8_t*)buf, 0, 0, 0, SERD_LITERAL };
|
||||
+ const double int_part = floor(abs_d);
|
||||
+
|
||||
+ // Point s to decimal point location
|
||||
+ char* s = buf + int_digits;
|
||||
+ if (d < 0.0) {
|
||||
+ *buf = '-';
|
||||
+ ++s;
|
||||
+ }
|
||||
+
|
||||
+ // Write integer part (right to left)
|
||||
+ char* t = s - 1;
|
||||
+ uint64_t dec = (uint64_t)int_part;
|
||||
+ do {
|
||||
+ *t-- = '0' + (dec % 10);
|
||||
+ } while ((dec /= 10) > 0);
|
||||
+
|
||||
+ *s++ = '.';
|
||||
+
|
||||
+ // Write fractional part (right to left)
|
||||
+ double frac_part = fabs(d - int_part);
|
||||
+ if (frac_part < DBL_EPSILON) {
|
||||
+ *s++ = '0';
|
||||
+ node.n_bytes = node.n_chars = (s - buf);
|
||||
+ } else {
|
||||
+ uint64_t frac = frac_part * pow(10.0, (int)frac_digits) + 0.5;
|
||||
+ s += frac_digits - 1;
|
||||
+ unsigned i = 0;
|
||||
+
|
||||
+ // Skip trailing zeros
|
||||
+ for (; i < frac_digits - 1 && !(frac % 10); ++i, --s, frac /= 10) {}
|
||||
+
|
||||
+ node.n_bytes = node.n_chars = (s - buf) + 1;
|
||||
+
|
||||
+ // Write digits from last trailing zero to decimal point
|
||||
+ for (; i < frac_digits; ++i) {
|
||||
+ *s-- = '0' + (frac % 10);
|
||||
+ frac /= 10;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_new_integer(int64_t i)
|
||||
+{
|
||||
+ int64_t abs_i = (i < 0) ? -i : i;
|
||||
+ const unsigned digits = fmax(1.0, ceil(log10((double)abs_i + 1)));
|
||||
+ char* buf = (char*)calloc(digits + 2, 1);
|
||||
+ SerdNode node = { (const uint8_t*)buf, 0, 0, 0, SERD_LITERAL };
|
||||
+
|
||||
+ // Point s to the end
|
||||
+ char* s = buf + digits - 1;
|
||||
+ if (i < 0) {
|
||||
+ *buf = '-';
|
||||
+ ++s;
|
||||
+ }
|
||||
+
|
||||
+ node.n_bytes = node.n_chars = (s - buf) + 1;
|
||||
+
|
||||
+ // Write integer part (right to left)
|
||||
+ do {
|
||||
+ *s-- = '0' + (abs_i % 10);
|
||||
+ } while ((abs_i /= 10) > 0);
|
||||
+
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ Base64 encoding table.
|
||||
+ @see <a href="http://tools.ietf.org/html/rfc3548#section-3">RFC3986 S3</a>.
|
||||
+*/
|
||||
+static const uint8_t b64_map[] =
|
||||
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
+
|
||||
+/**
|
||||
+ Encode 3 raw bytes to 4 base64 characters.
|
||||
+*/
|
||||
+static inline void
|
||||
+encode_chunk(uint8_t out[4], const uint8_t in[3], size_t n_in)
|
||||
+{
|
||||
+ out[0] = b64_map[in[0] >> 2];
|
||||
+ out[1] = b64_map[((in[0] & 0x03) << 4) | ((in[1] & 0xF0) >> 4)];
|
||||
+ out[2] = ((n_in > 1)
|
||||
+ ? (b64_map[((in[1] & 0x0F) << 2) | ((in[2] & 0xC0) >> 6)])
|
||||
+ : (uint8_t)'=');
|
||||
+ out[3] = ((n_in > 2) ? b64_map[in[2] & 0x3F] : (uint8_t)'=');
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+SerdNode
|
||||
+serd_node_new_blob(const void* buf, size_t size, bool wrap_lines)
|
||||
+{
|
||||
+ const size_t len = ((size + 2) / 3) * 4 + (wrap_lines ? (size / 57) : 0);
|
||||
+ uint8_t* str = (uint8_t*)calloc(1, len + 2);
|
||||
+ SerdNode node = { str, len, len, 0, SERD_LITERAL };
|
||||
+ for (size_t i = 0, j = 0; i < size; i += 3, j += 4) {
|
||||
+ uint8_t in[4] = { 0, 0, 0, 0 };
|
||||
+ size_t n_in = MIN(3, size - i);
|
||||
+ memcpy(in, (const uint8_t*)buf + i, n_in);
|
||||
+
|
||||
+ if (wrap_lines && i > 0 && (i % 57) == 0) {
|
||||
+ str[j++] = '\n';
|
||||
+ node.flags |= SERD_HAS_NEWLINE;
|
||||
+ }
|
||||
+
|
||||
+ encode_chunk(str + j, in, n_in);
|
||||
+ }
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+SERD_API
|
||||
+void
|
||||
+serd_node_free(SerdNode* node)
|
||||
+{
|
||||
+ if (node->buf) {
|
||||
+ free((uint8_t*)node->buf);
|
||||
+ node->buf = NULL;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,15 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
for dir in $(find . -type f -name waf); do
|
||||
pushd "${dir%/*}"
|
||||
./waf --help > /dev/null
|
||||
mv .waf-*/* .
|
||||
sed -i '/^#==>$/,$d' waf
|
||||
rmdir .waf-*
|
||||
find waflib -name "*.pyc" -delete
|
||||
popd
|
||||
for waf in $(find . -type f -name waf); do
|
||||
if grep -q '^#==>$' "${waf}"
|
||||
then
|
||||
pushd "${waf%/*}"
|
||||
python3 ./waf --help > /dev/null
|
||||
if [ -e .waf* ]
|
||||
then
|
||||
mv .waf*/* .
|
||||
sed -i '/^#==>$/,$d' waf
|
||||
rmdir .waf*
|
||||
fi
|
||||
find waflib -name "*.pyc" -o -name "__pycache__" | xargs rm -rf
|
||||
popd
|
||||
fi
|
||||
done
|
||||
#find . -name waf | xargs svn propset svn:mime-type "text/x-python"
|
||||
|
||||
echo "All waf scripts extracted successfully."
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
--- lilv/src/orig_lilv_internal.h 2012-11-23 00:00:15.000000000 -0600
|
||||
+++ lilv/src/lilv_internal.h 2013-10-27 05:18:03.970327900 -0500
|
||||
@@ -30,7 +30,6 @@
|
||||
# include <windows.h>
|
||||
# define dlopen(path, flags) LoadLibrary(path)
|
||||
# define dlclose(lib) FreeLibrary((HMODULE)lib)
|
||||
-# define dlsym GetProcAddress
|
||||
# ifdef _MSC_VER
|
||||
# define __func__ __FUNCTION__
|
||||
# define INFINITY DBL_MAX + DBL_MAX
|
||||
@@ -363,9 +362,13 @@
|
||||
static inline VoidFunc
|
||||
lilv_dlfunc(void* handle, const char* symbol)
|
||||
{
|
||||
+#ifdef _WIN32
|
||||
+ return (VoidFunc)GetProcAddress((HMODULE)handle, symbol);
|
||||
+#else
|
||||
typedef VoidFunc (*VoidFuncGetter)(void*, const char*);
|
||||
VoidFuncGetter dlfunc = (VoidFuncGetter)dlsym;
|
||||
return dlfunc(handle, symbol);
|
||||
+#endif
|
||||
}
|
||||
|
||||
#ifdef LILV_DYN_MANIFEST
|
||||
Reference in New Issue
Block a user