diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml index 442ec2a..3b9dee7 100755 --- a/.azure-pipelines/azure-pipelines-linux.yml +++ b/.azure-pipelines/azure-pipelines-linux.yml @@ -12,6 +12,10 @@ jobs: CONFIG: linux_64_ UPLOAD_PACKAGES: 'True' DOCKER_IMAGE: quay.io/condaforge/linux-anvil-cos7-x86_64 + linux_aarch64_: + CONFIG: linux_aarch64_ + UPLOAD_PACKAGES: 'True' + DOCKER_IMAGE: quay.io/condaforge/linux-anvil-cos7-x86_64 linux_ppc64le_: CONFIG: linux_ppc64le_ UPLOAD_PACKAGES: 'True' diff --git a/.ci_support/linux_aarch64_.yaml b/.ci_support/linux_aarch64_.yaml index 089b636..de65884 100644 --- a/.ci_support/linux_aarch64_.yaml +++ b/.ci_support/linux_aarch64_.yaml @@ -17,7 +17,7 @@ cxx_compiler: cxx_compiler_version: - '10' docker_image: -- quay.io/condaforge/linux-anvil-aarch64 +- quay.io/condaforge/linux-anvil-cos7-x86_64 pin_run_as_build: zlib: max_pin: x.x diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b25d24d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This file was generated automatically from conda-smithy. To update this configuration, -# update the conda-forge.yml and/or the recipe/meta.yaml. - -language: generic - - - -matrix: - include: - - env: CONFIG=linux_aarch64_ UPLOAD_PACKAGES=True PLATFORM=linux-aarch64 DOCKER_IMAGE=quay.io/condaforge/linux-anvil-aarch64 - os: linux - arch: arm64 - dist: focal - -script: - - export CI=travis - - export GIT_BRANCH="$TRAVIS_BRANCH" - - export FEEDSTOCK_NAME=$(basename ${TRAVIS_REPO_SLUG}) - - if [[ "${TRAVIS_PULL_REQUEST:-}" == "false" ]]; then export IS_PR_BUILD="False"; else export IS_PR_BUILD="True"; fi - - - - if [[ ${PLATFORM} =~ .*linux.* ]]; then CONDA_FORGE_DOCKER_RUN_ARGS="--network=host --security-opt=seccomp=unconfined" ./.scripts/run_docker_build.sh; fi \ No newline at end of file diff --git a/README.md b/README.md index f4d39ec..3cff242 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Feedstock license: [BSD-3-Clause](https://github.com/conda-forge/libprotobuf-fee Summary: Protocol Buffers - Google's data interchange format. C++ Libraries and protoc, the protobuf compiler. +Development: https://github.com/protocolbuffers/protobuf + Documentation: https://developers.google.com/protocol-buffers/ Protocol buffers are Google's language-neutral, @@ -20,14 +22,7 @@ Current build status ==================== - - - - +
Travis - - linux - -
diff --git a/conda-forge.yml b/conda-forge.yml index 31e8d2e..2df57a1 100644 --- a/conda-forge.yml +++ b/conda-forge.yml @@ -1,6 +1,6 @@ provider: {linux_aarch64: default, linux_ppc64le: default, win: azure} conda_forge_output_validation: true -build_platform: {osx_arm64: osx_64, linux_ppc64le: linux_64} +build_platform: {osx_arm64: osx_64, linux_aarch64: linux_64, linux_ppc64le: linux_64} test_on_native_only: true github: branch_name: main diff --git a/recipe/bld-static.bat b/recipe/bld-static.bat deleted file mode 100644 index ccba7af..0000000 --- a/recipe/bld-static.bat +++ /dev/null @@ -1,22 +0,0 @@ -:: Setup directory structure per protobuf's instructions. -cd cmake -if errorlevel 1 exit 1 - -mkdir build-static -if errorlevel 1 exit 1 -cd build-static -if errorlevel 1 exit 1 - -:: Configure and install based on protobuf's instructions and other `bld.bat`s. -cmake -G "Ninja" ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ - -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ - -Dprotobuf_WITH_ZLIB=ON ^ - -Dprotobuf_BUILD_SHARED_LIBS=OFF ^ - -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ^ - .. -if errorlevel 1 exit 1 -cmake --build . --target install --config Release -if errorlevel 1 exit 1 - diff --git a/recipe/bld-shared.bat b/recipe/build-lib.bat similarity index 56% rename from recipe/bld-shared.bat rename to recipe/build-lib.bat index e3879bb..3c6d248 100644 --- a/recipe/bld-shared.bat +++ b/recipe/build-lib.bat @@ -1,11 +1,14 @@ -:: Setup directory structure per protobuf's instructions. -cd cmake -if errorlevel 1 exit 1 +@echo on -mkdir build-shared -if errorlevel 1 exit 1 -cd build-shared -if errorlevel 1 exit 1 +if "%PKG_NAME%"=="libprotobuf-static" ( + set CF_SHARED=OFF + mkdir build-static + cd build-static +) else ( + set CF_SHARED=ON + mkdir build-shared + cd build-shared +) :: Configure and install based on protobuf's instructions and other `bld.bat`s. cmake -G "Ninja" ^ @@ -13,9 +16,9 @@ cmake -G "Ninja" ^ -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ -Dprotobuf_WITH_ZLIB=ON ^ - -Dprotobuf_BUILD_SHARED_LIBS=ON ^ + -Dprotobuf_BUILD_SHARED_LIBS=%CF_SHARED% ^ -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ^ .. -if errorlevel 1 exit 1 +if %ERRORLEVEL% neq 0 exit 1 cmake --build . --target install --config Release -if errorlevel 1 exit 1 +if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipe/build-lib.sh b/recipe/build-lib.sh new file mode 100644 index 0000000..6071cec --- /dev/null +++ b/recipe/build-lib.sh @@ -0,0 +1,50 @@ +#!/bin/bash +set -ex + +if [ "$(uname)" == "Linux" ]; +then + # protobuf uses PROTOBUF_OPT_FLAG to set the optimization level + # unit test can fail if optmization above 0 are used. + CPPFLAGS="${CPPFLAGS//-O[0-9]/}" + CXXFLAGS="${CXXFLAGS//-O[0-9]/}" + export PROTOBUF_OPT_FLAG="-O2" + # to improve performance, disable checks intended for debugging + CXXFLAGS="$CXXFLAGS -DNDEBUG" +elif [ "$(uname)" == "Darwin" ]; +then + # remove pie from LDFLAGS + LDFLAGS="${LDFLAGS//-pie/}" +fi + +# required to pick up conda installed zlib +export CPPFLAGS="${CPPFLAGS} -I${PREFIX}/include" +export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" + +if [[ "$PKG_NAME" == "libprotobuf-static" ]]; then + export CF_SHARED=OFF + mkdir build-static + cd build-static +else + export CF_SHARED=ON + mkdir build-shared + cd build-shared +fi + +if [[ "$CONDA_BUILD_CROSS_COMPILATION" == 1 ]]; then + export CMAKE_ARGS="${CMAKE_ARGS} -Dprotobuf_BUILD_TESTS=OFF" +fi + +cmake -G "Ninja" \ + ${CMAKE_ARGS} \ + -DCMAKE_BUILD_TYPE=Release \ + -Dprotobuf_WITH_ZLIB=ON \ + -Dprotobuf_BUILD_SHARED_LIBS=$CF_SHARED \ + .. + +cmake --build . + +if [[ "$CONDA_BUILD_CROSS_COMPILATION" != 1 ]]; then + ninja check +fi + +cmake --install . diff --git a/recipe/build-shared.sh b/recipe/build-shared.sh deleted file mode 100644 index ca7bc09..0000000 --- a/recipe/build-shared.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -set -ex - -if [ "$(uname)" == "Linux" ]; -then - # protobuf uses PROTOBUF_OPT_FLAG to set the optimization level - # unit test can fail if optmization above 0 are used. - CPPFLAGS="${CPPFLAGS//-O[0-9]/}" - CXXFLAGS="${CXXFLAGS//-O[0-9]/}" - export PROTOBUF_OPT_FLAG="-O2" - # to improve performance, disable checks intended for debugging - CXXFLAGS="$CXXFLAGS -DNDEBUG" -elif [ "$(uname)" == "Darwin" ]; -then - # remove pie from LDFLAGS - LDFLAGS="${LDFLAGS//-pie/}" -fi - -# required to pick up conda installed zlib -export CPPFLAGS="${CPPFLAGS} -I${PREFIX}/include" -export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" - -# Build configure/Makefile as they are not present. -aclocal -libtoolize -autoconf -autoreconf -i -automake --add-missing - -./configure --prefix="${PREFIX}" \ - --build=${BUILD} \ - --host=${HOST} \ - --with-pic \ - --with-zlib \ - --enable-shared \ - CC_FOR_BUILD=${CC} \ - CXX_FOR_BUILD=${CXX} - -# Skip memory hungry tests -export GTEST_FILTER="-IoTest.LargeOutput" -if [ "${HOST}" == "powerpc64le-conda_cos7-linux-gnu" ]; then - make -j 2 - make check -j 2 || (cat src/test-suite.log; exit 1) -else - make -j ${CPU_COUNT} - if [[ "$CONDA_BUILD_CROSS_COMPILATION" != 1 ]]; then - make check -j ${CPU_COUNT} || (cat src/test-suite.log; exit 1) - fi -fi -make install -rm ${PREFIX}/lib/libprotobuf.a -rm ${PREFIX}/lib/libprotobuf-lite.a -rm ${PREFIX}/lib/libprotoc.a diff --git a/recipe/build_static.sh b/recipe/build_static.sh deleted file mode 100755 index f4666ac..0000000 --- a/recipe/build_static.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -mkdir -p ${PREFIX}/lib -ls -l ./src/.libs/libproto*.a -cp ./src/.libs/libproto*.a ${PREFIX}/lib/ diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 3697bba..9809f77 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -3,18 +3,22 @@ # protobuf doesn't add the major version in the tag... {% set major = "3" %} +{% set libraries = ["libprotoc", "libprotobuf", "libprotobuf-lite"] %} + package: - name: libprotobuf + name: libprotobuf-split version: {{ major + "." + version }} source: - url: https://github.com/protocolbuffers/protobuf/archive/v{{ version }}/protobuf-v{{ version }}.tar.gz sha256: 4a7e87e4166c358c63342dddcde6312faee06ea9d5bb4e2fa87d3478076f6639 patches: - - 0001-remove-Werror-from-test-flags.patch # [ppc64le or aarch64] + - patches/0001-remove-Werror-from-test-flags.patch # [ppc64le or aarch64] + - patches/0002-use-consistent-cmake-location.patch + - patches/0003-set-import-lib-extension-on-windows.patch # This issue gets fixed and then reintroduced often # https://github.com/protocolbuffers/protobuf/issues/7567 - #- issue-7567.patch + # - patches/issue-7567.patch # these are git submodules from the v21.5 release # https://github.com/protocolbuffers/protobuf/tree/v21.5/third_party - url: https://github.com/google/benchmark/archive/5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8.tar.gz @@ -25,12 +29,12 @@ source: folder: third_party/googletest build: - number: 0 + number: 1 outputs: - name: libprotobuf - script: build-shared.sh # [unix] - script: bld-shared.bat # [win] + script: build-lib.sh # [unix] + script: build-lib.bat # [win] build: run_exports: # breaks backwards compatibility and new SONAME each minor release @@ -41,55 +45,60 @@ outputs: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - - cmake # [win] - - ninja # [win] - - autoconf # [not win] - - automake # [not win] - - libtool # [not win] - - pkg-config # [not win] - - unzip # [not win] - - make # [not win] + - cmake + - ninja host: - zlib + run: + - ucrt # [win] test: commands: + {% for each_lib in libraries %} + # shared libraries + - test -f ${PREFIX}/lib/{{ each_lib }}.so # [linux] + - test -f ${PREFIX}/lib/{{ each_lib }}.dylib # [osx] + - if not exist %LIBRARY_BIN%\{{ each_lib }}.dll exit 1 # [win] + - if not exist %LIBRARY_LIB%\{{ each_lib }}-import.lib exit 1 # [win] + + # absence of static libraries + - test ! -f ${PREFIX}/lib/{{ each_lib }}.a # [unix] + - if exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win] + {% endfor %} + + # cmake + - test -f ${PREFIX}/lib/cmake/protobuf/protobuf-config.cmake # [unix] + - if not exist %LIBRARY_LIB%\cmake\protobuf\protobuf-config.cmake exit 1 # [win] + + # pkgconfig + - test -f ${PREFIX}/lib/pkgconfig/protobuf.pc # [unix] + - test -f ${PREFIX}/lib/pkgconfig/protobuf-lite.pc # [unix] + - if not exist %LIBRARY_LIB%\pkgconfig\protobuf.pc exit 1 # [win] + - if not exist %LIBRARY_LIB%\pkgconfig\protobuf-lite.pc exit 1 # [win] + + # binary - protoc --help - - test -f ${PREFIX}/lib/libprotobuf${SHLIB_EXT} # [not win] - - test ! -f ${PREFIX}/lib/libprotobuf.a # [not win] - - if not exist %PREFIX%\\Library\\lib\\libprotoc.lib exit 1 # [win] - - if not exist %PREFIX%\\Library\\lib\\libprotobuf.lib exit 1 # [win] - - if not exist %PREFIX%\\Library\\lib\\libprotobuf-lite.lib exit 1 # [win] + - name: libprotobuf-static - script: build_static.sh # [unix] - script: bld-static.bat # [win] + script: build-lib.sh # [unix] + script: build-lib.bat # [win] requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - - cmake # [win] - - ninja # [win] - - autoconf # [not win] - - automake # [not win] - - libtool # [not win] - - pkg-config # [not win] - - unzip # [not win] - - make # [not win] + - cmake + - ninja host: - zlib - - {{ pin_subpackage('libprotobuf', exact=True) }} # [not win] + - {{ pin_subpackage('libprotobuf', exact=True) }} run: - - {{ pin_subpackage('libprotobuf', exact=True) }} # [not win] - run_constrained: - - libprotobuf <0a0 # [win] + - {{ pin_subpackage('libprotobuf', exact=True) }} test: commands: - - test -f ${PREFIX}/lib/libprotobuf.a # [unix] - - test -f ${PREFIX}/lib/libprotobuf-lite.a # [unix] - - test -f ${PREFIX}/lib/libprotoc.a # [unix] - - if exist %PREFIX%\\Library\\bin\\libprotoc.dll exit 1 # [win] - - if not exist %PREFIX%\\Library\\lib\\libprotoc.lib exit 1 # [win] - - if not exist %PREFIX%\\Library\\lib\\libprotobuf.lib exit 1 # [win] - - if not exist %PREFIX%\\Library\\lib\\libprotobuf-lite.lib exit 1 # [win] + {% for each_lib in libraries %} + # static libraries + - test -f ${PREFIX}/lib/{{ each_lib }}.a # [unix] + - if not exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win] + {% endfor %} about: home: https://developers.google.com/protocol-buffers/ @@ -101,6 +110,7 @@ about: Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data- think XML, but smaller, faster, and simpler. + dev_url: https://github.com/protocolbuffers/protobuf doc_url: https://developers.google.com/protocol-buffers/ doc_source_url: https://github.com/protocolbuffers/protobuf/releases @@ -114,3 +124,4 @@ extra: - hajapy - xhochy - h-vetinari + feedstock-name: libprotobuf diff --git a/recipe/0001-remove-Werror-from-test-flags.patch b/recipe/patches/0001-remove-Werror-from-test-flags.patch similarity index 78% rename from recipe/0001-remove-Werror-from-test-flags.patch rename to recipe/patches/0001-remove-Werror-from-test-flags.patch index 14e7bb5..d2137e3 100644 --- a/recipe/0001-remove-Werror-from-test-flags.patch +++ b/recipe/patches/0001-remove-Werror-from-test-flags.patch @@ -1,7 +1,7 @@ -From b153be3cc77095c4ef91faf42431144c8bf51dba Mon Sep 17 00:00:00 2001 +From d667a84c67f61e612017e253d84a0efa214413bd Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Mon, 4 Jun 2018 17:06:30 -0400 -Subject: [PATCH] remove Werror from test flags +Subject: [PATCH 1/3] remove Werror from test flags Remove -Werror from the CXXFLAGS used for `make check` --- @@ -9,10 +9,10 @@ Remove -Werror from the CXXFLAGS used for `make check` 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am -index be18ba7..ecdeab2 100644 +index e6a7dc7fd..470075274 100644 --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -894,7 +894,7 @@ no_warning_test.cc: +@@ -910,7 +910,7 @@ no_warning_test.cc: no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ @@ -22,5 +22,5 @@ index be18ba7..ecdeab2 100644 TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \ -- -2.17.1 +2.37.0.windows.1 diff --git a/recipe/patches/0002-use-consistent-cmake-location.patch b/recipe/patches/0002-use-consistent-cmake-location.patch new file mode 100644 index 0000000..9d15f7a --- /dev/null +++ b/recipe/patches/0002-use-consistent-cmake-location.patch @@ -0,0 +1,32 @@ +From 06928c896573b92c000e7c069a2ef6739d87c9e3 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Sat, 3 Sep 2022 19:48:04 +0200 +Subject: [PATCH 2/3] use consistent cmake location + +--- + cmake/install.cmake | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/cmake/install.cmake b/cmake/install.cmake +index 825cb25fc..529e898e7 100644 +--- a/cmake/install.cmake ++++ b/cmake/install.cmake +@@ -104,13 +104,8 @@ endforeach() + # Install configuration + set(_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files") + set(_exampledir_desc "Directory relative to CMAKE_INSTALL_DATA to install examples") +-if(NOT MSVC) +- set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRING "${_cmakedir_desc}") +- set(CMAKE_INSTALL_EXAMPLEDIR "${CMAKE_INSTALL_DATADIR}/protobuf/examples" CACHE STRING "${_exampledir_desc}") +-else() +- set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}") +- set(CMAKE_INSTALL_EXAMPLEDIR "examples" CACHE STRING "${_exampledir_desc}") +-endif() ++set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRING "${_cmakedir_desc}") ++set(CMAKE_INSTALL_EXAMPLEDIR "${CMAKE_INSTALL_DATADIR}/protobuf/examples" CACHE STRING "${_exampledir_desc}") + mark_as_advanced(CMAKE_INSTALL_CMAKEDIR) + mark_as_advanced(CMAKE_INSTALL_EXAMPLEDIR) + +-- +2.37.0.windows.1 + diff --git a/recipe/patches/0003-set-import-lib-extension-on-windows.patch b/recipe/patches/0003-set-import-lib-extension-on-windows.patch new file mode 100644 index 0000000..8921468 --- /dev/null +++ b/recipe/patches/0003-set-import-lib-extension-on-windows.patch @@ -0,0 +1,29 @@ +From 4276a93dfc60f5104733b66b91cbe5350689f920 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Sun, 4 Sep 2022 10:57:08 +0200 +Subject: [PATCH 3/3] set import lib extension on windows + +--- + CMakeLists.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 04cb3303a..f585628e7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -316,6 +316,12 @@ if (protobuf_BUILD_PROTOC_BINARIES) + endif (NOT DEFINED protobuf_PROTOC_EXE) + endif (protobuf_BUILD_PROTOC_BINARIES) + ++if (MSVC) ++ set_target_properties(libprotoc PROPERTIES IMPORT_SUFFIX "-import.lib") ++ set_target_properties(libprotobuf PROPERTIES IMPORT_SUFFIX "-import.lib") ++ set_target_properties(libprotobuf-lite PROPERTIES IMPORT_SUFFIX "-import.lib") ++endif (MSVC) ++ + # Ensure we have a protoc executable if we need one + if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES) + if (NOT DEFINED protobuf_PROTOC_EXE) +-- +2.37.0.windows.1 + diff --git a/recipe/issue-7567.patch b/recipe/patches/issue-7567.patch similarity index 100% rename from recipe/issue-7567.patch rename to recipe/patches/issue-7567.patch
Azure