diff options
author | elfmz <fenix1905@tut.by> | 2021-04-25 23:04:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 23:04:41 +0300 |
commit | 7eb14e56ec589621dbdc03842f7cdafb5d4592ca (patch) | |
tree | 1f39208f4dd2e26279aeb53b816ba243ff4c3117 | |
parent | 8f3e201b622b405edab5b45f9223c0930988a34a (diff) | |
parent | 215dc82b5f612ada90af7233d116566383d5d7dc (diff) |
Merge pull request #995 from elfmz/fix-old-macos
macos: fix old ElCapitan build and improve frameworks packaging
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | NetRocks/src/Protocol/SSH/ProtocolSCP.cpp | 9 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | WinPort/src/Backend/WX/Mac/touchbar.mm | 14 | ||||
-rw-r--r-- | farlng/src/lng.common.h | 1 | ||||
-rw-r--r-- | packaging/osx/FixupBundle.cmake | 72 |
6 files changed, 37 insertions, 64 deletions
@@ -17,4 +17,5 @@ build/ CPackConfig.cmake CPackSourceConfig.cmake *.cbp -cmake-build-*
\ No newline at end of file +cmake-build-* +.DS_Store diff --git a/NetRocks/src/Protocol/SSH/ProtocolSCP.cpp b/NetRocks/src/Protocol/SSH/ProtocolSCP.cpp index e289b277..e3d3ba07 100644 --- a/NetRocks/src/Protocol/SSH/ProtocolSCP.cpp +++ b/NetRocks/src/Protocol/SSH/ProtocolSCP.cpp @@ -69,7 +69,7 @@ ProtocolSCP::ProtocolSCP(const std::string &host, unsigned int port, { StringConfig protocol_options(options); _conn = std::make_shared<SSHConnection>(host, port, username, password, protocol_options); - clock_gettime(CLOCK_REALTIME, &_now); + _now.tv_sec = time(nullptr); } ProtocolSCP::~ProtocolSCP() @@ -436,7 +436,6 @@ static std::string ExtractStringTail(std::string &line) class SCPDirectoryEnumer : public IDirectoryEnumer { std::shared_ptr<SSHConnection> _conn; - struct timespec _now; bool _finished = false; SCPRemoteCommand _cmd; @@ -495,8 +494,8 @@ class SCPDirectoryEnumer : public IDirectoryEnumer } public: - SCPDirectoryEnumer(std::shared_ptr<SSHConnection> &conn, std::string path, const struct timespec &now) - : _conn(conn), _now(now) + SCPDirectoryEnumer(std::shared_ptr<SSHConnection> &conn, std::string path) + : _conn(conn) { std::string command_line = "stat --format=\"%n %f %s %X %Y %Z %U %G\" "; command_line+= QuotedArg(path); @@ -550,7 +549,7 @@ std::shared_ptr<IDirectoryEnumer> ProtocolSCP::DirectoryEnum(const std::string & { _conn->executed_command.reset(); - return std::make_shared<SCPDirectoryEnumer>(_conn, path, _now); + return std::make_shared<SCPDirectoryEnumer>(_conn, path); } class SCPFileReader : public IFileReader @@ -98,7 +98,7 @@ cd far2l ``` * Install needed dependencies with MacPorts: ``` sh -sudo port install cmake gawk pkgconfig wxWidgets-3.2 libssh openssl xercesc3 libfmt spdlog uchardet +sudo port install cmake gawk pkgconfig wxWidgets-3.2 libssh openssl xercesc3 libfmt spdlog uchardet neon ``` * OR if you prefer to use brew packages, then: ```sh diff --git a/WinPort/src/Backend/WX/Mac/touchbar.mm b/WinPort/src/Backend/WX/Mac/touchbar.mm index b43aa5d3..235b0df0 100644 --- a/WinPort/src/Backend/WX/Mac/touchbar.mm +++ b/WinPort/src/Backend/WX/Mac/touchbar.mm @@ -1,5 +1,10 @@ #import <Cocoa/Cocoa.h> +#include <AvailabilityMacros.h> + #include "touchbar.h" + +#if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12 + #include <string> #ifndef CONSOLE_FKEYS_COUNT @@ -246,3 +251,12 @@ void Touchbar_SetAlternate(bool on) Touchbar_ApplyTitles(); } } + +#else + +void Touchbar_Register(ITouchbarListener *listener) {} +void Touchbar_Deregister() {} +bool Touchbar_SetTitles(const char **titles) { return false; } +void Touchbar_SetAlternate(bool on) {} + +#endif diff --git a/farlng/src/lng.common.h b/farlng/src/lng.common.h index e4ef53ac..d01fc73f 100644 --- a/farlng/src/lng.common.h +++ b/farlng/src/lng.common.h @@ -1,6 +1,7 @@ #pragma once #include <stdint.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> diff --git a/packaging/osx/FixupBundle.cmake b/packaging/osx/FixupBundle.cmake index 9c11c8eb..28a5a6a9 100644 --- a/packaging/osx/FixupBundle.cmake +++ b/packaging/osx/FixupBundle.cmake @@ -1,63 +1,21 @@ include(BundleUtilities) -# Patching CMake's set_bundle_key_values function to correctly fix up nested executables (e.g. brokers) -# By default CMake assumes that all executables are contained in Contents/MacOS folder, so fixing up them doesn't work -# If you're able to understand the code below, you're genius -function(set_bundle_key_values keys_var context item exepath dirs copyflag) - # context is the full path to binary for which dependencies are calculated - # item is particular dependency - - get_item_key(${item} key) - get_filename_component(item_name "${item}" NAME) - - # process only executables in MacOS folder - is_file_executable("${context}" is_executable) - if (${is_executable} AND (context MATCHES "Contents/MacOS/") AND NOT ("${item}" STREQUAL "${context}")) - set(is_processing 1) - else () - set(is_processing 0) - endif () - - if (is_processing) - # exepath also should be rewritten to point to nested folder - get_filename_component(exepath "${context}" DIRECTORY) - else () - get_filename_component(exepath "${executable}" PATH) - endif () - - _set_bundle_key_values(${keys_var} "${context}" "${item}" "${exepath}" "${dirs}" ${copyflag}) - - set(default_embedded_path ${${key}_DEFAULT_EMBEDDED_PATH}) - set(resolved_embedded_item ${${key}_RESOLVED_EMBEDDED_ITEM}) - set(embedded_item ${${key}_EMBEDDED_ITEM}) - - if (is_processing) - # calculate relative path for dependency (@executable_path/..(/..)/Frameworks) - string(REPLACE "${APP_INSTALL_DIR}/Contents/MacOS" "" relative_path "${exepath}") - string(REGEX REPLACE "[^/]+" ".." relative_path "${relative_path}") - set(default_embedded_path "@executable_path${relative_path}/../Frameworks") - set(embedded_item "${default_embedded_path}/${item_name}") - string(REPLACE "@executable_path" "${exepath}" resolved_embedded_item "${embedded_item}") - get_filename_component(resolved_embedded_item "${resolved_embedded_item}" ABSOLUTE) - if (NOT copyflag) - set(resolved_embedded_item "${resolved_item}") - endif () - endif () - - # setting up back all variables to parent scope - set(exepath ${exepath} PARENT_SCOPE) - set(${keys_var} ${${keys_var}} PARENT_SCOPE) - set(${key}_ITEM "${${key}_ITEM}" PARENT_SCOPE) - set(${key}_RESOLVED_ITEM "${${key}_RESOLVED_ITEM}" PARENT_SCOPE) - set(${key}_DEFAULT_EMBEDDED_PATH "${default_embedded_path}" PARENT_SCOPE) - set(${key}_EMBEDDED_ITEM "${embedded_item}" PARENT_SCOPE) - set(${key}_RESOLVED_EMBEDDED_ITEM "${resolved_embedded_item}" PARENT_SCOPE) - set(${key}_COPYFLAG "${${key}_COPYFLAG}" PARENT_SCOPE) - set(${key}_RPATHS "${${key}_RPATHS}" PARENT_SCOPE) - set(${key}_RDEP_RPATHS "${${key}_RDEP_RPATHS}" PARENT_SCOPE) -endfunction() +# By default CMake assumes that all executables are contained in Contents/MacOS folder, +# so fixing up executable files belonging to plugins doesn't work. So some han.. +# manual job must be done to fixup plugins. +# STEP 1: manually find and fixup plugins files set(BU_CHMOD_BUNDLE_ITEMS TRUE) -set(APP_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/@APP_NAME@.app") +set(APP_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/far2l.app") file(GLOB_RECURSE PLUGINS "${APP_INSTALL_DIR}/**/*.far-plug*") fixup_bundle("${APP_INSTALL_DIR}" "${PLUGINS}" "" IGNORE_ITEM "python;python3;python3.8;Python;.Python") + +# STEP 2: +# Unfortunately cmake's fixup_bundle doesnt know about @loader_path and previous solution +# for plugins created incorrect dependencies in copied into Frameworks libraries. +# So here is stupidly simple workaround: create Frameworks symlink in eaach plugin's dir +# that relatively point to main bundle's Frameworks. +file(GLOB PLUGINDIRS "${APP_INSTALL_DIR}/Contents/MacOS/Plugins/*") +foreach(PLUGINDIR ${PLUGINDIRS}) + execute_process(COMMAND ln -s ../../../Frameworks "${PLUGINDIR}/Frameworks") +endforeach() |