diff --git a/ports/protobuf-c/CONTROL b/ports/protobuf-c/CONTROL new file mode 100644 index 000000000..dce11fd90 --- /dev/null +++ b/ports/protobuf-c/CONTROL @@ -0,0 +1,12 @@ +Source: protobuf-c +Version: 1.3.2 +Homepage: https://github.com/protobuf-c/protobuf-c +Description: This is protobuf-c, a C implementation of the Google Protocol Buffers data serialization format. +Build-Depends: protobuf + +Feature: tools +Description: build tools. + +Feature: test +Description: build test project. +Build-Depends: protobuf[tools] \ No newline at end of file diff --git a/ports/protobuf-c/fix-features.patch b/ports/protobuf-c/fix-features.patch new file mode 100644 index 000000000..89b2dd432 --- /dev/null +++ b/ports/protobuf-c/fix-features.patch @@ -0,0 +1,62 @@ +diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt +index bc1728f..7c6a04d 100644 +--- a/build-cmake/CMakeLists.txt ++++ b/build-cmake/CMakeLists.txt +@@ -61,11 +61,15 @@ if (MSVC AND MSVC_STATIC_BUILD) + endif(${flag_var} MATCHES "/MD") + endforeach(flag_var) + endif (MSVC AND MSVC_STATIC_BUILD) ++ ++IF(WITH_TOOLS) + FILE(GLOB PROTOC_GEN_C_SRC ${MAIN_DIR}/protoc-c/*.h ${MAIN_DIR}/protoc-c/*.cc ) + ADD_EXECUTABLE(protoc-gen-c ${PROTOC_GEN_C_SRC}) + + TARGET_LINK_LIBRARIES(protoc-gen-c ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY}) ++ENDIF() + ++IF(WITH_TEST AND WITH_TOOLS) + IF(CMAKE_HOST_UNIX) + ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ln -sf protoc-gen-c protoc-c +@@ -79,8 +83,6 @@ FUNCTION(GENERATE_TEST_SOURCES PROTO_FILE SRC HDR) + DEPENDS protoc-gen-c) + ENDFUNCTION() + +- +-IF(CMAKE_BUILD_TYPE MATCHES Debug) + ENABLE_TESTING() + + GENERATE_TEST_SOURCES(${TEST_DIR}/test.proto t/test.pb-c.c t/test.pb-c.h) +@@ -126,17 +128,17 @@ GENERATE_TEST_SOURCES(${TEST_DIR}/test-proto3.proto t/test-proto3.pb-c.c t/test- + ADD_EXECUTABLE(test-generated-code3 ${TEST_DIR}/generated-code/test-generated-code.c t/test-proto3.pb-c.c t/test-proto3.pb-c.h) + TARGET_COMPILE_DEFINITIONS(test-generated-code3 PUBLIC -DPROTO3) + TARGET_LINK_LIBRARIES(test-generated-code3 protobuf-c) +- + ENDIF() + +-INSTALL(TARGETS protoc-gen-c protobuf-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +-INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c) +-INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include) ++IF (WITH_TOOLS) ++INSTALL(TARGETS protoc-gen-c RUNTIME DESTINATION tools LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ++ENDIF() + + IF(CMAKE_HOST_UNIX) + INSTALL(CODE "EXECUTE_PROCESS (COMMAND ln -sf protoc-gen-c protoc-c WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)") + ENDIF() + ++IF (WITH_TEST) + INCLUDE(Dart) + + SET(DART_TESTING_TIMEOUT 5) +@@ -147,5 +149,10 @@ ADD_TEST(test-issue220 test-issue220) + ADD_TEST(test-issue251 test-issue251) + ADD_TEST(test-version test-version) + ++ENDIF() ++ ++INSTALL(TARGETS protobuf-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ++INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c) ++INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include) + + INCLUDE(CPack) diff --git a/ports/protobuf-c/portfile.cmake b/ports/protobuf-c/portfile.cmake new file mode 100644 index 000000000..ec3bcba72 --- /dev/null +++ b/ports/protobuf-c/portfile.cmake @@ -0,0 +1,30 @@ +vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platform" ON_TARGET "Windows") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO protobuf-c/protobuf-c + REF 1390409f4ee4e26d0635310995b516eb702c3f9e #1.3.2 + SHA512 5c60883c4ef064c641875bfe7f89bf255a29dd20b5e0be5878cbaec03f2efd1f926c3e40dc0090cb172b8eef227fddafe86051f08edb3e1c26d0bd6aca673e41 + HEAD_REF master + PATCHES fix-features.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + tools WITH_TOOLS + test WITH_TEST +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH}/build-cmake + PREFER_NINJA + DISABLE_PARALLEL_CONFIGURE + OPTIONS ${FEATURE_OPTIONS} +) + +vcpkg_install_cmake() + +# Include files should not be duplicated into the /debug/include directory. +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index a905cba96..bc2f38650 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1340,6 +1340,12 @@ pqp:x64-uwp=fail proj4:arm64-windows=fail proj4:arm-uwp=fail proj4:x64-uwp=fail +protobuf-c:x86-windows=fail +protobuf-c:x64-windows=fail +protobuf-c:x64-windows-static=fail +protobuf-c:x64-uwp=fail +protobuf-c:arm64-windows=fail +protobuf-c:arm-uwp=fail ptex:arm-uwp=fail ptex:x64-linux=fail ptex:x64-osx=fail