aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathis Logemann <mathisloge@gmail.com>2021-06-23 03:24:13 +0200
committerGitHub <noreply@github.com>2021-06-22 18:24:13 -0700
commit08690d82c11eaea801c103238cc2e948b1a60eb5 (patch)
tree4fc4262ea321babbeaa467fe17e79dd8e4d308f8
parentc5ac711fefa6cacbd6bb6335349e36a765babf87 (diff)
downloadvcpkg-08690d82c11eaea801c103238cc2e948b1a60eb5.tar.gz
vcpkg-08690d82c11eaea801c103238cc2e948b1a60eb5.zip
[nanopb] update to 0.4.5 and add generator (#18241)
* [nanopb] update to 0.4.5 and add generator * add versions * fix python install? * update version * fix python? again * version * test python * add version * fix portfile * version * Update ports/nanopb/portfile.cmake Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com> * Update ports/nanopb/portfile.cmake Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com> * update version Co-authored-by: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com>
-rw-r--r--ports/nanopb/CONTROL3
-rw-r--r--ports/nanopb/fix-python.patch25
-rw-r--r--ports/nanopb/portfile.cmake44
-rw-r--r--ports/nanopb/vcpkg.json17
-rw-r--r--versions/baseline.json2
-rw-r--r--versions/n-/nanopb.json5
6 files changed, 80 insertions, 16 deletions
diff --git a/ports/nanopb/CONTROL b/ports/nanopb/CONTROL
deleted file mode 100644
index 40d18ea9e..000000000
--- a/ports/nanopb/CONTROL
+++ /dev/null
@@ -1,3 +0,0 @@
-Source: nanopb
-Version: 2019-02-12-2
-Description: A small code-size Protocol Buffers implementation in ANSI C.
diff --git a/ports/nanopb/fix-python.patch b/ports/nanopb/fix-python.patch
new file mode 100644
index 000000000..f82293099
--- /dev/null
+++ b/ports/nanopb/fix-python.patch
@@ -0,0 +1,25 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d9c5e5e..4e94bb7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -41,7 +41,6 @@ endif()
+ if(nanopb_BUILD_GENERATOR)
+ set(generator_protos nanopb)
+
+- find_package(Python REQUIRED)
+ execute_process(
+ COMMAND ${Python_EXECUTABLE} -c
+ "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))"
+@@ -64,10 +63,10 @@ if(nanopb_BUILD_GENERATOR)
+ DESTINATION ${PYTHON_INSTDIR}/proto/
+ )
+ endforeach()
++ install( FILES generator/proto/_utils.py
++ DESTINATION ${PYTHON_INSTDIR}/proto/ )
+ endif()
+
+-install( FILES generator/proto/_utils.py
+- DESTINATION ${PYTHON_INSTDIR}/proto/ )
+
+ if( WIN32 )
+ install(
diff --git a/ports/nanopb/portfile.cmake b/ports/nanopb/portfile.cmake
index 5a536e619..cd79b8775 100644
--- a/ports/nanopb/portfile.cmake
+++ b/ports/nanopb/portfile.cmake
@@ -1,30 +1,37 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
-message(WARNING "\
-The nanopb's code generator is not installed as part of the installation \
-currently. So you have to run the code generator manually."
-)
-
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nanopb/nanopb
- REF d1305ddef1c18b4cb33992254494ccd255701aaa
- SHA512 70e588b0ff13846005658a9fafe57551dc2c126a32f351fe0b6c166c142c42b3bcc44567288f609f2f3a5adc1fe1bf1c585fec8c5fe90817b5b3ab47955aa1fc
+ REF 0.4.5
+ SHA512 2f24308440bd961a94449e253627fbe38f6c5217cd70c57e9b3ab702da3c2df03b087ccdd62518940acf6b480a1dbb440ca5681f1766a17b199010d3df7b17a1
HEAD_REF master
+ PATCHES
+ fix-python.patch
)
-string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "static" BUILD_STATIC_LIBS)
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" nanopb_BUILD_STATIC_LIBS)
+string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" nanopb_STATIC_LINKING)
+
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ generator nanopb_BUILD_GENERATOR
+)
+
+vcpkg_find_acquire_program(PYTHON3)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
+ -DPython_EXECUTABLE=${PYTHON3}
-Dnanopb_BUILD_RUNTIME=ON
- -Dnanopb_BUILD_GENERATOR=OFF
- -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
- -Dnanopb_MSVC_STATIC_RUNTIME=OFF
+ -DBUILD_STATIC_LIBS=${nanopb_BUILD_STATIC_LIBS}
+ -Dnanopb_MSVC_STATIC_RUNTIME=${nanopb_STATIC_LINKING}
+ -Dnanopb_PROTOC_PATH=${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}
+ ${FEATURE_OPTIONS}
)
-
vcpkg_install_cmake()
vcpkg_copy_pdbs()
@@ -33,5 +40,18 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+if(nanopb_BUILD_GENERATOR)
+ file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/nanopb_generator.py" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ if(WIN32)
+ file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/protoc-gen-nanopb.bat" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ file(INSTALL "${CURRENT_PACKAGES_DIR}/Lib/site-packages/" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/site-packages")
+ else()
+ file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/protoc-gen-nanopb" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ endif()
+endif()
+
+if(nanopb_BUILD_STATIC_LIBS)
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
+endif()
# Handle copyright
configure_file(${SOURCE_PATH}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
diff --git a/ports/nanopb/vcpkg.json b/ports/nanopb/vcpkg.json
new file mode 100644
index 000000000..dad0eff55
--- /dev/null
+++ b/ports/nanopb/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "nanopb",
+ "version-semver": "0.4.5",
+ "description": "A small code-size Protocol Buffers implementation in ANSI C.",
+ "homepage": "https://jpa.kapsi.fi/nanopb/",
+ "features": {
+ "generator": {
+ "description": "build the generator",
+ "dependencies": [
+ {
+ "name": "protobuf",
+ "host": true
+ }
+ ]
+ }
+ }
+}
diff --git a/versions/baseline.json b/versions/baseline.json
index 0be479fdf..aa632f714 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -4241,7 +4241,7 @@
"port-version": 0
},
"nanopb": {
- "baseline": "2019-02-12-2",
+ "baseline": "0.4.5",
"port-version": 0
},
"nanoprintf": {
diff --git a/versions/n-/nanopb.json b/versions/n-/nanopb.json
index 6989b9cc5..ecc09b1a3 100644
--- a/versions/n-/nanopb.json
+++ b/versions/n-/nanopb.json
@@ -1,6 +1,11 @@
{
"versions": [
{
+ "git-tree": "855b599338a79c3a7d61c1171110e4dd49c3f164",
+ "version-semver": "0.4.5",
+ "port-version": 0
+ },
+ {
"git-tree": "47f954644a0f5f22381ae3655f84b3f790e4e1e8",
"version-string": "2019-02-12-2",
"port-version": 0