Improvements for a pure macOS Nix environment
This commit is contained in:
parent
5ce43b75f3
commit
fca01891ba
|
@ -16,8 +16,8 @@ def getToolVersion(name) {
|
|||
}
|
||||
|
||||
def nix_sh(cmd) {
|
||||
def isPure = env.TARGET_OS == 'linux' || env.TARGET_OS == 'android'
|
||||
def pureFlag = isPure ? '--pure --keep LOCALE_ARCHIVE_2_27 --keep REALM_DISABLE_ANALYTICS --keep STATUS_RELEASE_STORE_FILE --keep STATUS_RELEASE_STORE_PASSWORD --keep STATUS_RELEASE_KEY_ALIAS --keep STATUS_RELEASE_KEY_PASSWORD --keep VERBOSE_LEVEL' : ''
|
||||
def isPure = env.TARGET_OS != 'windows' && env.TARGET_OS != 'ios' && !cmd.contains('prepare-for-platform.sh')
|
||||
def pureFlag = isPure ? '--pure --keep LOCALE_ARCHIVE_2_27 --keep REALM_DISABLE_ANALYTICS --keep STATUS_RELEASE_STORE_FILE --keep STATUS_RELEASE_STORE_PASSWORD --keep STATUS_RELEASE_KEY_ALIAS --keep STATUS_RELEASE_KEY_PASSWORD --keep GPG_PASS_OUTER --keep GPG_PASS_INNER --keep KEYCHAIN_PASS --keep VERBOSE_LEVEL' : ''
|
||||
|
||||
sh """
|
||||
set +x
|
||||
|
@ -30,7 +30,7 @@ def nix_sh(cmd) {
|
|||
}
|
||||
|
||||
def nix_fastlane_sh(cmd) {
|
||||
def isPure = env.TARGET_OS == 'android'
|
||||
def isPure = env.TARGET_OS != 'ios'
|
||||
def pureFlag = isPure ? '--pure --keep LANG --keep LANGUAGE --keep LC_ALL --keep DIAWI_TOKEN --keep DIAWI_IPA --keep APK_PATH --keep GOOGLE_PLAY_JSON_KEY --keep SAUCE_LABS_NAME --keep SAUCE_USERNAME --keep SAUCE_ACCESS_KEY --keep FASTLANE_DISABLE_COLORS --keep FASTLANE_APPLE_ID --keep FASTLANE_PASSWORD --keep KEYCHAIN_PASSWORD --keep MATCH_PASSWORD --keep REALM_DISABLE_ANALYTICS --keep STATUS_RELEASE_STORE_FILE --keep GRADLE_USER_HOME' : ''
|
||||
|
||||
sh """
|
||||
|
|
|
@ -35,6 +35,7 @@ with pkgs;
|
|||
] ++ status-go.packages
|
||||
++ nodePkgBuildInputs
|
||||
++ lib.optional isDarwin cocoapods
|
||||
++ lib.optional (isDarwin && !platform.targetIOS) clang
|
||||
++ lib.optional (!isDarwin) gcc7
|
||||
++ lib.optionals platform.targetDesktop statusDesktop.buildInputs
|
||||
++ lib.optionals platform.targetMobile statusMobile.buildInputs;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
cmake_minimum_required(VERSION 3.12.1)
|
||||
|
||||
set(APP_NAME Status)
|
||||
set(JS_APP_NAME StatusIm)
|
||||
|
@ -20,8 +20,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNICODE -std=c11")
|
|||
set(CMAKE_INSTALL_PREFIX bin)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}" CACHE PATH "Where to place compiled executables.")
|
||||
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
|
||||
|
||||
project(${APP_NAME} C CXX)
|
||||
|
@ -80,6 +78,11 @@ if (Qt5_POSITION_INDEPENDENT_CODE)
|
|||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif(Qt5_POSITION_INDEPENDENT_CODE)
|
||||
|
||||
target_sources(${APP_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/appconfig.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/appconfig.cpp")
|
||||
|
||||
#set(SOURCE_ROOT ${CMAKE_SOURCE_DIR})
|
||||
include(CompleteBundle)
|
||||
|
||||
|
@ -89,12 +92,6 @@ else()
|
|||
set(RUN_SCRIPT_FILE_NAME "run-app.sh")
|
||||
endif()
|
||||
|
||||
|
||||
target_sources(${APP_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/appconfig.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/appconfig.cpp")
|
||||
|
||||
configure_file(
|
||||
${RUN_SCRIPT_FILE_NAME}.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${RUN_SCRIPT_FILE_NAME}
|
||||
|
|
|
@ -14,7 +14,8 @@ if(USE_QTWEBKIT)
|
|||
add_custom_command(TARGET @APP_NAME@ POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"@CONAN_BIN_DIRS_QT5-MXE@/QtWebProcess.exe"
|
||||
${TARGET_DIR})
|
||||
${TARGET_DIR}
|
||||
BYPRODUCTS ${TARGET_DIR}/QtWebProcess.exe)
|
||||
endif()
|
||||
foreach(qtmodule ${qtmodules})
|
||||
message(STATUS "Copying ${qtmodule} module to ${TARGET_DIR}")
|
||||
|
|
|
@ -11,7 +11,7 @@ if(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
|
|||
message(FATAL_ERROR "Can only cross-compile to Windows from Linux")
|
||||
endif()
|
||||
|
||||
set(USE_QTWEBKIT ON)
|
||||
set(USE_QTWEBKIT OFF)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/toolchain/")
|
||||
include(conanbuildinfo)
|
||||
|
|
|
@ -7139,8 +7139,8 @@ react-native-invertible-scroll-view@1.1.0:
|
|||
react-native-scrollable-mixin "^1.0.1"
|
||||
|
||||
"react-native-keychain@git+https://github.com/status-im/react-native-keychain.git#v.3.0.0-3-status":
|
||||
version "3.0.0-rc.3"
|
||||
resolved "git+https://github.com/status-im/react-native-keychain.git#25a76813def48ba9bf0fd1b3dd1e915d002b55dd"
|
||||
version "3.0.0-rc.4"
|
||||
resolved "git+https://github.com/status-im/react-native-keychain.git#5895bafa11e734325eaaffd56dda8ca50bfc5275"
|
||||
|
||||
"react-native-languages@git+https://github.com/status-im/react-native-languages.git#v0.1.1-status":
|
||||
version "3.0.2"
|
||||
|
|
|
@ -69,13 +69,10 @@ if (CMAKE_CROSSCOMPILING)
|
|||
endif()
|
||||
|
||||
ExternalProject_Add(SnoreNotify_ep
|
||||
GIT_REPOSITORY https://github.com/status-im/snorenotify.git
|
||||
GIT_TAG 9d54904e4896ab6c3c3a52f97381e5948b455970
|
||||
GIT_SHALLOW TRUE
|
||||
URL $ENV{SNORENOTIFY_SOURCES} # The source is defined in /nix/desktop/macos/snorenotify/default.nix
|
||||
CMAKE_ARGS ${SnoreNotify_CMAKE_ARGS}
|
||||
BUILD_BYPRODUCTS ${SnoreNotify_STATIC_LIB} ${SnoreNotify_LIBS} ${SnoreNotifyBackend_STATIC_LIB}
|
||||
${SnoreNotifyBackendSettings_STATIC_LIB} ${SnoreNotifySettings_STATIC_LIB}
|
||||
LOG_DOWNLOAD 1
|
||||
)
|
||||
|
||||
set(REACT_NATIVE_DESKTOP_EXTERNAL_PROJECT_DEPS ${REACT_NATIVE_DESKTOP_EXTERNAL_PROJECT_DEPS} SnoreNotify_ep PARENT_SCOPE)
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
{ pkgs, stdenv, fetchFromGitHub }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
version = "0.8.90";
|
||||
rev = "d3c606c55adf8c2c2747556055652b3469f6c4c2"; # This revision will get used in https://github.com/status-im/react-native-keychain/blob/master/desktop/CMakeLists.txt#L45
|
||||
sha256 = "1gqw3g0j46aswncm8fgy419lp1fp2y2nild82hs18xra5albvf3i";
|
||||
package = stdenv.mkDerivation {
|
||||
name = "qtkeychain-patched-source";
|
||||
version = "${version}-${lib.strings.substring 0 7 rev}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
inherit rev sha256;
|
||||
owner = "status-im";
|
||||
repo = "qtkeychain";
|
||||
name = "qtkeychain-source-${version}";
|
||||
};
|
||||
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/src
|
||||
cp -r $src/* $out/src/
|
||||
substituteInPlace $out/src/CMakeLists.txt \
|
||||
--replace "cmake_minimum_required(VERSION 2.8.11)" "cmake_minimum_required(VERSION 3.12.1)" \
|
||||
--replace "project(qtkeychain)" "project(qtkeychain VERSION ${version})" \
|
||||
--replace "set(QTKEYCHAIN_VERSION 0.8.90)" "set(QTKEYCHAIN_VERSION ${version})" \
|
||||
--replace "{QTKEYCHAIN_VERSION}\" VARIABLE_PREFIX SNORE" "QTKEYCHAIN_VERSION VARIABLE_PREFIX SNORE" \
|
||||
--replace "\"\$QTKEYCHAIN_VERSION" qtkeychain
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Patched sources for qtkeychain, a platform-independent Qt API for storing passwords securely";
|
||||
homepage = https://github.com/status-im/qtkeychain;
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
maintainers = [ stdenv.lib.maintainers.pombeirp ];
|
||||
platforms = with stdenv.lib.platforms; darwin ++ linux;
|
||||
};
|
||||
};
|
||||
|
||||
in package // {
|
||||
shellHook = ''
|
||||
export QTKEYCHAIN_SOURCES="${package}/src"
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
{ pkgs, stdenv, fetchFromGitHub }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
version = "0.7.1";
|
||||
rev = "9d54904e4896ab6c3c3a52f97381e5948b455970"; # This revision will get used in modules/react-native-desktop-notification/desktop/CMakeLists.txt#L71
|
||||
sha256 = "0ix1qgx877nw9mlbbqsgkis4phkkf4ax2ambziy2w48hg6ai0x4d";
|
||||
package = stdenv.mkDerivation {
|
||||
name = "snorenotify-patched-source";
|
||||
version = "${version}-${lib.strings.substring 0 7 rev}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
inherit rev sha256;
|
||||
owner = "status-im";
|
||||
repo = "snorenotify";
|
||||
name = "snorenotify-source-${version}";
|
||||
};
|
||||
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/src
|
||||
cp -r $src/* $out/src/
|
||||
substituteInPlace $out/src/CMakeLists.txt \
|
||||
--replace "cmake_minimum_required( VERSION 2.8.12 )" "" \
|
||||
--replace "project( SnoreNotify )" "cmake_minimum_required( VERSION 3.12.1 )
|
||||
project( SnoreNotify VERSION ${version} )" \
|
||||
--replace "set(SNORE_VERSION_MAJOR 0)" "set(SNORE_VERSION_MAJOR ${lib.versions.major version} )" \
|
||||
--replace "set(SNORE_VERSION_MINOR 7)" "set(SNORE_VERSION_MINOR ${lib.versions.minor version} )" \
|
||||
--replace "set(SNORE_VERSION_PATCH 1)" "set(SNORE_VERSION_PATCH ${lib.versions.patch version} )"
|
||||
substituteInPlace $out/src/src/libsnore/CMakeLists.txt \
|
||||
--replace "{SNORE_VERSION_MAJOR}" "SNORE_VERSION_MAJOR" \
|
||||
--replace "{SNORE_VERSION_MINOR}" "SNORE_VERSION_MINOR" \
|
||||
--replace "{SNORE_VERSION_PATCH}" "SNORE_VERSION_PATCH" \
|
||||
--replace "ecm_setup_version(\"\$SNORE_VERSION_MAJOR.\$SNORE_VERSION_MINOR.\$SNORE_VERSION_PATCH\"" "ecm_setup_version(SnoreNotify"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Patched sources for Snorenotify, a multi platform Qt notification framework. Using a plugin system it is possible to create notifications with many different notification systems on Windows, Mac OS and Unix and mobile Devices";
|
||||
homepage = https://github.com/status-im/snorenotify;
|
||||
license = stdenv.lib.licenses.lgpl3;
|
||||
maintainers = [ stdenv.lib.maintainers.pombeirp ];
|
||||
platforms = with stdenv.lib.platforms; darwin ++ linux;
|
||||
};
|
||||
};
|
||||
|
||||
in package // {
|
||||
shellHook = ''
|
||||
export SNORENOTIFY_SOURCES="${package}/src"
|
||||
'';
|
||||
}
|
|
@ -8,6 +8,8 @@ let
|
|||
linuxPlatform = callPackage ./linux { };
|
||||
darwinPlatform = callPackage ./macos { };
|
||||
windowsPlatform = callPackage ./windows { };
|
||||
snoreNotifySources = callPackage ./cmake/snorenotify { };
|
||||
qtkeychainSources = callPackage ./cmake/qtkeychain { };
|
||||
|
||||
in
|
||||
{
|
||||
|
@ -15,17 +17,21 @@ in
|
|||
cmake
|
||||
extra-cmake-modules
|
||||
file
|
||||
snoreNotifySources
|
||||
qtkeychainSources
|
||||
] ++ lib.optionals platform.targetLinux linuxPlatform.buildInputs
|
||||
++ lib.optionals platform.targetDarwin darwinPlatform.buildInputs
|
||||
++ lib.optionals platform.targetWindows windowsPlatform.buildInputs
|
||||
++ lib.optional (! platform.targetWindows) qt5.full;
|
||||
shellHook =
|
||||
lib.optionalString (target-os != "windows") ''
|
||||
export QT_PATH="${qt5.full}"
|
||||
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
|
||||
export PATH="${qt5.full}/bin:$PATH"
|
||||
'' +
|
||||
lib.optionalString platform.targetLinux linuxPlatform.shellHook +
|
||||
lib.optionalString platform.targetDarwin darwinPlatform.shellHook +
|
||||
lib.optionalString platform.targetWindows windowsPlatform.shellHook;
|
||||
shellHook =
|
||||
snoreNotifySources.shellHook +
|
||||
qtkeychainSources.shellHook +
|
||||
lib.optionalString (target-os != "windows") ''
|
||||
export QT_PATH="${qt5.full}"
|
||||
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
|
||||
export PATH="${qt5.full}/bin:$PATH"
|
||||
'' +
|
||||
lib.optionalString platform.targetLinux linuxPlatform.shellHook +
|
||||
lib.optionalString platform.targetDarwin darwinPlatform.shellHook +
|
||||
lib.optionalString platform.targetWindows windowsPlatform.shellHook;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
with pkgs;
|
||||
with stdenv;
|
||||
|
||||
assert isLinux;
|
||||
|
||||
let
|
||||
baseImage = callPackage ./base-image { };
|
||||
appimagekit = callPackage ./appimagekit { };
|
||||
|
|
|
@ -2,15 +2,20 @@
|
|||
|
||||
with pkgs;
|
||||
with stdenv;
|
||||
with darwin.apple_sdk.frameworks;
|
||||
|
||||
assert isDarwin;
|
||||
|
||||
let
|
||||
baseImage = callPackage ./base-image { };
|
||||
|
||||
in
|
||||
{
|
||||
buildInputs = [ baseImage ];
|
||||
buildInputs = [ baseImage ] ++
|
||||
[ AppKit Cocoa darwin.cf-private Foundation OpenGL ];
|
||||
|
||||
shellHook = ''
|
||||
export STATUSREACT_MACOS_BASEIMAGE_PATH="${baseImage}/src"
|
||||
${baseImage.shellHook}
|
||||
export NIX_TARGET_LDFLAGS="-F${CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_TARGET_LDFLAGS"
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
with pkgs;
|
||||
|
||||
assert stdenv.isLinux;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "StatusIm-Windows-base-image";
|
||||
version = "20181113";
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
with pkgs;
|
||||
with stdenv;
|
||||
|
||||
assert isLinux;
|
||||
|
||||
let
|
||||
baseImage = callPackage ./base-image { };
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ if command -v "nix" >/dev/null 2>&1; then
|
|||
exec nix-shell --show-trace --argstr target-os ${TARGET_OS}
|
||||
else
|
||||
is_pure=''
|
||||
if [ "${TARGET_OS}" == 'linux' ] || [ "${TARGET_OS}" == 'android' ]; then
|
||||
if [ "${TARGET_OS}" != 'ios' ] && [ "${TARGET_OS}" != 'windows' ]; then
|
||||
is_pure='--pure'
|
||||
pure_desc='pure '
|
||||
fi
|
||||
|
|
|
@ -79,9 +79,6 @@ if is_windows_target; then
|
|||
CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DCMAKE_C_COMPILER='x86_64-w64-mingw32.shared-gcc'"
|
||||
CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DCMAKE_CXX_COMPILER='x86_64-w64-mingw32.shared-g++'"
|
||||
CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DCMAKE_RC_COMPILER='x86_64-w64-mingw32.shared-windres'"
|
||||
elif is_macos; then
|
||||
CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DCMAKE_C_COMPILER='gcc'"
|
||||
CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DCMAKE_CXX_COMPILER='g++'"
|
||||
fi
|
||||
|
||||
STATUSREACTPATH="$(cd "$SCRIPTPATH" && cd '..' && pwd)"
|
||||
|
@ -448,7 +445,7 @@ function bundleMacOS() {
|
|||
|
||||
local qtbaseplugins=(bearer platforms printsupport styles)
|
||||
local qtfullplugins=(iconengines imageformats webview)
|
||||
if program_exists nix && [ -n "$IN_NIX_SHELL" ]; then
|
||||
if [ -n "$IN_NIX_SHELL" ]; then
|
||||
# Since in the Nix qt.full package the different Qt modules are spread across several directories,
|
||||
# macdeployqt cannot find some qtbase plugins, so we copy them in its place
|
||||
mkdir -p "$contentsPath/PlugIns"
|
||||
|
|
Loading…
Reference in New Issue