diff --git a/01-NO-JIRA-Fixed-RHEL5-build-errors.patch b/01-NO-JIRA-Fixed-RHEL5-build-errors.patch new file mode 100644 index 0000000..508edba --- /dev/null +++ b/01-NO-JIRA-Fixed-RHEL5-build-errors.patch @@ -0,0 +1,40 @@ +From 4be173d6a63b41326b341c3228b2c1074359c511 Mon Sep 17 00:00:00 2001 +From: "Darryl L. Pierce" +Date: Mon, 8 Apr 2013 17:06:22 -0400 +Subject: [PATCH 1/3] NO-JIRA: Fixed RHEL5 build errors. + +Set a value for err in pn_data_appendn(). +--- + proton-c/bindings/python/proton.py | 2 +- + proton-c/src/codec/codec.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/proton-c/bindings/python/proton.py b/proton-c/bindings/python/proton.py +index d76f931..492b015 100644 +--- a/proton-c/bindings/python/proton.py ++++ b/proton-c/bindings/python/proton.py +@@ -30,7 +30,7 @@ The proton APIs consist of the following classes: + + """ + +-from cproton import * ++from _cproton import * + try: + import uuid + except ImportError: +diff --git a/proton-c/src/codec/codec.c b/proton-c/src/codec/codec.c +index c76c9dd..51dfe85 100644 +--- a/proton-c/src/codec/codec.c ++++ b/proton-c/src/codec/codec.c +@@ -2970,7 +2970,7 @@ int pn_data_append(pn_data_t *data, pn_data_t *src) + + int pn_data_appendn(pn_data_t *data, pn_data_t *src, int limit) + { +- int err; ++ int err = 0; + int level = 0, count = 0; + bool stop = false; + pn_point_t point = pn_data_point(src); +-- +1.8.3.1 + diff --git a/02-PROTON-348-Platform-neutral-helper-functions-for-exa.patch b/02-PROTON-348-Platform-neutral-helper-functions-for-exa.patch new file mode 100644 index 0000000..53affd0 --- /dev/null +++ b/02-PROTON-348-Platform-neutral-helper-functions-for-exa.patch @@ -0,0 +1,994 @@ +From c519f03332764cba2c231560dbd43c9028fb3d09 Mon Sep 17 00:00:00 2001 +From: cliffjansen +Date: Tue, 16 Jul 2013 00:55:03 +0000 +Subject: [PATCH 2/3] PROTON-348: Platform neutral helper functions for + examples and tests. + +git-svn-id: https://svn.apache.org/repos/asf/qpid/proton/trunk@1503531 13f79535-47bb-0310-9956-ffa450edef68 +--- + examples/include/pncompat/internal/LICENSE | 33 ++++ + examples/include/pncompat/internal/getopt.c | 250 ++++++++++++++++++++++++++++ + examples/include/pncompat/internal/getopt.h | 63 +++++++ + examples/include/pncompat/misc_defs.h | 48 ++++++ + examples/include/pncompat/misc_funcs.inc | 67 ++++++++ + examples/messenger/c/recv.c | 6 +- + examples/messenger/c/send.c | 6 +- + proton-c/CMakeLists.txt | 1 + + proton-c/src/proton.c | 2 +- + proton-c/wincompat/getopt.h | 39 ----- + proton-c/wincompat/internal/LICENSE | 33 ---- + proton-c/wincompat/internal/getopt.c | 250 ---------------------------- + proton-c/wincompat/internal/getopt.h | 63 ------- + 13 files changed, 465 insertions(+), 396 deletions(-) + create mode 100644 examples/include/pncompat/internal/LICENSE + create mode 100644 examples/include/pncompat/internal/getopt.c + create mode 100644 examples/include/pncompat/internal/getopt.h + create mode 100644 examples/include/pncompat/misc_defs.h + create mode 100644 examples/include/pncompat/misc_funcs.inc + delete mode 100644 proton-c/wincompat/getopt.h + delete mode 100644 proton-c/wincompat/internal/LICENSE + delete mode 100644 proton-c/wincompat/internal/getopt.c + delete mode 100644 proton-c/wincompat/internal/getopt.h + +diff --git a/examples/include/pncompat/internal/LICENSE b/examples/include/pncompat/internal/LICENSE +new file mode 100644 +index 0000000..99efb42 +--- /dev/null ++++ b/examples/include/pncompat/internal/LICENSE +@@ -0,0 +1,33 @@ ++Free Getopt ++Copyright (c)2002-2003 Mark K. Kim ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions ++are met: ++ ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in ++ the documentation and/or other materials provided with the ++ distribution. ++ ++ * Neither the original author of this software nor the names of its ++ contributors may be used to endorse or promote products derived ++ from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS ++OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ++AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF ++THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++DAMAGE. ++ +diff --git a/examples/include/pncompat/internal/getopt.c b/examples/include/pncompat/internal/getopt.c +new file mode 100644 +index 0000000..7ef9a68 +--- /dev/null ++++ b/examples/include/pncompat/internal/getopt.c +@@ -0,0 +1,250 @@ ++/***************************************************************************** ++* getopt.c - competent and free getopt library. ++* $Header: /cvsroot/freegetopt/freegetopt/getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $ ++* ++* Copyright (c)2002-2003 Mark K. Kim ++* All rights reserved. ++* ++* Redistribution and use in source and binary forms, with or without ++* modification, are permitted provided that the following conditions ++* are met: ++* ++* * Redistributions of source code must retain the above copyright ++* notice, this list of conditions and the following disclaimer. ++* ++* * Redistributions in binary form must reproduce the above copyright ++* notice, this list of conditions and the following disclaimer in ++* the documentation and/or other materials provided with the ++* distribution. ++* ++* * Neither the original author of this software nor the names of its ++* contributors may be used to endorse or promote products derived ++* from this software without specific prior written permission. ++* ++* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS ++* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ++* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF ++* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++* DAMAGE. ++*/ ++#include ++#include ++#include ++#include "getopt.h" ++ ++ ++static const char* ID = "$Id: getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $"; ++ ++ ++char* optarg = NULL; ++int optind = 0; ++int opterr = 1; ++int optopt = '?'; ++ ++ ++static char** prev_argv = NULL; /* Keep a copy of argv and argc to */ ++static int prev_argc = 0; /* tell if getopt params change */ ++static int argv_index = 0; /* Option we're checking */ ++static int argv_index2 = 0; /* Option argument we're checking */ ++static int opt_offset = 0; /* Index into compounded "-option" */ ++static int dashdash = 0; /* True if "--" option reached */ ++static int nonopt = 0; /* How many nonopts we've found */ ++ ++static void increment_index() ++{ ++ /* Move onto the next option */ ++ if(argv_index < argv_index2) ++ { ++ while(prev_argv[++argv_index] && prev_argv[argv_index][0] != '-' ++ && argv_index < argv_index2+1); ++ } ++ else argv_index++; ++ opt_offset = 1; ++} ++ ++ ++/* ++* Permutes argv[] so that the argument currently being processed is moved ++* to the end. ++*/ ++static int permute_argv_once() ++{ ++ /* Movability check */ ++ if(argv_index + nonopt >= prev_argc) return 1; ++ /* Move the current option to the end, bring the others to front */ ++ else ++ { ++ char* tmp = prev_argv[argv_index]; ++ ++ /* Move the data */ ++ memmove(&prev_argv[argv_index], &prev_argv[argv_index+1], ++ sizeof(char**) * (prev_argc - argv_index - 1)); ++ prev_argv[prev_argc - 1] = tmp; ++ ++ nonopt++; ++ return 0; ++ } ++} ++ ++ ++int getopt(int argc, char** argv, char* optstr) ++{ ++ int c = 0; ++ ++ /* If we have new argv, reinitialize */ ++ if(prev_argv != argv || prev_argc != argc) ++ { ++ /* Initialize variables */ ++ prev_argv = argv; ++ prev_argc = argc; ++ argv_index = 1; ++ argv_index2 = 1; ++ opt_offset = 1; ++ dashdash = 0; ++ nonopt = 0; ++ } ++ ++ /* Jump point in case we want to ignore the current argv_index */ ++ getopt_top: ++ ++ /* Misc. initializations */ ++ optarg = NULL; ++ ++ /* Dash-dash check */ ++ if(argv[argv_index] && !strcmp(argv[argv_index], "--")) ++ { ++ dashdash = 1; ++ increment_index(); ++ } ++ ++ /* If we're at the end of argv, that's it. */ ++ if(argv[argv_index] == NULL) ++ { ++ c = -1; ++ } ++ /* Are we looking at a string? Single dash is also a string */ ++ else if(dashdash || argv[argv_index][0] != '-' || !strcmp(argv[argv_index], "-")) ++ { ++ /* If we want a string... */ ++ if(optstr[0] == '-') ++ { ++ c = 1; ++ optarg = argv[argv_index]; ++ increment_index(); ++ } ++ /* If we really don't want it (we're in POSIX mode), we're done */ ++ else if(optstr[0] == '+' || getenv("POSIXLY_CORRECT")) ++ { ++ c = -1; ++ ++ /* Everything else is a non-opt argument */ ++ nonopt = argc - argv_index; ++ } ++ /* If we mildly don't want it, then move it back */ ++ else ++ { ++ if(!permute_argv_once()) goto getopt_top; ++ else c = -1; ++ } ++ } ++ /* Otherwise we're looking at an option */ ++ else ++ { ++ char* opt_ptr = NULL; ++ ++ /* Grab the option */ ++ c = argv[argv_index][opt_offset++]; ++ ++ /* Is the option in the optstr? */ ++ if(optstr[0] == '-') opt_ptr = strchr(optstr+1, c); ++ else opt_ptr = strchr(optstr, c); ++ /* Invalid argument */ ++ if(!opt_ptr) ++ { ++ if(opterr) ++ { ++ fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); ++ } ++ ++ optopt = c; ++ c = '?'; ++ ++ /* Move onto the next option */ ++ increment_index(); ++ } ++ /* Option takes argument */ ++ else if(opt_ptr[1] == ':') ++ { ++ /* ie, -oARGUMENT, -xxxoARGUMENT, etc. */ ++ if(argv[argv_index][opt_offset] != '\0') ++ { ++ optarg = &argv[argv_index][opt_offset]; ++ increment_index(); ++ } ++ /* ie, -o ARGUMENT (only if it's a required argument) */ ++ else if(opt_ptr[2] != ':') ++ { ++ /* One of those "you're not expected to understand this" moment */ ++ if(argv_index2 < argv_index) argv_index2 = argv_index; ++ while(argv[++argv_index2] && argv[argv_index2][0] == '-'); ++ optarg = argv[argv_index2]; ++ ++ /* Don't cross into the non-option argument list */ ++ if(argv_index2 + nonopt >= prev_argc) optarg = NULL; ++ ++ /* Move onto the next option */ ++ increment_index(); ++ } ++ else ++ { ++ /* Move onto the next option */ ++ increment_index(); ++ } ++ ++ /* In case we got no argument for an option with required argument */ ++ if(optarg == NULL && opt_ptr[2] != ':') ++ { ++ optopt = c; ++ c = '?'; ++ ++ if(opterr) ++ { ++ fprintf(stderr,"%s: option requires an argument -- %c\n", ++ argv[0], optopt); ++ } ++ } ++ } ++ /* Option does not take argument */ ++ else ++ { ++ /* Next argv_index */ ++ if(argv[argv_index][opt_offset] == '\0') ++ { ++ increment_index(); ++ } ++ } ++ } ++ ++ /* Calculate optind */ ++ if(c == -1) ++ { ++ optind = argc - nonopt; ++ } ++ else ++ { ++ optind = argv_index; ++ } ++ ++ return c; ++} ++ ++ ++/* vim:ts=3 ++*/ +diff --git a/examples/include/pncompat/internal/getopt.h b/examples/include/pncompat/internal/getopt.h +new file mode 100644 +index 0000000..0b78650 +--- /dev/null ++++ b/examples/include/pncompat/internal/getopt.h +@@ -0,0 +1,63 @@ ++/***************************************************************************** ++* getopt.h - competent and free getopt library. ++* $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $ ++* ++* Copyright (c)2002-2003 Mark K. Kim ++* All rights reserved. ++* ++* Redistribution and use in source and binary forms, with or without ++* modification, are permitted provided that the following conditions ++* are met: ++* ++* * Redistributions of source code must retain the above copyright ++* notice, this list of conditions and the following disclaimer. ++* ++* * Redistributions in binary form must reproduce the above copyright ++* notice, this list of conditions and the following disclaimer in ++* the documentation and/or other materials provided with the ++* distribution. ++* ++* * Neither the original author of this software nor the names of its ++* contributors may be used to endorse or promote products derived ++* from this software without specific prior written permission. ++* ++* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS ++* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ++* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF ++* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++* DAMAGE. ++*/ ++#ifndef GETOPT_H_ ++#define GETOPT_H_ ++ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++extern char* optarg; ++extern int optind; ++extern int opterr; ++extern int optopt; ++ ++int getopt(int argc, char** argv, char* optstr); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++#endif /* GETOPT_H_ */ ++ ++ ++/* vim:ts=3 ++*/ +diff --git a/examples/include/pncompat/misc_defs.h b/examples/include/pncompat/misc_defs.h +new file mode 100644 +index 0000000..00d5f67 +--- /dev/null ++++ b/examples/include/pncompat/misc_defs.h +@@ -0,0 +1,48 @@ ++#ifndef PNCOMAPT_MISC_DEFS_H ++#define PNCOMAPT_MISC_DEFS_H ++ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, ++ * software distributed under the License is distributed on an ++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++ * KIND, either express or implied. See the License for the ++ * specific language governing permissions and limitations ++ * under the License. ++ * ++ */ ++ ++#if defined(qpid_proton_EXPORTS) ++#error This include file is not for use in the main proton library ++#endif ++ ++/* ++ * Platform neutral definitions. Only intended for use by Proton ++ * examples and test/debug programs. ++ * ++ * This file and any related support files may change or be removed ++ * at any time. ++ */ ++ ++// getopt() ++ ++#include ++ ++#if !defined(_WIN32) || defined (__CYGWIN__) ++#include ++#else ++#include "internal/getopt.h" ++#endif ++ ++pn_timestamp_t time_now(); ++ ++#endif /* PNCOMPAT_MISC_DEFS_H */ +diff --git a/examples/include/pncompat/misc_funcs.inc b/examples/include/pncompat/misc_funcs.inc +new file mode 100644 +index 0000000..921d1d3 +--- /dev/null ++++ b/examples/include/pncompat/misc_funcs.inc +@@ -0,0 +1,67 @@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, ++ * software distributed under the License is distributed on an ++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++ * KIND, either express or implied. See the License for the ++ * specific language governing permissions and limitations ++ * under the License. ++ * ++ */ ++ ++/* ++ * This file provides the functions for "misc_defs.h" in the form of ++ * included code, as opposed to a separate library or object ++ * dependency. In the absence of portable "pragma weak" compiler ++ * directives, this provides a simple workaround. ++ * ++ * Usage for a single compilation unit: ++ * ++ * #include "pncompat/misc_funcs.inc" ++ * ++ * Usage for multiple combined compilation units: chose one to include ++ * "pncompat/misc_funcs.inc" as above and in each other unit needing the ++ * definitions use ++ * ++ * #include "pncompat/misc_defs.h" ++ * ++ */ ++ ++#include "misc_defs.h" ++ ++#if defined(_WIN32) && ! defined(__CYGWIN__) ++#include "pncompat/internal/getopt.c" ++#endif ++ ++#if defined(_WIN32) && ! defined(__CYGWIN__) ++#include ++pn_timestamp_t time_now(void) ++{ ++ FILETIME now; ++ GetSystemTimeAsFileTime(&now); ++ ULARGE_INTEGER t; ++ t.u.HighPart = now.dwHighDateTime; ++ t.u.LowPart = now.dwLowDateTime; ++ // Convert to milliseconds and adjust base epoch ++ return t.QuadPart / 10000 - 11644473600000; ++} ++#else ++#include ++#include ++#include ++pn_timestamp_t time_now(void) ++{ ++ struct timeval now; ++ if (gettimeofday(&now, NULL)) pn_fatal("gettimeofday failed\n"); ++ return ((pn_timestamp_t)now.tv_sec) * 1000 + (now.tv_usec / 1000); ++} ++#endif +diff --git a/examples/messenger/c/recv.c b/examples/messenger/c/recv.c +index 50a2787..b2c974d 100644 +--- a/examples/messenger/c/recv.c ++++ b/examples/messenger/c/recv.c +@@ -21,11 +21,7 @@ + #include "proton/message.h" + #include "proton/messenger.h" + +-#if defined(_WIN32) && ! defined(__CYGWIN__) +-#include "../../../proton-c/wincompat/getopt.h" +-#else +-#include +-#endif ++#include "pncompat/misc_funcs.inc" + #include + #include + #include +diff --git a/examples/messenger/c/send.c b/examples/messenger/c/send.c +index 77f772a..a7e91a2 100644 +--- a/examples/messenger/c/send.c ++++ b/examples/messenger/c/send.c +@@ -21,11 +21,7 @@ + #include "proton/message.h" + #include "proton/messenger.h" + +-#if defined(_WIN32) && ! defined(__CYGWIN__) +-#include "../../../proton-c/wincompat/getopt.h" +-#else +-#include +-#endif ++#include "pncompat/misc_funcs.inc" + #include + #include + #include +diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt +index 74d302a..c8ee531 100644 +--- a/proton-c/CMakeLists.txt ++++ b/proton-c/CMakeLists.txt +@@ -57,6 +57,7 @@ configure_file ( + + include_directories ("${CMAKE_CURRENT_BINARY_DIR}") + include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include") ++include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../examples/include") + + add_custom_command ( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/encodings.h +diff --git a/proton-c/src/proton.c b/proton-c/src/proton.c +index 370bfd5..552c9c2 100644 +--- a/proton-c/src/proton.c ++++ b/proton-c/src/proton.c +@@ -22,7 +22,7 @@ + #if defined(_WIN32) && ! defined(__CYGWIN__) + #define NOGDI + #include +-#include "../wincompat/getopt.h" ++#include "pncompat/misc_funcs.inc" + #else + #include + #include +diff --git a/proton-c/wincompat/getopt.h b/proton-c/wincompat/getopt.h +deleted file mode 100644 +index 5106c29..0000000 +--- a/proton-c/wincompat/getopt.h ++++ /dev/null +@@ -1,39 +0,0 @@ +-/* +- * +- * Licensed to the Apache Software Foundation (ASF) under one +- * or more contributor license agreements. See the NOTICE file +- * distributed with this work for additional information +- * regarding copyright ownership. The ASF licenses this file +- * to you under the Apache License, Version 2.0 (the +- * "License"); you may not use this file except in compliance +- * with the License. You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, +- * software distributed under the License is distributed on an +- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +- * KIND, either express or implied. See the License for the +- * specific language governing permissions and limitations +- * under the License. +- * +- */ +- +-/* +- * Provides an embedded getopt implementation to the C file including +- * this. Only intended for use by Proton examples and test/debug +- * programs to run on Windows. +- * +- * This file and any internal support files may change or be removed +- * at any time. +- */ +- +-#if defined(qpid_proton_EXPORTS) +-#error This include file is not for use in the main proton library +-#endif +- +-#if !defined(_WIN32) || defined (__CYGWIN__) +-#error This include file only intended for Windows compatibility. +-#endif +- +-#include "internal/getopt.c" +diff --git a/proton-c/wincompat/internal/LICENSE b/proton-c/wincompat/internal/LICENSE +deleted file mode 100644 +index 99efb42..0000000 +--- a/proton-c/wincompat/internal/LICENSE ++++ /dev/null +@@ -1,33 +0,0 @@ +-Free Getopt +-Copyright (c)2002-2003 Mark K. Kim +-All rights reserved. +- +-Redistribution and use in source and binary forms, with or without +-modification, are permitted provided that the following conditions +-are met: +- +- * Redistributions of source code must retain the above copyright +- notice, this list of conditions and the following disclaimer. +- +- * Redistributions in binary form must reproduce the above copyright +- notice, this list of conditions and the following disclaimer in +- the documentation and/or other materials provided with the +- distribution. +- +- * Neither the original author of this software nor the names of its +- contributors may be used to endorse or promote products derived +- from this software without specific prior written permission. +- +-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +-THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +-DAMAGE. +- +diff --git a/proton-c/wincompat/internal/getopt.c b/proton-c/wincompat/internal/getopt.c +deleted file mode 100644 +index 7ef9a68..0000000 +--- a/proton-c/wincompat/internal/getopt.c ++++ /dev/null +@@ -1,250 +0,0 @@ +-/***************************************************************************** +-* getopt.c - competent and free getopt library. +-* $Header: /cvsroot/freegetopt/freegetopt/getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $ +-* +-* Copyright (c)2002-2003 Mark K. Kim +-* All rights reserved. +-* +-* Redistribution and use in source and binary forms, with or without +-* modification, are permitted provided that the following conditions +-* are met: +-* +-* * Redistributions of source code must retain the above copyright +-* notice, this list of conditions and the following disclaimer. +-* +-* * Redistributions in binary form must reproduce the above copyright +-* notice, this list of conditions and the following disclaimer in +-* the documentation and/or other materials provided with the +-* distribution. +-* +-* * Neither the original author of this software nor the names of its +-* contributors may be used to endorse or promote products derived +-* from this software without specific prior written permission. +-* +-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +-* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +-* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +-* DAMAGE. +-*/ +-#include +-#include +-#include +-#include "getopt.h" +- +- +-static const char* ID = "$Id: getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $"; +- +- +-char* optarg = NULL; +-int optind = 0; +-int opterr = 1; +-int optopt = '?'; +- +- +-static char** prev_argv = NULL; /* Keep a copy of argv and argc to */ +-static int prev_argc = 0; /* tell if getopt params change */ +-static int argv_index = 0; /* Option we're checking */ +-static int argv_index2 = 0; /* Option argument we're checking */ +-static int opt_offset = 0; /* Index into compounded "-option" */ +-static int dashdash = 0; /* True if "--" option reached */ +-static int nonopt = 0; /* How many nonopts we've found */ +- +-static void increment_index() +-{ +- /* Move onto the next option */ +- if(argv_index < argv_index2) +- { +- while(prev_argv[++argv_index] && prev_argv[argv_index][0] != '-' +- && argv_index < argv_index2+1); +- } +- else argv_index++; +- opt_offset = 1; +-} +- +- +-/* +-* Permutes argv[] so that the argument currently being processed is moved +-* to the end. +-*/ +-static int permute_argv_once() +-{ +- /* Movability check */ +- if(argv_index + nonopt >= prev_argc) return 1; +- /* Move the current option to the end, bring the others to front */ +- else +- { +- char* tmp = prev_argv[argv_index]; +- +- /* Move the data */ +- memmove(&prev_argv[argv_index], &prev_argv[argv_index+1], +- sizeof(char**) * (prev_argc - argv_index - 1)); +- prev_argv[prev_argc - 1] = tmp; +- +- nonopt++; +- return 0; +- } +-} +- +- +-int getopt(int argc, char** argv, char* optstr) +-{ +- int c = 0; +- +- /* If we have new argv, reinitialize */ +- if(prev_argv != argv || prev_argc != argc) +- { +- /* Initialize variables */ +- prev_argv = argv; +- prev_argc = argc; +- argv_index = 1; +- argv_index2 = 1; +- opt_offset = 1; +- dashdash = 0; +- nonopt = 0; +- } +- +- /* Jump point in case we want to ignore the current argv_index */ +- getopt_top: +- +- /* Misc. initializations */ +- optarg = NULL; +- +- /* Dash-dash check */ +- if(argv[argv_index] && !strcmp(argv[argv_index], "--")) +- { +- dashdash = 1; +- increment_index(); +- } +- +- /* If we're at the end of argv, that's it. */ +- if(argv[argv_index] == NULL) +- { +- c = -1; +- } +- /* Are we looking at a string? Single dash is also a string */ +- else if(dashdash || argv[argv_index][0] != '-' || !strcmp(argv[argv_index], "-")) +- { +- /* If we want a string... */ +- if(optstr[0] == '-') +- { +- c = 1; +- optarg = argv[argv_index]; +- increment_index(); +- } +- /* If we really don't want it (we're in POSIX mode), we're done */ +- else if(optstr[0] == '+' || getenv("POSIXLY_CORRECT")) +- { +- c = -1; +- +- /* Everything else is a non-opt argument */ +- nonopt = argc - argv_index; +- } +- /* If we mildly don't want it, then move it back */ +- else +- { +- if(!permute_argv_once()) goto getopt_top; +- else c = -1; +- } +- } +- /* Otherwise we're looking at an option */ +- else +- { +- char* opt_ptr = NULL; +- +- /* Grab the option */ +- c = argv[argv_index][opt_offset++]; +- +- /* Is the option in the optstr? */ +- if(optstr[0] == '-') opt_ptr = strchr(optstr+1, c); +- else opt_ptr = strchr(optstr, c); +- /* Invalid argument */ +- if(!opt_ptr) +- { +- if(opterr) +- { +- fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); +- } +- +- optopt = c; +- c = '?'; +- +- /* Move onto the next option */ +- increment_index(); +- } +- /* Option takes argument */ +- else if(opt_ptr[1] == ':') +- { +- /* ie, -oARGUMENT, -xxxoARGUMENT, etc. */ +- if(argv[argv_index][opt_offset] != '\0') +- { +- optarg = &argv[argv_index][opt_offset]; +- increment_index(); +- } +- /* ie, -o ARGUMENT (only if it's a required argument) */ +- else if(opt_ptr[2] != ':') +- { +- /* One of those "you're not expected to understand this" moment */ +- if(argv_index2 < argv_index) argv_index2 = argv_index; +- while(argv[++argv_index2] && argv[argv_index2][0] == '-'); +- optarg = argv[argv_index2]; +- +- /* Don't cross into the non-option argument list */ +- if(argv_index2 + nonopt >= prev_argc) optarg = NULL; +- +- /* Move onto the next option */ +- increment_index(); +- } +- else +- { +- /* Move onto the next option */ +- increment_index(); +- } +- +- /* In case we got no argument for an option with required argument */ +- if(optarg == NULL && opt_ptr[2] != ':') +- { +- optopt = c; +- c = '?'; +- +- if(opterr) +- { +- fprintf(stderr,"%s: option requires an argument -- %c\n", +- argv[0], optopt); +- } +- } +- } +- /* Option does not take argument */ +- else +- { +- /* Next argv_index */ +- if(argv[argv_index][opt_offset] == '\0') +- { +- increment_index(); +- } +- } +- } +- +- /* Calculate optind */ +- if(c == -1) +- { +- optind = argc - nonopt; +- } +- else +- { +- optind = argv_index; +- } +- +- return c; +-} +- +- +-/* vim:ts=3 +-*/ +diff --git a/proton-c/wincompat/internal/getopt.h b/proton-c/wincompat/internal/getopt.h +deleted file mode 100644 +index 0b78650..0000000 +--- a/proton-c/wincompat/internal/getopt.h ++++ /dev/null +@@ -1,63 +0,0 @@ +-/***************************************************************************** +-* getopt.h - competent and free getopt library. +-* $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $ +-* +-* Copyright (c)2002-2003 Mark K. Kim +-* All rights reserved. +-* +-* Redistribution and use in source and binary forms, with or without +-* modification, are permitted provided that the following conditions +-* are met: +-* +-* * Redistributions of source code must retain the above copyright +-* notice, this list of conditions and the following disclaimer. +-* +-* * Redistributions in binary form must reproduce the above copyright +-* notice, this list of conditions and the following disclaimer in +-* the documentation and/or other materials provided with the +-* distribution. +-* +-* * Neither the original author of this software nor the names of its +-* contributors may be used to endorse or promote products derived +-* from this software without specific prior written permission. +-* +-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +-* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +-* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +-* DAMAGE. +-*/ +-#ifndef GETOPT_H_ +-#define GETOPT_H_ +- +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +- +-extern char* optarg; +-extern int optind; +-extern int opterr; +-extern int optopt; +- +-int getopt(int argc, char** argv, char* optstr); +- +- +-#ifdef __cplusplus +-} +-#endif +- +- +-#endif /* GETOPT_H_ */ +- +- +-/* vim:ts=3 +-*/ +-- +1.8.3.1 + diff --git a/03-PROTON-364-Install-C-examples.patch b/03-PROTON-364-Install-C-examples.patch new file mode 100644 index 0000000..a1542d9 --- /dev/null +++ b/03-PROTON-364-Install-C-examples.patch @@ -0,0 +1,76 @@ +From bd97c8923c55063a66233e400fbd57cb772664e4 Mon Sep 17 00:00:00 2001 +From: mcpierce +Date: Wed, 24 Jul 2013 18:31:44 +0000 +Subject: [PATCH 3/3] PROTON-364: Install C examples. + +Added a install variable, EXAMPLES_INSTALL_DIR. + +Installs the send.c, recv.c, CMakeLists.txt files from the +examples/messenger/c directory. Also installs the getopt.c and getopt.h +files, related LICENSE, and the misc_defs.h and misc_funcs.inc files. + +git-svn-id: https://svn.apache.org/repos/asf/qpid/proton/trunk@1506653 13f79535-47bb-0310-9956-ffa450edef68 +--- + CMakeLists.txt | 21 +++++++++++++++++++++ + examples/messenger/c/CMakeLists.txt | 6 ++++++ + 2 files changed, 27 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f16a570..9e852c3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -69,6 +69,14 @@ set (SYSCONF_INSTALL_DIR etc CACHE PATH "System read only configuration director + set (SHARE_INSTALL_DIR share CACHE PATH "Shared read only data directory") + set (MAN_INSTALL_DIR share/man CACHE PATH "Manpage directory") + ++if (WIN32) ++ set (EXAMPLES_INSTALL_DIR proton/examples) ++endif (WIN32) ++ ++if (UNIX) ++ set (EXAMPLES_INSTALL_DIR ${SHARE_INSTALL_DIR}/proton/examples) ++endif (UNIX) ++ + set (JAVA_INSTALL_DIR ${SHARE_INSTALL_DIR}/java CACHE PATH "Installation directory for all JARs except those using JNI") + set (JNI_INSTALL_DIR ${LIB_INSTALL_DIR}/java CACHE PATH "Installation directory for all JARs utilising JNI") + set (JNI_SHARED_LIB_INSTALL_DIR ${LIB_INSTALL_DIR} CACHE PATH "Installation directory for shared objects used by JNI JARs") +@@ -99,6 +107,19 @@ add_subdirectory(proton-c) + install (FILES LICENSE README TODO + DESTINATION ${PROTON_SHARE}) + ++# install the C messenger example ++install (FILES examples/messenger/c/CMakeLists.txt ++ examples/messenger/c/send.c ++ examples/messenger/c/recv.c ++ DESTINATION ${EXAMPLES_INSTALL_DIR}/messenger) ++ ++install (FILES examples/include/pncompat/internal/LICENSE ++ examples/include/pncompat/internal/getopt.c ++ examples/include/pncompat/internal/getopt.h ++ examples/include/pncompat/misc_defs.h ++ examples/include/pncompat/misc_funcs.inc ++ DESTINATION ${EXAMPLES_INSTALL_DIR}/messenger/pncompat) ++ + # add relevant CTest support + find_program (MAVEN_EXECUTABLE mvn DOC "Location of the maven program") + if (JAVA_FOUND AND MAVEN_EXECUTABLE AND DEFINED ENV{M2_HOME}) +diff --git a/examples/messenger/c/CMakeLists.txt b/examples/messenger/c/CMakeLists.txt +index 4d2719c..faf5e85 100644 +--- a/examples/messenger/c/CMakeLists.txt ++++ b/examples/messenger/c/CMakeLists.txt +@@ -17,6 +17,12 @@ + # under the License. + # + ++cmake_minimum_required (VERSION 2.6) ++ ++find_path(PROTON_INCLUDE_DIR proton/types.h) ++find_library(PROTON_LIBRARY ++ NAMES qpid-proton) ++ + add_executable(recv recv.c) + add_executable(send send.c) + +-- +1.8.3.1 + diff --git a/qpid-proton.spec b/qpid-proton.spec index a4f55e0..274dfba 100644 --- a/qpid-proton.spec +++ b/qpid-proton.spec @@ -2,7 +2,7 @@ Name: qpid-proton Version: 0.4 -Release: 2.2%{?dist} +Release: 3%{?dist} Summary: A high performance, lightweight messaging library License: ASL 2.0 @@ -19,6 +19,11 @@ BuildRequires: python-devel BuildRequires: epydoc +Patch1: 01-NO-JIRA-Fixed-RHEL5-build-errors.patch +# BZ#975723 +Patch2: 02-PROTON-348-Platform-neutral-helper-functions-for-exa.patch +Patch3: 03-PROTON-364-Install-C-examples.patch + %description Proton is a high performance, lightweight messaging library. It can be used in the widest range of messaging applications including brokers, client libraries, @@ -72,6 +77,7 @@ Provides: qpid-proton-devel = %{version}-%{release} %{_libdir}/libqpid-proton.so %{_libdir}/pkgconfig/libqpid-proton.pc %{proton_datadir}/docs/api-c +%{_datadir}/proton/examples %package -n python-qpid-proton @@ -109,6 +115,9 @@ Summary: Documentation for the Python language bindings for Qpid Proton %prep %setup -q -n %{name}-%{version} +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %cmake -DPROTON_DISABLE_RPATH=true . @@ -121,14 +130,20 @@ make all docs %{?_smp_mflags} chmod +x %{buildroot}%{python_sitearch}/_cproton.so # clean up files that are not shipped +rm -rf %{buildroot}%{_libdir}/perl5 rm -rf %{buildroot}%{_libdir}/php rm -rf %{buildroot}%{_libdir}/java +rm -rf %{buildroot}%{_libdir}/ruby rm -rf %{buildroot}%{_libdir}/libproton-jni.so rm -rf %{buildroot}%{_datarootdir}/php rm -rf %{buildroot}%{_datarootdir}/java rm -rf %{buildroot}%{_sysconfdir}/php.d %changelog +* Wed Jul 24 2013 Darryl L. Pierce - 0.4-3 +- Provide examples for qpid-proton-c +- Resolves: BZ#975723 + * Fri Apr 4 2013 Darryl L. Pierce - 0.4-2.2 - Added Obsoletes and Provides for packages whose names changed. - Resolves: BZ#948784