pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

libstrophe: Import wip/libstrophe as libstrophe-0.8.8.



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Thu Nov 5 18:19:35 2015 +0100
Changeset:	8c01524f009a97b0a880044ef6b24c8c9fba4a70

Modified Files:
	Makefile
Added Files:
	libstrophe/DESCR
	libstrophe/Makefile
	libstrophe/PLIST
	libstrophe/buildlink3.mk
	libstrophe/distinfo
	libstrophe/patches/patch-configure.ac
	libstrophe/patches/patch-src_auth.c
	libstrophe/patches/patch-src_scram.c
	libstrophe/patches/patch-src_sha1.c
	libstrophe/patches/patch-src_sha1.h

Log Message:
libstrophe: Import wip/libstrophe as libstrophe-0.8.8.

libstrophe is a minimal XMPP library written in C. It has almost no
external dependencies, only an XML parsing library (expat or libxml are
both supported).
It is designed for both POSIX and Windows systems.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=8c01524f009a97b0a880044ef6b24c8c9fba4a70

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                              |  1 +
 libstrophe/DESCR                      |  4 ++
 libstrophe/Makefile                   | 26 ++++++++++
 libstrophe/PLIST                      |  4 ++
 libstrophe/buildlink3.mk              | 15 ++++++
 libstrophe/distinfo                   | 10 ++++
 libstrophe/patches/patch-configure.ac | 75 ++++++++++++++++++++++++++++
 libstrophe/patches/patch-src_auth.c   | 23 +++++++++
 libstrophe/patches/patch-src_scram.c  | 46 +++++++++++++++++
 libstrophe/patches/patch-src_sha1.c   | 93 +++++++++++++++++++++++++++++++++++
 libstrophe/patches/patch-src_sha1.h   | 21 ++++++++
 11 files changed, 318 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index cec0c4a..5ae0a56 100644
--- a/Makefile
+++ b/Makefile
@@ -1557,6 +1557,7 @@ SUBDIR+=	libslab
 SUBDIR+=	libsocialweb
 SUBDIR+=	libspt
 SUBDIR+=	libstacktrace
+SUBDIR+=	libstrophe
 SUBDIR+=	libsysstat
 SUBDIR+=	libtermkey
 SUBDIR+=	libtextcat
diff --git a/libstrophe/DESCR b/libstrophe/DESCR
new file mode 100644
index 0000000..022289e
--- /dev/null
+++ b/libstrophe/DESCR
@@ -0,0 +1,4 @@
+libstrophe is a minimal XMPP library written in C. It has almost no
+external dependencies, only an XML parsing library (expat or libxml are
+both supported).
+It is designed for both POSIX and Windows systems.
diff --git a/libstrophe/Makefile b/libstrophe/Makefile
new file mode 100644
index 0000000..8e3dc0f
--- /dev/null
+++ b/libstrophe/Makefile
@@ -0,0 +1,26 @@
+# $NetBSD$
+
+DISTNAME=	libstrophe-0.8.8
+CATEGORIES=	chat
+MASTER_SITES=	${MASTER_SITE_GITHUB:=strophe/}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	http://strophe.im/libstrophe/
+COMMENT=	Simple, lightweight C library for writing XMPP clients
+LICENSE=	mit OR gnu-gpl-v3
+
+GNU_CONFIGURE=	yes
+USE_LIBTOOL=	yes
+USE_TOOLS+=	autoconf automake autoreconf pkg-config
+USE_LANGUAGES=	c c++
+
+CONFIGURE_ARGS+=	--with-libxml2
+
+PKGCONFIG_OVERRIDE+=	libstrophe.pc.in
+
+pre-configure:
+	cd ${WRKSRC} && autoreconf -i
+
+.include "../../textproc/libxml2/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/libstrophe/PLIST b/libstrophe/PLIST
new file mode 100644
index 0000000..e09387c
--- /dev/null
+++ b/libstrophe/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD$
+include/strophe.h
+lib/libstrophe.la
+lib/pkgconfig/libstrophe.pc
diff --git a/libstrophe/buildlink3.mk b/libstrophe/buildlink3.mk
new file mode 100644
index 0000000..7bca5ad
--- /dev/null
+++ b/libstrophe/buildlink3.mk
@@ -0,0 +1,15 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=	libstrophe
+
+.if !defined(LIBSTROPHE_BUILDLINK3_MK)
+LIBSTROPHE_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.libstrophe+=	libstrophe>=0.8.8
+BUILDLINK_PKGSRCDIR.libstrophe?=	../../wip/libstrophe
+
+.include "../../security/openssl/buildlink3.mk"
+.include "../../textproc/libxml2/buildlink3.mk"
+.endif	# LIBSTROPHE_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-libstrophe
diff --git a/libstrophe/distinfo b/libstrophe/distinfo
new file mode 100644
index 0000000..33904cd
--- /dev/null
+++ b/libstrophe/distinfo
@@ -0,0 +1,10 @@
+$NetBSD$
+
+SHA1 (libstrophe-0.8.8.tar.gz) = c68c2e96eb8c3896b3296d8d126791dfc4cc304b
+RMD160 (libstrophe-0.8.8.tar.gz) = 3250167ebfbcb74c70cc74121c92d51bfb7efdef
+Size (libstrophe-0.8.8.tar.gz) = 128385 bytes
+SHA1 (patch-configure.ac) = b45ec265650f213f27e9e1bf62d770e6c85ee39a
+SHA1 (patch-src_auth.c) = c58624f78bf962fde3991071ec9a2a44fb79257e
+SHA1 (patch-src_scram.c) = a891d48032af53180d489e68123ae123f07f5448
+SHA1 (patch-src_sha1.c) = 51b1862e4fc9997b16efba3b045d5342df8bf8b0
+SHA1 (patch-src_sha1.h) = 38ecad8589bfbd1d0d86ac15022a45f29f910163
diff --git a/libstrophe/patches/patch-configure.ac b/libstrophe/patches/patch-configure.ac
new file mode 100644
index 0000000..2edbbea
--- /dev/null
+++ b/libstrophe/patches/patch-configure.ac
@@ -0,0 +1,75 @@
+$NetBSD$
+
+Get rid of several bash-isms.
+
+--- configure.ac.orig	2015-08-18 21:07:06.000000000 +0000
++++ configure.ac
+@@ -12,11 +12,11 @@ AS_CASE([$host_os],
+   [freebsd*], [PLATFORM="freebsd"],
+   [PLATFORM="nix"])
+ 
+-PKG_CHECK_MODULES([openssl], [openssl], [PC_REQUIRES+=(openssl)],
++PKG_CHECK_MODULES([openssl], [openssl], [PC_REQUIRES="$PC_REQUIRES openssl"],
+             [AC_CHECK_HEADER([openssl/ssl.h],
+                              [
+                               openssl_LIBS="-lssl -lcrypto"
+-                              PC_LIBS+=($openssl_LIBS)
++                              PC_LIBS="$PC_LIBS $openssl_LIBS"
+                              ],
+                              [AC_MSG_ERROR([openssl not found; openssl required])]
+                             )])
+@@ -32,7 +32,7 @@ if test "x$with_libxml2" != xno; then
+   PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
+                     [
+                      with_libxml2=yes
+-                     PC_REQUIRES+=(libxml-2.0)
++                     PC_REQUIRES="$PC_REQUIRES libxml-2.0"
+                     ],
+                     [
+                      old_CFLAGS=$CFLAGS
+@@ -42,19 +42,19 @@ if test "x$with_libxml2" != xno; then
+                                       with_libxml2=yes
+                                       libxml2_CFLAGS="-I${includedir}/libxml2"
+                                       libxml2_LIBS="-lxml2"
+-                                      PC_LIBS+=($libxml2_LIBS)
+-                                      PC_CFLAGS+=($libxml2_CFLAGS)
++                                      PC_LIBS="$PC_LIBS $libxml2_LIBS"
++                                      PC_CFLAGS="$PC_CFLAGS $libxml2_CFLAGS"
+                                      ],
+                                      [AC_MSG_ERROR([libxml2 not found.])])
+                      CFLAGS=$old_CFLAGS
+                     ])
+ else
+   PKG_CHECK_MODULES([expat], [expat >= 2.0.0],
+-                    [PC_REQUIRES+=(expat)],
++                    [PC_REQUIRES="$PC_REQUIRES expat"],
+                     [AC_CHECK_HEADER([expat.h],
+                                      [
+                                       expat_LIBS="-lexpat"
+-                                      PC_LIBS+=($expat_LIBS)
++                                      PC_LIBS="$PC_LIBS $expat_LIBS"
+                                      ],
+                                      [AC_MSG_ERROR([expat not found; expat required.])]
+                                     )
+@@ -80,7 +80,7 @@ if test "x$PLATFORM" != xfreebsd; then
+         AC_CHECK_LIB([resolv], [res_query], [],
+             [AC_CHECK_LIB([resolv], [__res_query], [],
+                 [AC_MSG_ERROR([libresolv not found; libresolv required.])])])
+-        PC_LIBS+=(-lresolv)
++        PC_LIBS="$PC_LIBS -lresolv"
+ else
+         AC_MSG_NOTICE([skipping libresolv checks for freebsd])
+ fi
+@@ -97,9 +97,9 @@ m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLD
+ 
+ AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
+ 
+-AC_SUBST([PC_REQUIRES], [${PC_REQUIRES[[@]]}])
+-AC_SUBST([PC_CFLAGS], [${PC_CFLAGS[[@]]}])
+-AC_SUBST([PC_LIBS], [${PC_LIBS[[@]]}])
++AC_SUBST(PC_REQUIRES)
++AC_SUBST(PC_CFLAGS)
++AC_SUBST(PC_LIBS)
+ 
+ AC_SUBST(PARSER_NAME)
+ AC_SUBST(PARSER_CFLAGS)
diff --git a/libstrophe/patches/patch-src_auth.c b/libstrophe/patches/patch-src_auth.c
new file mode 100644
index 0000000..b581900
--- /dev/null
+++ b/libstrophe/patches/patch-src_auth.c
@@ -0,0 +1,23 @@
+$NetBSD$
+
+Avoid conflicts with SHA1_* in libssl:
+
+ https://github.com/strophe/libstrophe/pull/59/
+
+--- src/auth.c.orig	2015-08-18 21:07:06.000000000 +0000
++++ src/auth.c
+@@ -1187,10 +1187,10 @@ int _handle_component_auth(xmpp_conn_t *
+     /* Feed the session id and passphrase to the algorithm.
+      * We need to compute SHA1(session_id + passphrase)
+      */
+-    SHA1_Init(&mdctx);
+-    SHA1_Update(&mdctx, (uint8_t*)conn->stream_id, strlen(conn->stream_id));
+-    SHA1_Update(&mdctx, (uint8_t*)conn->pass, strlen(conn->pass));
+-    SHA1_Final(&mdctx, md_value);
++    xmpp_SHA1_Init(&mdctx);
++    xmpp_SHA1_Update(&mdctx, (uint8_t*)conn->stream_id, strlen(conn->stream_id));
++    xmpp_SHA1_Update(&mdctx, (uint8_t*)conn->pass, strlen(conn->pass));
++    xmpp_SHA1_Final(&mdctx, md_value);
+ 
+     digest = xmpp_alloc(conn->ctx, 2*sizeof(md_value)+1);
+     if (digest) {
diff --git a/libstrophe/patches/patch-src_scram.c b/libstrophe/patches/patch-src_scram.c
new file mode 100644
index 0000000..5fb82d9
--- /dev/null
+++ b/libstrophe/patches/patch-src_scram.c
@@ -0,0 +1,46 @@
+$NetBSD$
+
+Avoid conflicts with SHA1_* in libssl:
+
+ https://github.com/strophe/libstrophe/pull/59/
+
+--- src/scram.c.orig	2015-08-18 21:07:06.000000000 +0000
++++ src/scram.c
+@@ -37,9 +37,9 @@ static void SHA1(const uint8_t* data, si
+                  uint8_t digest[SHA1_DIGEST_SIZE])
+ {
+     SHA1_CTX ctx;
+-    SHA1_Init(&ctx);
+-    SHA1_Update(&ctx, data, len);
+-    SHA1_Final(&ctx, digest);
++    xmpp_SHA1_Init(&ctx);
++    xmpp_SHA1_Update(&ctx, data, len);
++    xmpp_SHA1_Final(&ctx, digest);
+ }
+ 
+ static void HMAC_SHA1(const uint8_t *key, size_t key_len,
+@@ -66,15 +66,15 @@ static void HMAC_SHA1(const uint8_t *key
+         key_opad[i] = key_pad[i] ^ opad;
+     }
+ 
+-    SHA1_Init(&ctx);
+-    SHA1_Update(&ctx, key_ipad, BLOCK_SIZE);
+-    SHA1_Update(&ctx, text, len);
+-    SHA1_Final(&ctx, sha_digest);
+-
+-    SHA1_Init(&ctx);
+-    SHA1_Update(&ctx, key_opad, BLOCK_SIZE);
+-    SHA1_Update(&ctx, sha_digest, SHA1_DIGEST_SIZE);
+-    SHA1_Final(&ctx, digest);
++    xmpp_SHA1_Init(&ctx);
++    xmpp_SHA1_Update(&ctx, key_ipad, BLOCK_SIZE);
++    xmpp_SHA1_Update(&ctx, text, len);
++    xmpp_SHA1_Final(&ctx, sha_digest);
++
++    xmpp_SHA1_Init(&ctx);
++    xmpp_SHA1_Update(&ctx, key_opad, BLOCK_SIZE);
++    xmpp_SHA1_Update(&ctx, sha_digest, SHA1_DIGEST_SIZE);
++    xmpp_SHA1_Final(&ctx, digest);
+ }
+ 
+ static void SCRAM_SHA1_Hi(const uint8_t *text, size_t len,
diff --git a/libstrophe/patches/patch-src_sha1.c b/libstrophe/patches/patch-src_sha1.c
new file mode 100644
index 0000000..f9c04c6
--- /dev/null
+++ b/libstrophe/patches/patch-src_sha1.c
@@ -0,0 +1,93 @@
+$NetBSD$
+
+Avoid conflicts with SHA1_* in libssl:
+
+ https://github.com/strophe/libstrophe/pull/59/
+
+--- src/sha1.c.orig	2015-08-18 21:07:06.000000000 +0000
++++ src/sha1.c
+@@ -202,7 +202,7 @@ static void SHA1_Transform(uint32_t stat
+ 
+ 
+ /* SHA1Init - Initialize new context */
+-void SHA1_Init(SHA1_CTX* context)
++void xmpp_SHA1_Init(SHA1_CTX* context)
+ {
+     /* SHA1 initialization constants */
+     context->state[0] = 0x67452301;
+@@ -215,7 +215,7 @@ void SHA1_Init(SHA1_CTX* context)
+ 
+ 
+ /* Run your data through this. */
+-void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len)
++void xmpp_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len)
+ {
+     size_t i, j;
+ 
+@@ -244,7 +244,7 @@ void SHA1_Update(SHA1_CTX* context, cons
+ 
+ 
+ /* Add padding and return the message digest. */
+-void SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE])
++void xmpp_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE])
+ {
+     uint32_t i;
+     uint8_t  finalcount[8];
+@@ -253,11 +253,11 @@ void SHA1_Final(SHA1_CTX* context, uint8
+         finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
+          >> ((3-(i & 3)) * 8) ) & 255);  /* Endian independent */
+     }
+-    SHA1_Update(context, (uint8_t *)"\200", 1);
++    xmpp_SHA1_Update(context, (uint8_t *)"\200", 1);
+     while ((context->count[0] & 504) != 448) {
+-        SHA1_Update(context, (uint8_t *)"\0", 1);
++        xmpp_SHA1_Update(context, (uint8_t *)"\0", 1);
+     }
+-    SHA1_Update(context, finalcount, 8);  /* Should cause a SHA1_Transform() */
++    xmpp_SHA1_Update(context, finalcount, 8);  /* Should cause a SHA1_Transform() */
+     for (i = 0; i < SHA1_DIGEST_SIZE; i++) {
+         digest[i] = (uint8_t)
+          ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
+@@ -300,12 +300,12 @@ FILE* file;
+             return(-1);
+         }
+     } 
+-    SHA1_Init(&context);
++    xmpp_SHA1_Init(&context);
+     while (!feof(file)) {  /* note: what if ferror(file) */
+         i = fread(buffer, 1, 16384, file);
+-        SHA1_Update(&context, buffer, i);
++        xmpp_SHA1_Update(&context, buffer, i);
+     }
+-    SHA1_Final(&context, digest);
++    xmpp_SHA1_Final(&context, digest);
+     fclose(file);
+     for (i = 0; i < SHA1_DIGEST_SIZE/4; i++) {
+         for (j = 0; j < 4; j++) {
+@@ -358,9 +358,9 @@ int main(int argc, char** argv)
+     fprintf(stdout, "verifying SHA-1 implementation... ");
+     
+     for (k = 0; k < 2; k++){ 
+-        SHA1_Init(&context);
+-        SHA1_Update(&context, (uint8_t*)test_data[k], strlen(test_data[k]));
+-        SHA1_Final(&context, digest);
++        xmpp_SHA1_Init(&context);
++        xmpp_SHA1_Update(&context, (uint8_t*)test_data[k], strlen(test_data[k]));
++        xmpp_SHA1_Final(&context, digest);
+ 	digest_to_hex(digest, output);
+ 
+         if (strcmp(output, test_results[k])) {
+@@ -372,10 +372,10 @@ int main(int argc, char** argv)
+         }    
+     }
+     /* million 'a' vector we feed separately */
+-    SHA1_Init(&context);
++    xmpp_SHA1_Init(&context);
+     for (k = 0; k < 1000000; k++)
+-        SHA1_Update(&context, (uint8_t*)"a", 1);
+-    SHA1_Final(&context, digest);
++        xmpp_SHA1_Update(&context, (uint8_t*)"a", 1);
++    xmpp_SHA1_Final(&context, digest);
+     digest_to_hex(digest, output);
+     if (strcmp(output, test_results[2])) {
+         fprintf(stdout, "FAIL\n");
diff --git a/libstrophe/patches/patch-src_sha1.h b/libstrophe/patches/patch-src_sha1.h
new file mode 100644
index 0000000..6547a29
--- /dev/null
+++ b/libstrophe/patches/patch-src_sha1.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Avoid conflicts with SHA1_* in libssl:
+
+ https://github.com/strophe/libstrophe/pull/59/
+
+--- src/sha1.h.orig	2015-08-18 21:07:06.000000000 +0000
++++ src/sha1.h
+@@ -23,9 +23,9 @@ typedef struct {
+ 
+ #define SHA1_DIGEST_SIZE 20
+ 
+-void SHA1_Init(SHA1_CTX* context);
+-void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len);
+-void SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]);
++void xmpp_SHA1_Init(SHA1_CTX* context);
++void xmpp_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len);
++void xmpp_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]);
+ 
+ #ifdef __cplusplus
+ }


Home | Main Index | Thread Index | Old Index