Replace usage of stdenvNoCC.

- For Linux, the real fix is `hardeningDisable` of "fortify";
- For macOS, the real fix is setting the C and CXX compilers in `desktop/build.sh` as well as disabling CMake install step;
- Unfortunately for iOS we still need stdenvNoCC (or find a way to use GNU's ld instead of Apple's)

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2019-03-26 13:50:59 +01:00
parent e8f762ec6f
commit 6eb806d2c1
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
5 changed files with 21 additions and 5 deletions

View File

@ -20,7 +20,8 @@ with pkgs;
"ios" = true;
"" = true;
}.${target-os} or false;
_stdenv = stdenvNoCC; # TODO: Try to use stdenv for Darwin
# TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib)
_stdenv = if target-os == "ios" || target-os == "" then stdenvNoCC else stdenv;
statusDesktop = callPackage ./scripts/lib/setup/nix/desktop { inherit target-os; stdenv = _stdenv; };
statusMobile = callPackage ./scripts/lib/setup/nix/mobile { inherit target-os; stdenv = _stdenv; };
nodeInputs = import ./scripts/lib/setup/nix/global-node-packages/output {
@ -53,7 +54,6 @@ with pkgs;
wget
] ++ nodePkgs
++ lib.optional isDarwin cocoapods
++ lib.optional isLinux gcc7
++ lib.optional targetDesktop statusDesktop.buildInputs
++ lib.optional targetMobile statusMobile.buildInputs;
shellHook =
@ -68,4 +68,5 @@ with pkgs;
fi
set +e
'';
hardeningDisable = statusDesktop.hardeningDisable;
}

View File

@ -34,4 +34,12 @@ echo "build.sh desktop fonts: "$desktopFonts
rm -rf CMakeFiles CMakeCache.txt cmake_install.cmake Makefile
# Build project
cmake -DCMAKE_BUILD_TYPE=Debug -DEXTERNAL_MODULES_DIR="$ExternalModulesPaths" -DJS_BUNDLE_PATH="$JsBundlePath" -DDESKTOP_FONTS="$desktopFonts" . && make
cmake -DCMAKE_BUILD_TYPE=Debug \
-DEXTERNAL_MODULES_DIR="$ExternalModulesPaths" \
-DJS_BUNDLE_PATH="$JsBundlePath" \
-DDESKTOP_FONTS="$desktopFonts" \
-DCMAKE_C_COMPILER='gcc'\
-DCMAKE_CXX_COMPILER='g++' \
-DCMAKE_INSTALL_COMPONENT='' \
. && \
make

View File

@ -79,6 +79,9 @@ 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)"

View File

@ -36,7 +36,8 @@ in
'' else ''
export QT_PATH="${qt5.full}"
export PATH="${stdenv.lib.makeBinPath [ qt5.full ]}:$PATH"
'') + (lib.optionalString isDarwin ''
export MACOSX_DEPLOYMENT_TARGET=10.9
'');
# Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 )
hardeningDisable = linuxPlatform.hardeningDisable;
}

View File

@ -11,4 +11,7 @@ let
in
{
buildInputs = [ appimagekit linuxdeployqt patchelf baseImage ];
# Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 )
hardeningDisable = [ "fortify" ];
}