class Makensis < Formula desc "System to create Windows installers" homepage "https://nsis.sourceforge.io/" url "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.03/nsis-3.03-src.tar.bz2" sha256 "abae7f4488bc6de7a4dd760d5f0e7cd3aad7747d4d7cd85786697c8991695eaa" bottle do cellar :any_skip_relocation sha256 "b656fcbbb32f982ff66c897f8af08b989425f3c375aa96572dde0e00f05cc396" => :high_sierra sha256 "bf01aff6fbcda07ab721b743ca044207face08b9e5f200b764efce8d9adb1c37" => :sierra sha256 "f4516cec938568eb2bea2b162247a10cbd68dedd85c439f5d77170dbc7c5b81b" => :el_capitan end # From https://nsis.sourceforge.io/Special_Builds#Advanced_logging option "with-advanced-logging", "Enable advanced logging of all installer actions" # Build makensis so installers can handle strings > 1024 characters # From https://nsis.sourceforge.io/Special_Builds#Large_strings # Upstream RFE to make this default the default behavior is # https://sourceforge.net/p/nsis/feature-requests/542/ option "with-large-strings", "Enable strings up to 8192 characters instead of default 1024" depends_on "mingw-w64" => :build depends_on "scons" => :build resource "nsis" do url "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.03/nsis-3.03.zip" sha256 "b53a79078f2c6abf21f11d9fe68807f35b228393eb17a0cd3873614190116ba7" end # v1.2.8 is outdated, but the last version available as compiled DLL resource "zlib-win32" do url "https://downloads.sourceforge.net/project/libpng/zlib/1.2.8/zlib128-dll.zip" sha256 "a03fd15af45e91964fb980a30422073bc3f3f58683e9fdafadad3f7db10762b1" end # scons appears to have no builtin way to override the compiler selection, # and the only options supported on macOS are 'gcc' and 'g++'. # Use the right compiler by forcibly altering the scons config to set these patch :DATA def install # requires zlib (win32) to build utils resource("zlib-win32").stage do @zlib_path = Dir.pwd end # Don't strip, see https://github.com/Homebrew/homebrew/issues/28718 args = ["STRIP=0", "ZLIB_W32=#{@zlib_path}", "SKIPUTILS=NSIS Menu", "PREFIX_DOC=#{share}/nsis/Docs", "VERSION=#{version}"] args << "NSIS_CONFIG_LOG=yes" if build.with? "advanced-logging" args << "NSIS_MAX_STRLEN=8192" if build.with? "large-strings" scons "makensis", *args bin.install "build/urelease/makensis/makensis" (share/"nsis").install resource("nsis") end test do system "#{bin}/makensis", "-VERSION" (testpath/"test.nsi").write <<~EOS # name the installer OutFile "test.exe" # default section start; every NSIS script has at least one section. Section # default section end SectionEnd EOS system "#{bin}/makensis", "#{testpath}/test.nsi" end end __END__ diff --git a/SCons/config.py b/SCons/config.py index a344456..37c575b 100755 --- a/SCons/config.py +++ b/SCons/config.py @@ -1,3 +1,5 @@ +import os + Import('defenv') ### Configuration options @@ -440,6 +442,9 @@ Help(cfg.GenerateHelpText(defenv)) env = Environment() cfg.Update(env) +defenv['CC'] = os.environ['CC'] +defenv['CXX'] = os.environ['CXX'] + def AddValuedDefine(define): defenv.Append(NSIS_CPPDEFINES = [(define, env[define])])