From b23014ee607663a4db2649b45b986c5e6933ed60 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sat, 27 Feb 2010 16:28:12 +0000
Subject: [PATCH] Makefile.am: Fix unix2dos and makensis parameters to allow to
 build the Windows installer on Linux also.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3070 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/CHANGELOG   |  3 +++
 smartmontools/INSTALL     |  3 +++
 smartmontools/Makefile.am | 16 +++++++++-------
 smartmontools/NEWS        |  2 ++
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG
index 630bcd314..2b8c870f3 100644
--- a/smartmontools/CHANGELOG
+++ b/smartmontools/CHANGELOG
@@ -43,6 +43,9 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Makefile.am: Fix unix2dos and makensis parameters to allow
+       to build the Windows installer on Linux also.
+
   [CF] Makefile.am: Use a separate build rule for each man page to
        avoid compatibility problems with BSD make.
 
diff --git a/smartmontools/INSTALL b/smartmontools/INSTALL
index 6afc2d17f..136cf8a08 100644
--- a/smartmontools/INSTALL
+++ b/smartmontools/INSTALL
@@ -494,6 +494,9 @@ To create a Windows installer, use:
   package. See http://nsis.sourceforge.net/ for documentation and
   download location.
 
+  It is also possible to (cross-)build the installer on Linux.
+  This was successfully tested on Debian with package "nsis".
+
 To both create and run the (interactive) installer, use:
 
   make install-win32
diff --git a/smartmontools/Makefile.am b/smartmontools/Makefile.am
index a832cc813..bf6ecc277 100644
--- a/smartmontools/Makefile.am
+++ b/smartmontools/Makefile.am
@@ -538,9 +538,10 @@ CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe \
               smartctl-nc.exe smartctl-nc.exe.tmp \
               distdir.mkdir syslogevt.check
 
-# Textfile converter from cygutils
-UNIX2DOS = unix2dos -D
-DOS2UNIX = dos2unix -U
+# Textfile converter from package cygutils or tofrodos
+# Note: Only use without options to be compatible with both packages
+UNIX2DOS = unix2dos
+DOS2UNIX = dos2unix
 
 # Build Windows distribution
 
@@ -558,11 +559,12 @@ $(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
 	cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
 
 # Build NSIS installer, try to locate makensis in default location first
+# Note: Only option character '-' is also compatible with Linux version of makensis
 $(distinst_win32): $(srcdir)/os_win32/installer.nsi distdir.mkdir $(FILES_WIN32) syslogevt.check
 	@makensis="$(MAKENSIS)"; if [ -z "$$makensis" ]; then \
-	  if [ ! -z "$$PROGRAMFILES" ] && "$$PROGRAMFILES/NSIS/makensis" /VERSION >/dev/null 2>&1; then \
+	  if [ ! -z "$$PROGRAMFILES" ] && "$$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then \
 	    makensis="$$PROGRAMFILES/NSIS/makensis"; \
-	  elif makensis /VERSION >/dev/null 2>&1; then \
+	  elif makensis -VERSION >/dev/null 2>&1; then \
 	    makensis=makensis; \
 	  else \
 	    echo 'makensis: command not found. Please download and install NSIS' 1>&2; \
@@ -572,8 +574,8 @@ $(distinst_win32): $(srcdir)/os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
 	date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`; \
 	rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`; \
 	verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO); \
-	echo "$$makensis /V2 /NOCD /DINPDIR=$(distdir_win32) /DOUTFILE=$(distinst_win32) /DVERSTR='$$verstr' $(srcdir)/os_win32/installer.nsi"; \
-	"$$makensis" /V2 /NOCD /DINPDIR="$(distdir_win32)" /DOUTFILE="$(distinst_win32)" /DVERSTR="$$verstr" "$(srcdir)/os_win32/installer.nsi"
+	echo "$$makensis -V2 -NOCD -DINPDIR=$(distdir_win32) -DOUTFILE=$(distinst_win32) -DVERSTR='$$verstr' $(srcdir)/os_win32/installer.nsi"; \
+	"$$makensis" -V2 -NOCD -DINPDIR="$(distdir_win32)" -DOUTFILE="$(distinst_win32)" -DVERSTR="$$verstr" "$(srcdir)/os_win32/installer.nsi"
 
 cleandist-win32:
 	rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
diff --git a/smartmontools/NEWS b/smartmontools/NEWS
index 3bf0cd04b..12e37973c 100644
--- a/smartmontools/NEWS
+++ b/smartmontools/NEWS
@@ -15,6 +15,8 @@ Summary: smartmontools release 5.40
 - smartd libcap-ng support, option '-C, --capabilities'.
 - smartctl option '-l scterc[,...]' to get/set the
   SCT Error Recovery Control time limit.
+- Windows: Support for 64-bit executables.
+- Windows: Support for cross compilation on Linux.
 - Fix SCT temperature table commands on big endian CPUs.
 
 Date 2010-01-28
-- 
GitLab