From 7d2cc3af9123589f67148597d907aac51ffb08a7 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 20:13:19 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/Makefile b/Makefile index 506dc11..e428c83 100755 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CHECK_FILES+= CONFIGURATION.md \ examples/rdkafka_example_cpp PACKAGE_NAME?= librdkafka -VERSION?= $(shell python3 packaging/get_version.py src/rdkafka.h) +VERSION?= $(shell python packaging/get_version.py src/rdkafka.h) # Jenkins CI integration BUILD_NUMBER ?= 1 diff --git a/Makefile.python3 b/Makefile.python3 deleted file mode 100755 index e428c83..0000000 --- a/Makefile.python3 +++ /dev/null @@ -1,68 +0,0 @@ -LIBSUBDIRS= src src-cpp - -CHECK_FILES+= CONFIGURATION.md \ - examples/rdkafka_example examples/rdkafka_performance \ - examples/rdkafka_example_cpp - -PACKAGE_NAME?= librdkafka -VERSION?= $(shell python packaging/get_version.py src/rdkafka.h) - -# Jenkins CI integration -BUILD_NUMBER ?= 1 - -.PHONY: - -all: mklove-check libs CONFIGURATION.md check - -include mklove/Makefile.base - -libs: - @(for d in $(LIBSUBDIRS); do $(MAKE) -C $$d || exit $?; done) - -CONFIGURATION.md: src/rdkafka.h examples - @printf "$(MKL_YELLOW)Updating$(MKL_CLR_RESET)\n" - @echo '//@file' > CONFIGURATION.md.tmp - @(examples/rdkafka_performance -X list >> CONFIGURATION.md.tmp; \ - cmp CONFIGURATION.md CONFIGURATION.md.tmp || \ - mv CONFIGURATION.md.tmp CONFIGURATION.md; \ - rm -f CONFIGURATION.md.tmp) - -file-check: CONFIGURATION.md LICENSES.txt examples -check: file-check - @(for d in $(LIBSUBDIRS); do $(MAKE) -C $$d $@ || exit $?; done) - -install: - @(for d in $(LIBSUBDIRS); do $(MAKE) -C $$d $@ || exit $?; done) - -examples tests: .PHONY libs - $(MAKE) -C $@ - -docs: - doxygen Doxyfile - @echo "Documentation generated in staging-docs" - -clean-docs: - rm -rf staging-docs - -clean: - @$(MAKE) -C tests $@ - @$(MAKE) -C examples $@ - @(for d in $(LIBSUBDIRS); do $(MAKE) -C $$d $@ ; done) - -distclean: clean - ./configure --clean - rm -f config.log config.log.old - -archive: - git archive --prefix=$(PACKAGE_NAME)-$(VERSION)/ \ - -o $(PACKAGE_NAME)-$(VERSION).tar.gz HEAD - git archive --prefix=$(PACKAGE_NAME)-$(VERSION)/ \ - -o $(PACKAGE_NAME)-$(VERSION).zip HEAD - -rpm: distclean - $(MAKE) -C packaging/rpm - -LICENSES.txt: .PHONY - @(for i in LICENSE LICENSE.*[^~] ; do (echo "$$i" ; echo "--------------------------------------------------------------" ; cat $$i ; echo "" ; echo "") ; done) > $@.tmp - @cmp $@ $@.tmp || mv $@.tmp $@ ; rm -f $@.tmp - diff --git a/configure.librdkafka b/configure.librdkafka index d629376..500d1e0 100644 --- a/configure.librdkafka +++ b/configure.librdkafka @@ -201,7 +201,7 @@ void foo (void) { # The linker-script generator (lds-gen.py) requires python if [[ $WITH_LDS == y ]]; then - if ! mkl_command_check python "HAVE_PYTHON" "disable" "python3 -V"; then + if ! mkl_command_check python "HAVE_PYTHON" "disable" "python -V"; then mkl_err "disabling linker-script since python is not available" mkl_mkvar_set WITH_LDS WITH_LDS "n" fi diff --git a/configure.librdkafka.python3 b/configure.librdkafka.python3 deleted file mode 100644 index 500d1e0..0000000 --- a/configure.librdkafka.python3 +++ /dev/null @@ -1,215 +0,0 @@ -#!/bin/bash -# - -mkl_meta_set "description" "name" "librdkafka" -mkl_meta_set "description" "oneline" "The Apache Kafka C/C++ library" -mkl_meta_set "description" "long" "Full Apache Kafka protocol support, including producer and consumer" -mkl_meta_set "description" "copyright" "Copyright (c) 2012-2015 Magnus Edenhill" - -# Enable generation of pkg-config .pc file -mkl_mkvar_set "" GEN_PKG_CONFIG y - - -mkl_require cxx -mkl_require lib -mkl_require pic -mkl_require atomics -mkl_require good_cflags -mkl_require socket - -# Generate version variables from rdkafka.h hex version define -# so we can use it as string version when generating a pkg-config file. - -verdef=$(grep '^#define *RD_KAFKA_VERSION *0x' src/rdkafka.h | sed 's/^#define *RD_KAFKA_VERSION *\(0x[a-f0-9]*\)\.*$/\1/') -mkl_require parseversion hex2str "%d.%d.%d" "$verdef" RDKAFKA_VERSION_STR - -mkl_toggle_option "Development" ENABLE_DEVEL "--enable-devel" "Enable development asserts, checks, etc" "n" -mkl_toggle_option "Development" ENABLE_VALGRIND "--enable-valgrind" "Enable in-code valgrind suppressions" "n" - -mkl_toggle_option "Development" ENABLE_REFCNT_DEBUG "--enable-refcnt-debug" "Enable refcnt debugging" "n" - -mkl_toggle_option "Development" ENABLE_SHAREDPTR_DEBUG "--enable-sharedptr-debug" "Enable sharedptr debugging" "n" - -mkl_toggle_option "Feature" ENABLE_LZ4_EXT "--enable-lz4" "Enable external LZ4 library support" "y" - -mkl_toggle_option "Feature" ENABLE_SSL "--enable-ssl" "Enable SSL support" "y" -mkl_toggle_option "Feature" ENABLE_SASL "--enable-sasl" "Enable SASL support with Cyrus libsasl2" "y" - - -function checks { - - # -lrt is needed on linux for clock_gettime: link it if it exists. - mkl_lib_check "librt" "" cont CC "-lrt" - - # required libs - mkl_lib_check "libpthread" "" fail CC "-lpthread" \ - "#include " - - # Check if dlopen() is available - mkl_lib_check "libdl" "WITH_LIBDL" disable CC "-ldl" \ -" -#include -#include -void foo (void) { - void *h = dlopen(\"__bad_lib\", 0); - void *p = dlsym(h, \"sym\"); - if (p) - p = NULL; - dlclose(h); -}" - - if [[ $WITH_LIBDL == "y" ]]; then - mkl_allvar_set WITH_PLUGINS WITH_PLUGINS y - fi - - # optional libs - mkl_lib_check "zlib" "WITH_ZLIB" disable CC "-lz" \ - "#include " - mkl_lib_check "libcrypto" "" disable CC "-lcrypto" - - if [[ "$ENABLE_LZ4_EXT" == "y" ]]; then - mkl_lib_check --static=-llz4 "liblz4" "WITH_LZ4_EXT" disable CC "-llz4" \ - "#include " - fi - - # Snappy support is built-in - mkl_allvar_set WITH_SNAPPY WITH_SNAPPY y - - # Enable sockem (tests) - mkl_allvar_set WITH_SOCKEM WITH_SOCKEM y - - if [[ "$ENABLE_SSL" == "y" ]]; then - mkl_meta_set "libssl" "deb" "libssl-dev" - if [[ $MKL_DISTRO == "osx" ]]; then - # Add brew's OpenSSL pkg-config path on OSX - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig" - fi - mkl_lib_check "libssl" "WITH_SSL" disable CC "-lssl" \ - "#include " - fi - - if [[ "$ENABLE_SASL" == "y" ]]; then - mkl_meta_set "libsasl2" "deb" "libsasl2-dev" - if ! mkl_lib_check "libsasl2" "WITH_SASL_CYRUS" disable CC "-lsasl2" "#include " ; then - mkl_lib_check "libsasl" "WITH_SASL_CYRUS" disable CC "-lsasl" \ - "#include " - fi - fi - - if [[ "$WITH_SSL" == "y" ]]; then - # SASL SCRAM requires base64 encoding from OpenSSL - mkl_allvar_set WITH_SASL_SCRAM WITH_SASL_SCRAM y - fi - - # CRC32C: check for crc32 instruction support. - # This is also checked during runtime using cpuid. - mkl_compile_check crc32chw WITH_CRC32C_HW disable CC "" \ - " -#include -#include -#define LONGx1 \"8192\" -#define LONGx2 \"16384\" -void foo (void) { - const char *n = \"abcdefghijklmnopqrstuvwxyz0123456789\"; - uint64_t c0 = 0, c1 = 1, c2 = 2; - uint64_t s; - uint32_t eax = 1, ecx; - __asm__(\"cpuid\" - : \"=c\"(ecx) - : \"a\"(eax) - : \"%ebx\", \"%edx\"); - __asm__(\"crc32b\t\" \"(%1), %0\" - : \"=r\"(c0) - : \"r\"(n), \"0\"(c0)); - __asm__(\"crc32q\t\" \"(%3), %0\n\t\" - \"crc32q\t\" LONGx1 \"(%3), %1\n\t\" - \"crc32q\t\" LONGx2 \"(%3), %2\" - : \"=r\"(c0), \"=r\"(c1), \"=r\"(c2) - : \"r\"(n), \"0\"(c0), \"1\"(c1), \"2\"(c2)); - s = c0 + c1 + c2; - printf(\"avoiding unused code removal by printing %d, %d, %d\n\", (int)s, (int)eax, (int)ecx); -} -" - - - # Check for libc regex - mkl_compile_check "regex" "HAVE_REGEX" disable CC "" \ -" -#include -#include -void foo (void) { - regcomp(NULL, NULL, 0); - regexec(NULL, NULL, 0, NULL, 0); - regerror(0, NULL, NULL, 0); - regfree(NULL); -}" - - - # Older g++ (<=4.1?) gives invalid warnings for the C++ code. - mkl_mkvar_append CXXFLAGS CXXFLAGS "-Wno-non-virtual-dtor" - - # Required on SunOS - if [[ $MKL_DISTRO == "SunOS" ]]; then - mkl_mkvar_append CPPFLAGS CPPFLAGS "-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -D__EXTENSIONS__" - # Source defines _POSIX_C_SOURCE to 200809L for Solaris, and this is - # incompatible on that platform with compilers < c99. - mkl_mkvar_append CFLAGS CFLAGS "-std=c99" - fi - - # Check if strndup() is available (isn't on Solaris 10) - mkl_compile_check "strndup" "HAVE_STRNDUP" disable CC "" \ -"#include -int foo (void) { - return strndup(\"hi\", 2) ? 0 : 1; -}" - - # Check if strerror_r() is available. - # The check for GNU vs XSI is done in rdposix.h since - # we can't rely on all defines to be set here (_GNU_SOURCE). - mkl_compile_check "strerror_r" "HAVE_STRERROR_R" disable CC "" \ -"#include -const char *foo (void) { - static char buf[64]; - strerror_r(1, buf, sizeof(buf)); - return buf; -}" - - - # See if GNU's pthread_setname_np() is available, and in what form. - mkl_compile_check "pthread_setname_gnu" "HAVE_PTHREAD_SETNAME_GNU" disable CC "-D_GNU_SOURCE -lpthread" \ -' -#include - -void foo (void) { - pthread_setname_np(pthread_self(), "abc"); -} -' - - # Figure out what tool to use for dumping public symbols. - # We rely on configure.cc setting up $NM if it exists. - if mkl_env_check "nm" "" cont "NM" ; then - # nm by future mk var - if [[ $MKL_DISTRO == "osx" || $MKL_DISTRO == "AIX" ]]; then - mkl_mkvar_set SYMDUMPER SYMDUMPER '$(NM) -g' - else - mkl_mkvar_set SYMDUMPER SYMDUMPER '$(NM) -D' - fi - else - # Fake symdumper - mkl_mkvar_set SYMDUMPER SYMDUMPER 'echo' - fi - - # The linker-script generator (lds-gen.py) requires python - if [[ $WITH_LDS == y ]]; then - if ! mkl_command_check python "HAVE_PYTHON" "disable" "python -V"; then - mkl_err "disabling linker-script since python is not available" - mkl_mkvar_set WITH_LDS WITH_LDS "n" - fi - fi - - if [[ "$ENABLE_VALGRIND" == "y" ]]; then - mkl_compile_check valgrind WITH_VALGRIND disable CC "" \ - "#include " - fi -} - diff --git a/lds-gen.py b/lds-gen.py index 2cf98fc..1136580 100755 --- a/lds-gen.py +++ b/lds-gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # # # Generate linker script to only expose symbols of the public API diff --git a/lds-gen.py.python3 b/lds-gen.py.python3 deleted file mode 100755 index 1136580..0000000 --- a/lds-gen.py.python3 +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -# -# -# Generate linker script to only expose symbols of the public API -# - -import sys -import re - - -if __name__ == '__main__': - - funcs = list() - last_line = '' - - for line in sys.stdin: - m = re.match(r'^(\S+.*\s+\**)?(rd_kafka_\S+)\s*\(', line) - if m: - sym = m.group(2) - # Ignore static (unused) functions - m2 = re.match(r'(RD_UNUSED|__attribute__\(\(unused\)\))', last_line) - if not m2: - funcs.append(sym) - last_line = '' - else: - last_line = line - - print('# Automatically generated by lds-gen.py - DO NOT EDIT') - print('{\n global:') - if len(funcs) == 0: - print(' *;') - else: - for f in sorted(funcs): - print(' %s;' % f) - - print('local:\n *;') - - print('};') diff --git a/packaging/get_version.py b/packaging/get_version.py index f56289a..3d98d21 100755 --- a/packaging/get_version.py +++ b/packaging/get_version.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/packaging/get_version.py.python3 b/packaging/get_version.py.python3 deleted file mode 100755 index 3d98d21..0000000 --- a/packaging/get_version.py.python3 +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -import sys - -if len(sys.argv) != 2: - raise Exception('Usage: %s path/to/rdkafka.h' % sys.argv[0]) - -kafka_h_file = sys.argv[1] -f = open(kafka_h_file) -for line in f: - if '#define RD_KAFKA_VERSION' in line: - version = line.split()[-1] - break -f.close() - -major = int(version[2:4], 16) -minor = int(version[4:6], 16) -patch = int(version[6:8], 16) -version = '.'.join(str(item) for item in (major, minor, patch)) - -print version