From 0dde9ab531b503dbbdd2660780b94e5d64108832 Mon Sep 17 00:00:00 2001 From: Maisem Ali <3953239+maisem@users.noreply.github.com> Date: Thu, 29 Apr 2021 17:36:54 -0700 Subject: [PATCH] nsis: enable builds on darwin. (#120903) Co-authored-by: Dmitry Kalinkin Co-authored-by: Sandro --- pkgs/development/tools/nsis/default.nix | 31 +++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/pkgs/development/tools/nsis/default.nix b/pkgs/development/tools/nsis/default.nix index 2d3f54bbf75b..4820d8bb4b7d 100644 --- a/pkgs/development/tools/nsis/default.nix +++ b/pkgs/development/tools/nsis/default.nix @@ -1,8 +1,11 @@ -{ lib, stdenv +{ lib +, stdenv +, symlinkJoin , fetchurl , fetchzip , sconsPackages , zlib +, libiconv }: stdenv.mkDerivation rec { @@ -28,20 +31,34 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ sconsPackages.scons_3_1_2 ]; - buildInputs = [ zlib ]; + buildInputs = [ zlib ] ++ lib.optionals stdenv.isDarwin [ libiconv ]; + + CPPPATH = symlinkJoin { + name = "nsis-includes"; + paths = [ zlib.dev ] ++ lib.optionals stdenv.isDarwin [ libiconv ]; + }; + + LIBPATH = symlinkJoin { + name = "nsis-libs"; + paths = [ zlib ] ++ lib.optionals stdenv.isDarwin [ libiconv ]; + }; sconsFlags = [ "SKIPSTUBS=all" "SKIPPLUGINS=all" "SKIPUTILS=all" "SKIPMISC=all" - "APPEND_CPPPATH=${zlib.dev}/include" - "APPEND_LIBPATH=${zlib}/lib" "NSIS_CONFIG_CONST_DATA=no" - ]; + ] ++ lib.optional stdenv.isDarwin "APPEND_LINKFLAGS=-liconv"; preBuild = '' - sconsFlagsArray+=("PATH=$PATH") + sconsFlagsArray+=( + "PATH=$PATH" + "CC=$CC" + "CXX=$CXX" + "APPEND_CPPPATH=$CPPPATH/include" + "APPEND_LIBPATH=$LIBPATH/lib" + ) ''; prefixKey = "PREFIX="; @@ -51,7 +68,7 @@ stdenv.mkDerivation rec { description = "A free scriptable win32 installer/uninstaller system that doesn't suck and isn't huge"; homepage = "https://nsis.sourceforge.io/"; license = licenses.zlib; - platforms = platforms.linux; + platforms = platforms.unix; maintainers = with maintainers; [ pombeirp ]; }; }