Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Protobuf general update #1175

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
From fbef2d9fbe3e93aebb286bf1366baa2ddc10a4b5 Mon Sep 17 00:00:00 2001
From: Alessandro Bono <alessandro.bono369@gmail.com>
Date: Fri, 15 Dec 2023 19:04:16 +0100
Subject: [PATCH] CMakeList.txt: Remove double dashes

Otherwise cmake won't reconize the command.

With double dashes:
```
$ cmake -E env TESTENV=value -- env | grep TESTENV
cmake -E env: unknown option '--'
```

Without double dashes:
```
$ cmake -E env TESTENV=value env | grep TESTENV
TESTENV=value
```
---
build-cmake/CMakeLists.txt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt
index f46fba7..c7db9f2 100644
--- a/build-cmake/CMakeLists.txt
+++ b/build-cmake/CMakeLists.txt
@@ -147,7 +147,7 @@ SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)

add_custom_target(protoc-generated-files
- COMMAND ${CMAKE_COMMAND} -E env PATH="${OS_PATH_VARIABLE}" -- ${PROTOBUF_PROTOC_EXECUTABLE}
+ COMMAND ${CMAKE_COMMAND} -E env PATH="${OS_PATH_VARIABLE}" ${PROTOBUF_PROTOC_EXECUTABLE}
--cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I${PROTOBUF_INCLUDE_DIR}
-I${MAIN_DIR} ${MAIN_DIR}/protobuf-c/protobuf-c.proto
COMMENT Running protoc on ${MAIN_DIR}/protobuf-c/protobuf-c.proto
@@ -186,7 +186,7 @@ ENDIF (MSVC AND BUILD_SHARED_LIBS)
FUNCTION(GENERATE_TEST_SOURCES PROTO_FILE SRC HDR)
ADD_CUSTOM_COMMAND(OUTPUT ${SRC} ${HDR}
COMMAND ${CMAKE_COMMAND}
- ARGS -E env PATH="${OS_PATH_VARIABLE}" -- ${PROTOBUF_PROTOC_EXECUTABLE}
+ ARGS -E env PATH="${OS_PATH_VARIABLE}" ${PROTOBUF_PROTOC_EXECUTABLE}
--plugin=$<TARGET_FILE_NAME:protoc-gen-c> -I${MAIN_DIR} ${PROTO_FILE} --c_out=${CMAKE_CURRENT_BINARY_DIR}
DEPENDS protoc-gen-c)
ENDFUNCTION()
@@ -201,7 +201,7 @@ TARGET_LINK_LIBRARIES(test-generated-code protobuf-c)

ADD_CUSTOM_COMMAND(OUTPUT t/test-full.pb.cc t/test-full.pb.h
COMMAND ${CMAKE_COMMAND}
- ARGS -E env PATH="${OS_PATH_VARIABLE}" -- ${PROTOBUF_PROTOC_EXECUTABLE}
+ ARGS -E env PATH="${OS_PATH_VARIABLE}" ${PROTOBUF_PROTOC_EXECUTABLE}
--cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I${MAIN_DIR} ${TEST_DIR}/test-full.proto
)

@@ -220,7 +220,7 @@ ENDIF (MSVC AND BUILD_SHARED_LIBS)
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/t/generated-code2)
ADD_CUSTOM_COMMAND(OUTPUT t/generated-code2/test-full-cxx-output.inc
COMMAND ${CMAKE_COMMAND}
- ARGS -E env PATH="${OS_PATH_VARIABLE}" -- cxx-generate-packed-data
+ ARGS -E env PATH="${OS_PATH_VARIABLE}" cxx-generate-packed-data
">t/generated-code2/test-full-cxx-output.inc"
DEPENDS cxx-generate-packed-data
)
--
2.34.1

2 changes: 2 additions & 0 deletions gvsbuild/patches/protobuf-c/build-cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-c-targets.cmake")
1 change: 1 addition & 0 deletions gvsbuild/projects/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# flake8: noqa

from gvsbuild.projects.abseil import AbseilCpp
from gvsbuild.projects.adwaita_icon_theme import AdwaitaIconTheme
from gvsbuild.projects.atk import Atk
from gvsbuild.projects.boringssl import BoringSSL
Expand Down
42 changes: 42 additions & 0 deletions gvsbuild/projects/abseil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (C) 2024 The Gvsbuild Authors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.

from gvsbuild.utils.base_builders import CmakeProject
from gvsbuild.utils.base_expanders import Tarball
from gvsbuild.utils.base_project import Project, project_add


@project_add
class AbseilCpp(Tarball, CmakeProject):
def __init__(self):
Project.__init__(
self,
"abseil-cpp",
version="20230802.1",
archive_url="https://github.com/abseil/abseil-cpp/archive/refs/tags/{version}.tar.gz",
hash="987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed",
dependencies=[
"cmake",
"zlib",
"ninja",
],
)

def build(self):
CmakeProject.build(
self,
cmake_params=r"-DBUILD_SHARED_LIBS=ON",
use_ninja=True,
)
18 changes: 11 additions & 7 deletions gvsbuild/projects/protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def __init__(self):
Project.__init__(
self,
"protobuf",
version="3.21.12",
lastversion_major=3,
archive_url="https://github.com/protocolbuffers/protobuf/releases/download/v{minor}.{micro}/protobuf-cpp-{version}.tar.gz",
hash="4eab9b524aa5913c6fffb20b2a8abf5ef7f95a80bc0701f3a6dbb4c607f73460",
version="25.1",
archive_url="https://github.com/protocolbuffers/protobuf/releases/download/v{version}/protobuf-{version}.tar.gz",
hash="9bd87b8280ef720d3240514f884e56a712f2218f0d693b48050c836028940a42",
dependencies=[
"abseil-cpp",
"cmake",
"zlib",
"ninja",
Expand All @@ -39,7 +39,7 @@ def build(self):
# We need to compile with STATIC_RUNTIME off since protobuf-c also compiles with it OFF
CmakeProject.build(
self,
cmake_params=r'-DBUILD_SHARED_LIBS=ON -Dprotobuf_DEBUG_POSTFIX="" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_WITH_ZLIB=ON -Dprotobuf_MSVC_STATIC_RUNTIME=OFF',
cmake_params=r'-DBUILD_SHARED_LIBS=ON -Dprotobuf_ABSL_PROVIDER=package -Dprotobuf_DEBUG_POSTFIX="" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_WITH_ZLIB=ON -Dprotobuf_MSVC_STATIC_RUNTIME=OFF',
use_ninja=True,
)

Expand All @@ -52,14 +52,18 @@ def __init__(self):
Project.__init__(
self,
"protobuf-c",
version="1.4.1",
version="1.5.0",
archive_url="https://github.com/protobuf-c/protobuf-c/releases/download/v{version}/protobuf-c-{version}.tar.gz",
hash="4cc4facd508172f3e0a4d3a8736225d472418aee35b4ad053384b137b220339f",
hash="7b404c63361ed35b3667aec75cc37b54298d56dd2bcf369de3373212cc06fd98",
dependencies=[
"abseil-cpp",
"cmake",
"protobuf",
"ninja",
],
patches=[
"0001-CMakeList.txt-Remove-double-dashes.patch",
],
)

def build(self):
Expand Down