How do I update the libphonenumber library version when building yocto?

22 views Asked by At

There is currently an existing libphonenumber.bb file. The contents are as follows.

DESCRIPTION = "Libphonenumber"
HOMEPAGE = "https://github.com/google/libphonenumber"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=363822a4d0f7a74c43ecdc2a4c11ae64"

inherit cmake

DEPENDS += "protobuf icu gtest protobuf-native boost"

SRC_URI = "git://github.com/google/libphonenumber.git;nobranch=1"

SRC_URI_append += " \
    file://libphonenumber-8.11.1.patch \
"

S = "${WORKDIR}/git/cpp"

SRCREV = "66f5c2cc728dc86a57539ec0b6295458d8241094"
PV = "8.11.1"
PR = "r2"

The SRC_URI_append command has a patch content for v8.11.1. The contents are as follows.

iff --git cpp/CMakeLists.txt cpp/CMakeLists.txt
index 3bcb458c..19bccad7 100644
--- cpp/CMakeLists.txt
+++ cpp/CMakeLists.txt
@@ -67,6 +67,14 @@ function (check_library_version VARNAME LIBRARY_WITH_VERSION)
   endif ()
 endfunction ()

+set(PHONENUMBER_PKGCONFIG_PC ${CMAKE_BINARY_DIR}/phonenumber.pc)
+configure_file(phonenumber.pc.cmakein ${PHONENUMBER_PKGCONFIG_PC} @ONLY)
+
+install(
+    FILES ${PHONENUMBER_PKGCONFIG_PC}
+    DESTINATION "${LIBDIR}/usr/lib/pkgconfig"
+)
+
 # Find a program. If it has not been found, stop CMake with a fatal error
 # message.
 function (find_required_program NAME FILENAME DESCRIPTION)
@@ -78,9 +86,9 @@ function (find_required_program NAME FILENAME DESCRIPTION)
 endfunction (find_required_program)

 # Options that can be passed to CMake using 'cmake -DKEY=VALUE'.
-option ("BUILD_GEOCODER" "Build the offline phone number geocoder" "ON")
-option ("USE_ALTERNATE_FORMATS" "Use alternate formats" "ON")
-option ("USE_BOOST" "Use Boost" "ON")
+option ("BUILD_GEOCODER" "Build the offline phone number geocoder" "OFF")
+option ("USE_ALTERNATE_FORMATS" "Use alternate formats" "OFF")
+option ("USE_BOOST" "Use Boost" "OFF")
 option ("USE_ICU_REGEXP" "Use ICU regexp engine" "ON")
 option ("USE_LITE_METADATA" "Use lite metadata" "OFF")
 option ("USE_RE2" "Use RE2" "OFF")
@@ -293,7 +301,7 @@ if (${USE_LITE_METADATA} STREQUAL "ON")
     ${METADATA_TARGET}
     "${RESOURCES_DIR}/PhoneNumberMetadata.xml"
     "lite_metadata"
-    "metadata"
+    "lite_metadata"
   )
   list (APPEND SOURCES "src/phonenumbers/lite_metadata.cc")
 else ()
@@ -314,7 +322,7 @@ add_metadata_gen_target (
   ${TEST_METADATA_TARGET}
   "${RESOURCES_DIR}/PhoneNumberMetadataForTesting.xml"
   "test_metadata"
-  "metadata"
+  "test_metadata"
 )
 list (APPEND TESTING_LIBRARY_SOURCES "src/phonenumbers/test_metadata.cc")

diff --git cpp/phonenumber.pc.cmakein cpp/phonenumber.pc.cmakein
new file mode 100644
index 00000000..a6bd1c1c
--- /dev/null
+++ cpp/phonenumber.pc.cmakein
@@ -0,0 +1,14 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@INSTALL_LIB_DIR@
+sharedlibdir=@INSTALL_LIB_DIR@
+includedir=@INSTALL_INC_DIR@
+
+
+Name: Fraunhofer Phonenumber Library
+Description: Phonenumber library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -L${sharedlibdir} -lphonenumber @LIBS_PUBLIC@
+Libs.private: @LIBS_PRIVATE@
+Cflags: -I${includedir}
+

How can I upgrade the version of the libphonenumber library? (v8.11.1 -> v8.13.2)

The SRCREV command in the libphonenumber.bb file points to the commit id of libponenumber v8.11.1. What I want is to upgrade the libphonenumber version to v8.13.2. Therefore, we added the commit id corresponding to version v8.13.2 to the SRCREV command to run the yocto build. I made the following modifications.

HOMEPAGE = "https://github.com/google/libphonenumber"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=363822a4d0f7a74c43ecdc2a4c11ae64"

inherit cmake

DEPENDS += "protobuf icu gtest protobuf-native boost"

SRC_URI = "git://github.com/google/libphonenumber.git;nobranch=1"

SRC_URI_append += " \
    file://libphonenumber-8.11.1.patch \
"

S = "${WORKDIR}/git/cpp"

#SRCREV = "66f5c2cc728dc86a57539ec0b6295458d8241094"
#PV = "8.11.1"
#PR = "r2"

SRCREV = "48a98da5a8c81710f5b45982e23f82f2c1a1df48"
PV = "8.13.2"
PR = "r3"

bitbake libphonenumber

As a result, we were able to see the following error message.

ERROR: libphonenumber-8.13.2-r3 do_patch: Command Error: 'quilt --quiltrc /home/temp/aarch64-gnu-linux/libphonenumber/8.13.2-r3/recipe-sysroot-native/etc/quiltrc push' exited with 0  Output:
Applying patch libphonenumber-8.11.1.patch
patching file CMakeLists.txt
Hunk #1 succeeded at 72 (offset 5 lines).
Hunk #2 FAILED at 86.
Hunk #3 succeeded at 345 (offset 44 lines).
Hunk #4 FAILED at 322.
2 out of 4 hunks FAILED -- rejects in file CMakeLists.txt
patching file phonenumber.pc.cmakein
Patch libphonenumber-8.11.1.patch does not apply (enforce with -f)
ERROR: Logfile of failure stored in: /home/temp/aarch64-gnu-linux/libphonenumber/8.13.2-r3/temp/log.do_patch.26755
ERROR: Logfile of failure stored in: /home/temp/aarch64-gnu-linux/libphonenumber/8.13.2-r3/temp/log.do_patch.26755
ERROR: Task (/home/temp/../libphonenumber.bb:do_patch) failed with exit code '1'
0

There are 0 answers