commit:     a514414877f8299c7a945d0205199b8759d7d47b
Author:     Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
AuthorDate: Sun Jan 17 19:36:06 2021 +0000
Commit:     Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
CommitDate: Tue Jan 26 00:21:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=a5144148

net-libs/wvstreams: new package

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>

 net-libs/wvstreams/Manifest                        |   2 +
 .../files/wvstreams-4.6.1-_DEFAULT_SOURCE.patch    |  11 +
 .../wvstreams/files/wvstreams-4.6.1-autoconf.patch |  31 ++
 .../wvstreams/files/wvstreams-4.6.1-gcc47.patch    |  50 +++
 .../files/wvstreams-4.6.1-parallel-make.patch      |  56 +++
 .../files/wvstreams-4.6.1_p14-libressl.patch       | 114 ++++++
 .../wvstreams/files/wvstreams-4.6.1_p14-llvm.patch | 412 +++++++++++++++++++++
 .../files/wvstreams-4.6.1_p14-xplc-module.patch    |  25 ++
 net-libs/wvstreams/metadata.xml                    |  16 +
 net-libs/wvstreams/wvstreams-4.6.1_p14-r1.ebuild   | 101 +++++
 10 files changed, 818 insertions(+)

diff --git a/net-libs/wvstreams/Manifest b/net-libs/wvstreams/Manifest
new file mode 100644
index 0000000..ac90826
--- /dev/null
+++ b/net-libs/wvstreams/Manifest
@@ -0,0 +1,2 @@
+DIST wvstreams_4.6.1-14.debian.tar.xz 21124 BLAKE2B 
2af6ec180c3130dd7def733e5ea569fd0a81cd2c2411daca25e6042dcbe78792bafc4b13f1c1fffddb6cd66273f11c62f54b415c975cbea0af052b18ff0955d1
 SHA512 
93ea7c4fbab542bd552d6e91ae0c49a27ad8aded177ae6474943acb08d204ab31eac49b3f416b4d90a38ea697f3641c09651a64f9c40d12543d454aadf2ad9e4
+DIST wvstreams_4.6.1.orig.tar.gz 1118456 BLAKE2B 
62243d9adc6ff5d01b7dfeb2ce24e8e530914e6ac4540e542dc3cee31e00d32211ad1c6085d7f5bd6e5fd85ff66e8c93afa37cec81f976590ba150f039dc8580
 SHA512 
59d64e527d86394b768b35254bf95ea59c412c0e092393ea3c84ec3202949150439bb6093bd7350b64ad4767acdb8feb38806c03de4e5cf238ed893f41db4a4a

diff --git a/net-libs/wvstreams/files/wvstreams-4.6.1-_DEFAULT_SOURCE.patch 
b/net-libs/wvstreams/files/wvstreams-4.6.1-_DEFAULT_SOURCE.patch
new file mode 100644
index 0000000..1084a5b
--- /dev/null
+++ b/net-libs/wvstreams/files/wvstreams-4.6.1-_DEFAULT_SOURCE.patch
@@ -0,0 +1,11 @@
+--- a/wvrules.mk
++++ b/wvrules.mk
+@@ -83,7 +83,7 @@
+ 
+ INCFLAGS=$(addprefix -I,$(WVSTREAMS_INC) $(XPATH))
+ CPPFLAGS+=$(INCFLAGS) \
+-      -D_BSD_SOURCE -D_GNU_SOURCE $(OSDEFINE) \
++      -D_DEFAULT_SOURCE $(OSDEFINE) \
+       -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
+       -DUNSTABLE
+ 

diff --git a/net-libs/wvstreams/files/wvstreams-4.6.1-autoconf.patch 
b/net-libs/wvstreams/files/wvstreams-4.6.1-autoconf.patch
new file mode 100644
index 0000000..a9b9a5a
--- /dev/null
+++ b/net-libs/wvstreams/files/wvstreams-4.6.1-autoconf.patch
@@ -0,0 +1,31 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -641,6 +641,8 @@
+ 
+ AC_CONFIG_HEADERS(include/wvautoconf.h)
+ 
++AC_CONFIG_SUBDIRS(argp)
++
+ AC_OUTPUT
+ 
+ # Now convert PACKAGE_* macros into WVPACKAGE_* in include/wvautoconf.h
+--- a/argp/configure.ac
++++ b/argp/configure.ac
+@@ -4,7 +4,7 @@
+ AC_PREREQ(2.54)
+ AC_INIT(argp-ba.c)
+ AM_INIT_AUTOMAKE(argp, standalone-1.3)
+-AM_CONFIG_HEADER(config.h)
++AC_CONFIG_HEADERS(config.h)
+ 
+ # GNU libc defaults to supplying the ISO C library functions only. The
+ # _GNU_SOURCE define enables these extensions, in particular we want
+@@ -18,7 +18,7 @@
+ AC_PROG_RANLIB
+ AC_PROGRAM_CHECK(AR,ar,ar,:)
+ AC_PROGRAM_CHECK(AR,gar,gar,:)
+-AM_PROG_CC_STDC
++AC_PROG_CC
+ 
+ AC_SUBST(AR)
+ 

diff --git a/net-libs/wvstreams/files/wvstreams-4.6.1-gcc47.patch 
b/net-libs/wvstreams/files/wvstreams-4.6.1-gcc47.patch
new file mode 100644
index 0000000..a1ad888
--- /dev/null
+++ b/net-libs/wvstreams/files/wvstreams-4.6.1-gcc47.patch
@@ -0,0 +1,50 @@
+http://bugs.gentoo.org/419563
+http://bugs.gentoo.org/419971
+
+See -gcc47-patch and -magic.patch in Fedora git:
+
+http://pkgs.fedoraproject.org/gitweb/?p=libwvstreams.git;a=tree
+
+--- a/include/wvtask.h
++++ b/include/wvtask.h
+@@ -45,7 +45,8 @@
+     typedef void TaskFunc(void *userdata);
+     
+     static int taskcount, numtasks, numrunning;
+-    int magic_number, *stack_magic;
++    int volatile magic_number;
++    int *stack_magic;
+     WvString name;
+     int tid;
+     
+@@ -84,7 +85,7 @@
+     static WvTaskMan *singleton;
+     static int links;
+     
+-    static int magic_number;
++    static int volatile magic_number;
+     static WvTaskList all_tasks, free_tasks;
+     
+     static void get_stack(WvTask &task, size_t size);
+--- a/include/wvuid.h
++++ b/include/wvuid.h
+@@ -7,6 +7,7 @@
+ #ifndef __WVUID_H
+ #define __WVUID_H
+ 
++#include <unistd.h>
+ #include "wvstring.h"
+ 
+ #if WIN32
+--- a/utils/wvtask.cc
++++ b/utils/wvtask.cc
+@@ -58,7 +58,8 @@
+ int WvTask::taskcount, WvTask::numtasks, WvTask::numrunning;
+ 
+ WvTaskMan *WvTaskMan::singleton;
+-int WvTaskMan::links, WvTaskMan::magic_number;
++int WvTaskMan::links;
++int volatile WvTaskMan::magic_number;
+ WvTaskList WvTaskMan::all_tasks, WvTaskMan::free_tasks;
+ ucontext_t WvTaskMan::stackmaster_task, WvTaskMan::get_stack_return,
+     WvTaskMan::toplevel;

diff --git a/net-libs/wvstreams/files/wvstreams-4.6.1-parallel-make.patch 
b/net-libs/wvstreams/files/wvstreams-4.6.1-parallel-make.patch
new file mode 100644
index 0000000..688178c
--- /dev/null
+++ b/net-libs/wvstreams/files/wvstreams-4.6.1-parallel-make.patch
@@ -0,0 +1,56 @@
+--- a/Makefile
++++ b/Makefile
+@@ -131,12 +131,19 @@
+ # libwvstreams: stream/event handling library
+ #
+ TARGETS += libwvstreams.so
+-TARGETS += crypto/tests/ssltest ipstreams/tests/unixtest
++TARGETS += crypto/tests/ssltest                                               
                                                                              
++crypto/tests/ssltest: $(LIBWVSTREAMS)                                         
                                                                              
++
++TARGETS += ipstreams/tests/unixtest
++ipstreams/tests/unixtest: $(LIBWVSTREAMS)
++
+ TARGETS += crypto/tests/printcert
++crypto/tests/printcert: $(LIBWVSTREAMS)
+ 
+ ifndef _MACOS
+   ifneq ("$(with_readline)", "no")
+     TARGETS += ipstreams/tests/wsd
++    ipstreams/tests/wsd: $(LIBWVSTREAMS)
+     ipstreams/tests/wsd-LIBS += -lreadline
+   else
+     TEST_SKIP_OBJS += ipstreams/tests/wsd
+@@ -179,7 +186,11 @@
+ #
+ ifneq ("$(with_dbus)", "no")
+   TARGETS += libwvdbus.so
+-  TARGETS += dbus/tests/wvdbus dbus/tests/wvdbusd
++  TARGETS += dbus/tests/wvdbus
++  dbus/tests/wvdbus: $(LIBWVDBUS)
++
++  TARGETS += dbus/tests/wvdbusd
++  dbus/tests/wvdbusd: $(LIBWVDBUS)
+   TESTS += $(call tests_cc,dbus/tests)
+   libwvdbus_OBJS += $(call objects,dbus)
+   libwvdbus.so: $(libwvdbus_OBJS) $(LIBWVSTREAMS)
+--- a/wvrules-posix.mk
++++ b/wvrules-posix.mk
+@@ -85,12 +85,15 @@
+       $(AR) s $1
+ endef
+ 
+-CC: FORCE
++CC:
+       @CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
+         $(WVSTREAMS)/gen-cc CC c
+ 
+-CXX: FORCE
++CXX:
+       @CC="$(CXX)" CFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
+         $(WVSTREAMS)/gen-cc CXX cc
+ 
++#All files must depend on the above two rules. This is a godawful hack.
++$(shell find -type f '(' -name '*.c' -o -name '*.cc' ')' ): CC CXX
++
+ wvlink=$(LINK_MSG)$(WVLINK_CC) $(LDFLAGS) $($1-LDFLAGS) -o $1 $(filter %.o 
%.a %.so, $2) $($1-LIBS) $(XX_LIBS) $(LDLIBS) $(PRELIBS) $(LIBS)

diff --git a/net-libs/wvstreams/files/wvstreams-4.6.1_p14-libressl.patch 
b/net-libs/wvstreams/files/wvstreams-4.6.1_p14-libressl.patch
new file mode 100644
index 0000000..e897c95
--- /dev/null
+++ b/net-libs/wvstreams/files/wvstreams-4.6.1_p14-libressl.patch
@@ -0,0 +1,114 @@
+From cb8a81da928054c2e8174d671f2abc88f4f35b87 Mon Sep 17 00:00:00 2001
+From: Stefan Strogin <[email protected]>
+Date: Mon, 10 Jun 2019 17:07:06 +0300
+Subject: [PATCH] Fix LibreSSL support
+
+---
+ crypto/wvocsp.cc    | 34 ++++++++++++++++++++++++++++++++++
+ crypto/wvx509mgr.cc | 14 ++++++++++++++
+ include/wvdigest.h  |  1 +
+ 3 files changed, 49 insertions(+)
+
+diff --git a/crypto/wvocsp.cc b/crypto/wvocsp.cc
+index 7d5da072..7a157f90 100644
+--- a/crypto/wvocsp.cc
++++ b/crypto/wvocsp.cc
+@@ -130,6 +130,7 @@ bool WvOCSPResp::signedbycert(const WvX509 &cert) const
+ }
+ 
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ WvX509 WvOCSPResp::get_signing_cert() const
+ {
+     const STACK_OF(X509) *certs = OCSP_resp_get0_certs(bs);
+@@ -143,6 +144,39 @@ WvX509 WvOCSPResp::get_signing_cert() const
+ 
+     return WvX509();
+ }
++#else
++WvX509 WvOCSPResp::get_signing_cert() const
++{
++    if (!bs || !sk_X509_num(bs->certs))
++        return WvX509();
++
++    // note: the following bit of code is taken almost verbatim from
++    // ocsp_vfy.c in OpenSSL 0.9.8. Copyright and attribution should
++    // properly belong to them
++
++    OCSP_RESPID *id = bs->tbsResponseData->responderId;
++
++    if (id->type == V_OCSP_RESPID_NAME)
++    {
++        X509 *x = X509_find_by_subject(bs->certs, id->value.byName);
++        if (x)
++            return WvX509(X509_dup(x));
++    }
++
++    if (id->value.byKey->length != SHA_DIGEST_LENGTH) return NULL;
++    unsigned char tmphash[SHA_DIGEST_LENGTH];
++    unsigned char *keyhash = id->value.byKey->data;
++    for (int i = 0; i < sk_X509_num(bs->certs); i++)
++    {
++        X509 *x = sk_X509_value(bs->certs, i);
++        X509_pubkey_digest(x, EVP_sha1(), tmphash, NULL);
++        if(!memcmp(keyhash, tmphash, SHA_DIGEST_LENGTH))
++            return WvX509(X509_dup(x));
++    }
++
++    return WvX509();
++}
++#endif /* LIBRESSL_VERSION_NUMBER */
+ 
+ 
+ WvOCSPResp::Status WvOCSPResp::get_status(const WvX509 &cert, 
+diff --git a/crypto/wvx509mgr.cc b/crypto/wvx509mgr.cc
+index 156d3a49..e2bb3ffe 100644
+--- a/crypto/wvx509mgr.cc
++++ b/crypto/wvx509mgr.cc
+@@ -350,8 +350,15 @@ bool WvX509Mgr::signcert(WvX509 &unsignedcert) const
+         return false;
+     }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+     uint32_t ex_flags = X509_get_extension_flags(cert);
+     uint32_t ex_kusage = X509_get_key_usage(cert);
++#else
++    X509_check_purpose(cert, -1, -1);
++    uint32_t ex_flags = cert->ex_flags;
++    uint32_t ex_kusage = (cert->ex_flags & EXFLAG_KUSAGE) ?
++                         cert->ex_kusage : UINT32_MAX;
++#endif
+     if (cert == unsignedcert.cert)
+     {
+       debug("Self Signing!\n");
+@@ -392,8 +399,15 @@ bool WvX509Mgr::signcert(WvX509 &unsignedcert) const
+ 
+ bool WvX509Mgr::signcrl(WvCRL &crl) const
+ {
++#ifndef LIBRESSL_VERSION_NUMBER
+     uint32_t ex_flags = X509_get_extension_flags(cert);
+     uint32_t ex_kusage = X509_get_key_usage(cert);
++#else
++    X509_check_purpose(cert, -1, -1);
++    uint32_t ex_flags = cert->ex_flags;
++    uint32_t ex_kusage = (cert->ex_flags & EXFLAG_KUSAGE) ?
++                         cert->ex_kusage : UINT32_MAX;
++#endif
+     if (!isok() || !crl.isok())
+     {
+         debug(WvLog::Warning, "Asked to sign CRL, but certificate or CRL (or "
+diff --git a/include/wvdigest.h b/include/wvdigest.h
+index f2eed401..e637fb49 100644
+--- a/include/wvdigest.h
++++ b/include/wvdigest.h
+@@ -10,6 +10,7 @@
+ #include "wvencoder.h"
+ #include <stdint.h>
+ #include <openssl/evp.h>
++#include <openssl/hmac.h>
+ 
+ 
+ /**
+-- 
+2.21.0
+

diff --git a/net-libs/wvstreams/files/wvstreams-4.6.1_p14-llvm.patch 
b/net-libs/wvstreams/files/wvstreams-4.6.1_p14-llvm.patch
new file mode 100644
index 0000000..156d198
--- /dev/null
+++ b/net-libs/wvstreams/files/wvstreams-4.6.1_p14-llvm.patch
@@ -0,0 +1,412 @@
+--- a/include/uniconf.h
++++ b/include/uniconf.h
+@@ -434,7 +434,7 @@
+  */
+ class UniConf::Iter : public UniConf::IterBase
+ {
+-    UniConfGen::Iter *it;
++    IUniConfGen::Iter *it;
+     
+ public:
+     /** Creates an iterator over the direct children of a branch. */
+@@ -465,7 +465,7 @@
+  */
+ class UniConf::RecursiveIter : public UniConf::IterBase
+ {
+-    UniConfGen::Iter *it;
++    IUniConfGen::Iter *it;
+ 
+ public:
+     /** Creates a recursive iterator over a branch. */
+--- a/include/uniconfgen.h
++++ b/include/uniconfgen.h
+@@ -153,8 +153,50 @@
+      */
+     virtual bool haschildren(const UniConfKey &key) = 0;
+ 
+-    /** The abstract iterator type (see below) */
+-    class Iter;
++    /**
++     * An abstract iterator over keys and values in a generator.
++     *
++     * Unlike other WvStreams iterators, this one declares virtual methods so
++     * that UniConfGen implementations can supply the right behaviour
++     * through a common interface that does not depend on static typing.
++     *
++     * The precise traversal sequence is defined by the iterator 
implementation.
++     *
++     * The iterator need not support concurrent modifications of the 
underlying
++     * data structures.
++     * 
++     * TODO: Consider changing this rule depending on observed usage patterns.
++     */
++    class Iter
++    {
++    public:
++        /** Destroys the iterator. */
++        virtual ~Iter() { }
++
++        /**
++         * Rewinds the iterator.
++         * Must be called prior to the first invocation of next().
++         */
++        virtual void rewind() = 0;
++
++        /**
++         * Seeks to the next element in the sequence.
++         * Returns true if that element exists.
++         * Must be called prior to the first invocation of key().
++         */
++        virtual bool next() = 0;
++
++        /** Returns the current key. */
++        virtual UniConfKey key() const = 0;
++        
++        /** 
++         * Returns the value of the current key.  You could just do a get(),
++         * but maybe your generator has a more efficient way.
++         */
++        virtual WvString value() const = 0;
++    };
++
++
+ 
+     /** A concrete null iterator type (see below) */
+     class NullIter;
+@@ -214,7 +256,7 @@
+ public:
+     /** Destroys the UniConfGen and may discard uncommitted data. */
+     virtual ~UniConfGen();
+-
++    
+     /***** Notification API *****/
+     
+     /**
+@@ -300,70 +342,28 @@
+ protected:
+     // A naive implementation of setv() that uses only set().
+     void setv_naive(const UniConfPairList &pairs);
+-};
+-
+-DeclareWvList(IUniConfGen);
+-DeclareWvList2(UniConfGenList, IUniConfGen);
+-
+ 
+-/**
+- * An abstract iterator over keys and values in a generator.
+- *
+- * Unlike other WvStreams iterators, this one declares virtual methods so
+- * that UniConfGen implementations can supply the right behaviour
+- * through a common interface that does not depend on static typing.
+- *
+- * The precise traversal sequence is defined by the iterator implementation.
+- *
+- * The iterator need not support concurrent modifications of the underlying
+- * data structures.
+- * 
+- * TODO: Consider changing this rule depending on observed usage patterns.
+- */
+-class UniConfGen::Iter
+-{
+ public:
+-    /** Destroys the iterator. */
+-    virtual ~Iter() { }
+-
+-    /**
+-     * Rewinds the iterator.
+-     * Must be called prior to the first invocation of next().
+-     */
+-    virtual void rewind() = 0;
+-
+     /**
+-     * Seeks to the next element in the sequence.
+-     * Returns true if that element exists.
+-     * Must be called prior to the first invocation of key().
+-     */
+-    virtual bool next() = 0;
+-
+-    /** Returns the current key. */
+-    virtual UniConfKey key() const = 0;
+-    
+-    /** 
+-     * Returns the value of the current key.  You could just do a get(),
+-     * but maybe your generator has a more efficient way.
++     * An iterator that's always empty.
++     * This is handy if you don't have anything good to iterate over.
+      */
+-    virtual WvString value() const = 0;
++    class NullIter : public UniConfGen::Iter
++    {
++    public:
++        /***** Overridden members *****/
++        
++        virtual void rewind() { }
++        virtual bool next() { return false; }
++        virtual UniConfKey key() const { return UniConfKey::EMPTY; }
++        virtual WvString value() const { return WvString(); }
++    };
+ };
+ 
++DeclareWvList(IUniConfGen);
++DeclareWvList2(UniConfGenList, IUniConfGen);
++
+ 
+-/**
+- * An iterator that's always empty.
+- * This is handy if you don't have anything good to iterate over.
+- */
+-class UniConfGen::NullIter : public UniConfGen::Iter
+-{
+-public:
+-    /***** Overridden members *****/
+-    
+-    virtual void rewind() { }
+-    virtual bool next() { return false; }
+-    virtual UniConfKey key() const { return UniConfKey::EMPTY; }
+-    virtual WvString value() const { return WvString(); }
+-};
+ 
+ 
+ #endif // __UNICONFGEN_H
+--- a/include/unifastregetgen.h
++++ b/include/unifastregetgen.h
+@@ -42,7 +42,6 @@
+     virtual bool haschildren(const UniConfKey &key);
+ 
+ private:
+-    IUniConfGen *inner;
+     UniConfValueTree *tree;
+     
+ protected:
+--- a/include/unifiltergen.h
++++ b/include/unifiltergen.h
+@@ -68,8 +68,8 @@
+     virtual bool exists(const UniConfKey &key);
+     virtual bool haschildren(const UniConfKey &key);
+     virtual bool isok();
+-    virtual Iter *iterator(const UniConfKey &key);
+-    virtual Iter *recursiveiterator(const UniConfKey &key);
++    virtual IUniConfGen::Iter *iterator(const UniConfKey &key);
++    virtual IUniConfGen::Iter *recursiveiterator(const UniConfKey &key);
+ 
+ protected:
+     /**
+--- a/include/unihashtree.h
++++ b/include/unihashtree.h
+@@ -62,10 +62,11 @@
+     UniHashTreeBase *xparent; /*!< the parent of this subtree */
+     Container *xchildren; /*!< the hash table of children */
+ 
+-private:
+     void _setparent(UniHashTreeBase *parent);
+     UniHashTreeBase *_root() const;
+ 
++private:
++
+     /** Called by a child to link itself to this node. */
+     void link(UniHashTreeBase *node);
+ 
+--- a/include/unimountgen.h
++++ b/include/unimountgen.h
+@@ -103,8 +103,8 @@
+     virtual void commit();
+     virtual bool refresh();
+     virtual void flush_buffers() { }
+-    virtual Iter *iterator(const UniConfKey &key);
+-    virtual Iter *recursiveiterator(const UniConfKey &key);
++    virtual IUniConfGen::Iter *iterator(const UniConfKey &key);
++    virtual IUniConfGen::Iter *recursiveiterator(const UniConfKey &key);
+ 
+ private:
+     /** Find the active generator for a given key. */
+--- a/include/wvmoniker.h
++++ b/include/wvmoniker.h
+@@ -72,7 +72,7 @@
+       // from IObject, which is very important. The 'for' avoids a
+       // warning.
+       for(IObject *silly = (T *)NULL; silly; )
+-            ;
++            silly = (T *)NULL;
+     };
+ };
+ 
+--- a/include/wvpushdir.h
++++ b/include/wvpushdir.h
+@@ -27,12 +27,11 @@
+ 
+     WvPushDir(WvStringParm new_dir)
+     {
+-#ifdef MACOS
+-       old_dir = static_cast<char *>(calloc(PATH_MAX, sizeof(char *)));
+-       getcwd(old_dir, PATH_MAX);;
+-#else
+-       old_dir = get_current_dir_name();
+-#endif
++        old_dir = new char[2048];
++        if (!getcwd(old_dir, 2048)) {
++            errnum = errno;
++            return;
++        }
+        dir_handle = opendir(old_dir);
+        if (chdir(new_dir) == -1)
+           errnum = errno;
+--- a/include/wvscatterhash.h
++++ b/include/wvscatterhash.h
+@@ -183,7 +183,7 @@
+         Iter(WvScatterHash &_table) : IterBase(_table) { }
+         Iter(const Iter &other) : IterBase(other) { }
+ 
+-        unsigned char *getstatus() { return &xstatus[index-1]; }
++        unsigned char *getstatus() { return &this->xstatus[index-1]; }
+ 
+         T *ptr() const
+             { return (T *)(get()); }
+--- a/include/wvserialize.h
++++ b/include/wvserialize.h
+@@ -60,6 +60,7 @@
+     return htons(i);
+ }
+ 
++#ifndef ntohll
+ /**
+  * Helper functions to convert 64 bit ints to and from host byteorder
+  */
+@@ -80,6 +81,7 @@
+     return (((uint64_t)htonl(n)) << 32) | htonl(n >> 32);
+ #endif
+ }
++#endif
+ 
+ /**
+  * A helper function that serializes different types of integers.  Since
+--- a/include/wvtask.h
++++ b/include/wvtask.h
+@@ -24,6 +24,7 @@
+ #include "wvstreamsdebugger.h"
+ #include "wvstringlist.h"
+ #include "setjmp.h"
++#define _XOPEN_SOURCE
+ #include <ucontext.h>
+ 
+ #define WVTASK_MAGIC 0x123678
+--- a/uniconf/unicachegen.cc
++++ b/uniconf/unicachegen.cc
+@@ -69,7 +69,7 @@
+ 
+ void UniCacheGen::loadtree(const UniConfKey &key)
+ {
+-    UniConfGen::Iter *i = inner->recursiveiterator(key);
++    IUniConfGen::Iter *i = inner->recursiveiterator(key);
+     if (!i) return;
+ 
+     //assert(false);
+--- a/uniconf/uniconfgen.cc
++++ b/uniconf/uniconfgen.cc
+@@ -104,7 +104,7 @@
+     
+     hold_delta();
+     
+-    Iter *it = iterator(key);
++    IUniConfGen::Iter *it = iterator(key);
+     if (it)
+     {
+       it->rewind();
+@@ -257,7 +257,7 @@
+ };
+ 
+ 
+-UniConfGen::Iter *UniConfGen::recursiveiterator(const UniConfKey &key)
++IUniConfGen::Iter *UniConfGen::recursiveiterator(const UniConfKey &key)
+ {
+     return new _UniConfGenRecursiveIter(this, key);
+ }
+--- a/uniconf/unifiltergen.cc
++++ b/uniconf/unifiltergen.cc
+@@ -134,7 +134,7 @@
+ }
+ 
+ 
+-UniConfGen::Iter *UniFilterGen::iterator(const UniConfKey &key)
++IUniConfGen::Iter *UniFilterGen::iterator(const UniConfKey &key)
+ {
+     UniConfKey mapped_key;
+     if (xinner && keymap(key, mapped_key))
+@@ -144,7 +144,7 @@
+ }
+ 
+ 
+-UniConfGen::Iter *UniFilterGen::recursiveiterator(const UniConfKey &key)
++IUniConfGen::Iter *UniFilterGen::recursiveiterator(const UniConfKey &key)
+ {
+     UniConfKey mapped_key;
+     if (xinner && keymap(key, mapped_key))
+--- a/uniconf/unifstreegen.cc
++++ b/uniconf/unifstreegen.cc
+@@ -62,7 +62,7 @@
+       log("Key '%s' not found.\n", key);
+     }
+     
+-    virtual Iter *recursiveiterator(const UniConfKey &key)
++    virtual IUniConfGen::Iter *recursiveiterator(const UniConfKey &key)
+     {
+       // don't try to optimize this like UniMountGen does, because we're
+       // going to mount things *as* we iterate through them, not sooner.
+--- a/uniconf/unimountgen.cc
++++ b/uniconf/unimountgen.cc
+@@ -305,7 +305,7 @@
+     return strcmp(*l, *r);
+ }
+ 
+-UniMountGen::Iter *UniMountGen::iterator(const UniConfKey &key)
++IUniConfGen::Iter *UniMountGen::iterator(const UniConfKey &key)
+ {
+     UniGenMount *found = findmount(key);
+     if (found)
+@@ -345,7 +345,7 @@
+ // FIXME: this function will be rather slow if you try to iterate over 
multiple
+ // generators and the latency level is high (as is the case with e.g.: the 
tcp generator). 
+ // the fast path will only kick in if you iterate over a single generator.
+-UniMountGen::Iter *UniMountGen::recursiveiterator(const UniConfKey &key)
++IUniConfGen::Iter *UniMountGen::recursiveiterator(const UniConfKey &key)
+ {
+     UniGenMount *found = findmountunder(key);
+     if (found)
+--- a/utils/t/wvpushdir.t.cc
++++ b/utils/t/wvpushdir.t.cc
+@@ -15,14 +15,9 @@
+ 
+     WVPASS(newpushdir.isok());
+ 
+-#ifdef MACOS
+-    char *pwd = static_cast<char *>(calloc(PATH_MAX,sizeof(char *)));
+-    getcwd(pwd,PATH_MAX);
+-#else
+-    char *pwd =  get_current_dir_name();
+-#endif
++    char pwd[1024] = "";
++    getcwd(pwd, sizeof(pwd));
+     WVPASSEQ(pwd, dir);
+-    free(pwd);
+ 
+     unlink(dir);
+ }
+--- a/utils/wvpam.cc
++++ b/utils/wvpam.cc
+@@ -5,6 +5,7 @@
+  * A WvStream that authenticates with PAM before allowing any reading or
+  * writing.  See wvpam.h.
+  */
++#include <pwd.h>
+ #include "wvlog.h"
+ #include "wvpam.h"
+ #include "wvautoconf.h"
+--- a/xplc/modulemgr.cc
++++ b/xplc/modulemgr.cc
+@@ -23,6 +23,7 @@
+ #include <assert.h>
+ #include "modulemgr.h"
+ #include <xplc/IModuleLoader.h>
++#include <unistd.h>
+ 
+ #include "config.h"
+ 

diff --git a/net-libs/wvstreams/files/wvstreams-4.6.1_p14-xplc-module.patch 
b/net-libs/wvstreams/files/wvstreams-4.6.1_p14-xplc-module.patch
new file mode 100644
index 0000000..a7d931c
--- /dev/null
+++ b/net-libs/wvstreams/files/wvstreams-4.6.1_p14-xplc-module.patch
@@ -0,0 +1,25 @@
+--- a/include/xplc/module.h
++++ b/include/xplc/module.h
+@@ -100,19 +100,19 @@
+    * XPLC module magic number. This is to ensure that it is in fact a
+    * valid XPLC module that has been loaded.
+    */
+-  unsigned long magic;
++  signed long magic;
+   /**
+    * The XPLC module ABI version that this module conforms to. This
+    * should always be the first member of the XPLC_ModuleInfo
+    * structure, as the meaning of the following members depend on it.
+    */
+-  unsigned int version_major;
++  signed int version_major;
+   /**
+    * The XPLC module ABI sub-version that this module conforms
+    * to. This is used for optional and backward-compatible changes in
+    * the module ABI.
+    */
+-  unsigned int version_minor;
++  signed int version_minor;
+ 
+   /**
+    * Description string for the module.

diff --git a/net-libs/wvstreams/metadata.xml b/net-libs/wvstreams/metadata.xml
new file mode 100644
index 0000000..d49958f
--- /dev/null
+++ b/net-libs/wvstreams/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<!-- maintainer-needed -->
+  <upstream>
+    <remote-id type="google-code">wvstreams</remote-id>
+  </upstream>
+  <use>
+    <flag name="boost">
+      Use <pkg>dev-libs/boost</pkg> to provide TR1-compatible
+      functional interface. This USE flag is only needed with GCC
+      earlier than version 4.1, or with other compilares not providing
+      said interface.
+    </flag>
+  </use>
+</pkgmetadata>

diff --git a/net-libs/wvstreams/wvstreams-4.6.1_p14-r1.ebuild 
b/net-libs/wvstreams/wvstreams-4.6.1_p14-r1.ebuild
new file mode 100644
index 0000000..12ad16c
--- /dev/null
+++ b/net-libs/wvstreams/wvstreams-4.6.1_p14-r1.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit autotools flag-o-matic toolchain-funcs
+
+DESCRIPTION="A network programming library in C++"
+HOMEPAGE="https://github.com/apenwarr/wvstreams";
+SRC_URI="
+       mirror://debian/pool/main/w/${PN}/${PN}_${PV/_p*}.orig.tar.gz
+       mirror://debian/pool/main/w/${PN}/${PN}_${PV/_p/-}.debian.tar.xz
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~hppa ppc sparc x86"
+IUSE="boost +dbus debug doc libressl pam"
+
+#Tests fail if openssl is not compiled with -DPURIFY. Gentoo's isn't. FAIL!
+RESTRICT="test"
+
+#QA Fail: xplc is compiled as a part of wvstreams.
+#It'll take a larger patching effort to get it extracted, since upstream 
integrated it
+#more tightly this time. Probably for the better since upstream xplc seems 
dead.
+
+RDEPEND="
+       sys-libs/readline:0=
+       sys-libs/zlib
+       dbus? ( >=sys-apps/dbus-1.4.20 )
+       !libressl? ( >=dev-libs/openssl-1.1:0= )
+       libressl? ( dev-libs/libressl:0= )
+       pam? ( sys-libs/pam )
+"
+DEPEND="
+       ${RDEPEND}
+       virtual/pkgconfig
+       doc? ( app-doc/doxygen )
+       boost? ( >=dev-libs/boost-1.34.1:= )
+"
+DOCS="ChangeLog README*"
+PATCHES=(
+       "${FILESDIR}"/${PN}-4.6.1-autoconf.patch
+       "${FILESDIR}"/${PN}-4.6.1-gcc47.patch
+       "${FILESDIR}"/${PN}-4.6.1-parallel-make.patch
+       "${FILESDIR}"/${PN}-4.6.1-_DEFAULT_SOURCE.patch
+       "${FILESDIR}"/${PN}-4.6.1_p14-xplc-module.patch
+       "${FILESDIR}"/${PN}-4.6.1_p14-llvm.patch
+)
+S=${WORKDIR}/${P/_p*}
+
+src_prepare() {
+       default
+
+       eapply $(awk '{ print "'"${WORKDIR}"'/debian/patches/" $0; }' < 
"${WORKDIR}"/debian/patches/series)
+       eapply "${FILESDIR}"/${P}-libressl.patch # bug 687096
+
+       eautoreconf
+}
+
+src_configure() {
+       append-flags -fno-strict-aliasing
+       append-flags -fno-tree-dce -fno-optimize-sibling-calls #421375
+
+       tc-export AR CXX
+
+       use boost && export ac_cv_header_tr1_functional=no
+
+       econf \
+               $(use_enable debug) \
+               $(use_with dbus) \
+               $(use_with pam) \
+               --cache-file="${T}"/config.cache \
+               --disable-optimization \
+               --localstatedir=/var \
+               --with-openssl \
+               --with-zlib \
+               --without-qt \
+               --without-tcl \
+               --without-valgrind
+}
+
+src_compile() {
+       default
+
+       if use doc; then
+               doxygen || die
+       fi
+}
+
+src_test() {
+       emake test
+}
+
+src_install() {
+       default
+
+       if use doc; then
+               docinto html
+               dodoc -r Docs/doxy-html/*
+       fi
+}

Reply via email to