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

Overlay update #66

Merged
merged 5 commits into from
May 3, 2023
Merged
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
48 changes: 48 additions & 0 deletions overlay/osx/protobuf/compile_options.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04cb3303a..608c580be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -242,12 +242,12 @@ endif (protobuf_BUILD_SHARED_LIBS)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Build with multiple processes
- add_definitions(/MP)
+ add_compile_options(/MP)
endif()
# Set source file and execution character sets to UTF-8
- add_definitions(/utf-8)
+ add_compile_options(/utf-8)
# MSVC warning suppressions
- add_definitions(
+ add_compile_options(
/wd4065 # switch statement contains 'default' but no 'case' labels
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
/wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
@@ -262,23 +262,17 @@ if (MSVC)
/wd4996 # The compiler encountered a deprecated declaration.
)
# Allow big object
- add_definitions(/bigobj)
+ add_compile_options(/bigobj)
string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}")
configure_file(${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in extract_includes.bat)

# Suppress linker warnings about files with no symbols defined.
- set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
+ string(APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221")

- if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- # Configure Resource Compiler
- enable_language(RC)
- # use English language (0x409) in resource compiler
- set(rc_flags "/l0x409")
- # fix rc.exe invocations because of usage of add_definitions()
- set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
- endif()
+ # use English language (0x409) in resource compiler
+ string(APPEND CMAKE_RC_FLAGS " -l0x409")

# Generate the version.rc file used elsewhere.
configure_file(${protobuf_SOURCE_DIR}/cmake/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
7 changes: 4 additions & 3 deletions overlay/osx/protobuf/fix-default-proto-file-path.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc
index f192ae6..22900ed 100644
index 5e9a2c4..8eaa6e0 100644
--- a/src/google/protobuf/compiler/command_line_interface.cc
+++ b/src/google/protobuf/compiler/command_line_interface.cc
@@ -260,11 +260,15 @@ void AddDefaultProtoPaths(
@@ -261,12 +261,15 @@ void AddDefaultProtoPaths(
std::pair<std::string, std::string>("", path + "/include"));
return;
}
// Check if the upper level directory has an "include" subdirectory.
- // Check if the upper level directory has an "include" subdirectory.
+ // change "'$/bin' is next to 'include'" assumption to "'$/bin/tools' is next to 'include'"
+ for (int i = 0; i < 2; i++)
+ {
Expand Down
8 changes: 4 additions & 4 deletions overlay/osx/protobuf/fix-static-build.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 4091bc8..9850018 100644
index 825cb25..4f453d6 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -31,7 +31,7 @@ endforeach()
if (protobuf_BUILD_PROTOC_BINARIES)
@@ -32,7 +32,7 @@ if (protobuf_BUILD_PROTOC_BINARIES)
install(TARGETS protoc EXPORT protobuf-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
- if (UNIX AND NOT APPLE)
+ if (UNIX AND NOT APPLE AND NOT protobuf_MSVC_STATIC_RUNTIME)
set_property(TARGET protoc
Expand Down
14 changes: 0 additions & 14 deletions overlay/osx/protobuf/port_def.patch

This file was deleted.

49 changes: 25 additions & 24 deletions overlay/osx/protobuf/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO protocolbuffers/protobuf
REF 436bd7880e458532901c58f4d9d1ea23fa7edd52 #v3.15.8
SHA512 88bb9a965bccfe11a07aee2c0c16eb9cc1845ea2d7500ef6def3e1c0a8155ac4eadd0ceef4b12552960dffe95a0fc82549d1abba71ca073ab86ec5de57d9cafb
REF v3.21.12
SHA512 152f8441c325e808b942153c15e82fdb533d5273b50c25c28916ec568ada880f79242bb61ee332ac5fb0d20f21239ed6f8de02ef6256cc574b1fc354d002c6b0
HEAD_REF master
PATCHES
fix-static-build.patch
fix-default-proto-file-path.patch
port_def.patch
compile_options.patch
)

string(COMPARE EQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" protobuf_BUILD_PROTOC_BINARIES)
Expand All @@ -27,7 +29,7 @@ endif()

if (VCPKG_DOWNLOAD_MODE)
# download PKGCONFIG in download mode which is used in `vcpkg_fixup_pkgconfig()` at the end of this script.
# download it here because `vcpkg_configure_cmake()` halts execution in download mode when running configure process.
# download it here because `vcpkg_cmake_configure()` halts execution in download mode when running configure process.
vcpkg_find_acquire_program(PKGCONFIG)
endif()

Expand All @@ -40,9 +42,8 @@ if(${VCPKG_LIBRARY_LINKAGE} STREQUAL "static")
)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/cmake
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-Dprotobuf_BUILD_SHARED_LIBS=${protobuf_BUILD_SHARED_LIBS}
-Dprotobuf_MSVC_STATIC_RUNTIME=${protobuf_MSVC_STATIC_RUNTIME}
Expand All @@ -54,7 +55,7 @@ vcpkg_configure_cmake(
${FEATURE_OPTIONS}
)

vcpkg_install_cmake()
vcpkg_cmake_install()

# It appears that at this point the build hasn't actually finished. There is probably
# a process spawned by the build, therefore we need to wait a bit.
Expand All @@ -67,52 +68,52 @@ function(protobuf_try_remove_recurse_wait PATH_TO_REMOVE)
endif()
endfunction()

protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/include)
protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/debug/include")

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake"
"\${_IMPORT_PREFIX}/bin/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}"
"\${_IMPORT_PREFIX}/tools/protobuf/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}"
)
endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake DEBUG_MODULE)
file(READ "${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake" DEBUG_MODULE)
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protobuf/protoc${EXECUTABLE_SUFFIX}" DEBUG_MODULE "${DEBUG_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake "${DEBUG_MODULE}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake" "${DEBUG_MODULE}")
endif()

protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share)
protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/debug/share")

if(protobuf_BUILD_PROTOC_BINARIES)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_copy_tools(TOOL_NAMES protoc AUTO_CLEAN)
else()
vcpkg_copy_tools(TOOL_NAMES protoc protoc-3.15.8.0 AUTO_CLEAN)
vcpkg_copy_tools(TOOL_NAMES protoc protoc-${VERSION}.0 AUTO_CLEAN)
endif()
else()
file(COPY ${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
file(COPY "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools")
endif()

vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-config.cmake
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-config.cmake"
"if(protobuf_MODULE_COMPATIBLE)"
"if(ON)"
)
if(NOT protobuf_BUILD_LIBPROTOC)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-module.cmake
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-module.cmake"
"_protobuf_find_libraries(Protobuf_PROTOC protoc)"
""
)
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/bin")
protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h"
"\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_"
"\#ifndef PROTOBUF_USE_DLLS\n\#define PROTOBUF_USE_DLLS\n\#endif // PROTOBUF_USE_DLLS\n\n\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_"
)
Expand All @@ -121,7 +122,7 @@ endif()
vcpkg_copy_pdbs()
set(packages protobuf protobuf-lite)
foreach(_package IN LISTS packages)
set(_file ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${_package}.pc)
set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${_package}.pc")
if(EXISTS "${_file}")
vcpkg_replace_string(${_file} "-l${_package}" "-l${_package}d")
endif()
Expand All @@ -130,8 +131,8 @@ endforeach()
vcpkg_fixup_pkgconfig()

if(NOT protobuf_BUILD_PROTOC_BINARIES)
configure_file(${CMAKE_CURRENT_LIST_DIR}/protobuf-targets-vcpkg-protoc.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-targets-vcpkg-protoc.cmake COPYONLY)
configure_file("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets-vcpkg-protoc.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-targets-vcpkg-protoc.cmake" COPYONLY)
endif()

configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
2 changes: 1 addition & 1 deletion overlay/osx/protobuf/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.3)
cmake_policy(POP)
endif()

find_program(Protobuf_PROTOC_EXECUTABLE NAMES protoc PATHS "${CMAKE_CURRENT_LIST_DIR}/../../tools/protobuf" NO_DEFAULT_PATH)
find_program(Protobuf_PROTOC_EXECUTABLE NAMES protoc PATHS "${CMAKE_CURRENT_LIST_DIR}/../../../@HOST_TRIPLET@/tools/protobuf" NO_DEFAULT_PATH)

_find_package(${ARGS})
13 changes: 11 additions & 2 deletions overlay/osx/protobuf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
{
"name": "protobuf",
"version-semver": "3.15.8",
"port-version": 5,
"version": "3.21.12",
"port-version": 1,
"description": "Protocol Buffers - Google's data interchange format",
"homepage": "https://github.com/protocolbuffers/protobuf",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "protobuf",
"host": true
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
Expand Down
25 changes: 25 additions & 0 deletions overlay/ports/libmad/0001-Fix-MSVC-ARM.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/mad.h b/mad.h
index 9ef6cc8..5e3f7aa 100644
--- a/mad.h
+++ b/mad.h
@@ -24,7 +24,11 @@
extern "C" {
# endif

+#ifdef _WIN64
+# define FPM_64BIT
+#else
# define FPM_INTEL
+#endif



@@ -184,7 +188,7 @@ typedef mad_fixed_t mad_sample_t;

# elif defined(FPM_INTEL)

-# if defined(_MSC_VER)
+# if defined(_MSC_VER) && defined(_M_IX86)
# pragma warning(push)
# pragma warning(disable: 4035) /* no return value */
static __forceinline
53 changes: 53 additions & 0 deletions overlay/ports/libmad/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 2.8)

project(libmad)

set(SOURCES
bit.c
bit.h
config.h
decoder.c
decoder.h
fixed.c
fixed.h
frame.c
frame.h
global.h
huffman.c
huffman.h
layer12.c
layer12.h
layer3.c
layer3.h
mad.h
stream.c
stream.h
synth.c
synth.h
timer.c
timer.h
version.c
version.h
)

add_library(
mad
${SOURCES}
)

target_compile_definitions(mad
PRIVATE _LIB _MBCS ASO_ZEROCHECK HAVE_CONFIG_H FPM_DEFAULT
PRIVATE _CRT_SECURE_NO_WARNINGS
)

install(
TARGETS mad
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

install(
FILES mad.h
DESTINATION include
)
Loading