From 66924cd832fcff534c1bb369c799b4a30ec85ab1 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 22 Sep 2015 13:48:36 +0100 Subject: [PATCH] Windows 64 bit build and installer. --- config.mk | 2 +- .../{mosquitto-cygwin.nsi => mosquitto64.nsi} | 112 ++++++++++++------ lib/CMakeLists.txt | 6 +- 3 files changed, 80 insertions(+), 40 deletions(-) rename installer/{mosquitto-cygwin.nsi => mosquitto64.nsi} (58%) diff --git a/config.mk b/config.mk index 8aaa7bdd..76399d7e 100644 --- a/config.mk +++ b/config.mk @@ -86,7 +86,7 @@ WITH_SOCKS:=yes # Also bump lib/mosquitto.h, CMakeLists.txt, -# installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi +# installer/mosquitto.nsi, installer/mosquitto64.nsi VERSION=1.4.90 TIMESTAMP:=$(shell date "+%F %T%z") diff --git a/installer/mosquitto-cygwin.nsi b/installer/mosquitto64.nsi similarity index 58% rename from installer/mosquitto-cygwin.nsi rename to installer/mosquitto64.nsi index d0f02690..f61eb349 100644 --- a/installer/mosquitto-cygwin.nsi +++ b/installer/mosquitto64.nsi @@ -1,6 +1,8 @@ ; NSIS installer script for mosquitto -!include "MUI.nsh" +!include "MUI2.nsh" +!include "nsDialogs.nsh" +!include "LogicLib.nsh" ; For environment variable code !include "WinMessages.nsh" @@ -8,22 +10,31 @@ Name "mosquitto" !define VERSION 1.4.90 -OutFile "mosquitto-${VERSION}-install-cygwin.exe" +OutFile "mosquitto-${VERSION}-install-windows-x64.exe" +!include "x64.nsh" +# Default install location, for 32-bit files InstallDir "$PROGRAMFILES\mosquitto" +# Override install and registry locations if this is a 64-bit install. +function .onInit + ${If} ${ARCH} == "x64" + SetRegView 64 + StrCpy $INSTDIR "$PROGRAMFILES64\mosquitto" + ${EndIf} +functionEnd + ;-------------------------------- ; Installer pages !insertmacro MUI_PAGE_WELCOME + +Page custom DependencyPage !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES - -!define MUI_FINISHPAGE_TEXT "mosquitto has been installed on your computer.\n\nTo complete the installation you must install the dependencies described in the following readme.\n\nClick Finish to close this wizard." -!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme-dependencies-cygwin.txt -!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show dependencies readme" !insertmacro MUI_PAGE_FINISH + ;-------------------------------- ; Uninstaller pages !insertmacro MUI_UNPAGE_WELCOME @@ -33,7 +44,6 @@ InstallDir "$PROGRAMFILES\mosquitto" ;-------------------------------- ; Languages - !insertmacro MUI_LANGUAGE "English" ;-------------------------------- @@ -42,45 +52,40 @@ InstallDir "$PROGRAMFILES\mosquitto" Section "Files" SecInstall SectionIn RO SetOutPath "$INSTDIR" - ;File "c:\cygwin\bin\cygwin1.dll" - ;File "c:\cygwin\bin\cyggcc_s-1.dll" - ;File "c:\cygwin\bin\cygcrypto-1.0.0.dll" - ;File "c:\cygwin\bin\cygssl-1.0.0.dll" - ;File "c:\cygwin\bin\cygz.dll" - File "..\src\mosquitto.exe" - File "..\build\src\Release\mosquitto_passwd.exe" - File "..\build\client\Release\mosquitto_pub.exe" - File "..\build\client\Release\mosquitto_sub.exe" - File "..\build\lib\Release\mosquitto.dll" - File "..\build\lib\cpp\Release\mosquittopp.dll" + File "..\build64\src\Release\mosquitto.exe" + File "..\build64\src\Release\mosquitto_passwd.exe" + File "..\build64\client\Release\mosquitto_pub.exe" + File "..\build64\client\Release\mosquitto_sub.exe" + File "..\build64\lib\Release\mosquitto.dll" + File "..\build64\lib\cpp\Release\mosquittopp.dll" File "..\aclfile.example" File "..\ChangeLog.txt" File "..\mosquitto.conf" File "..\pwfile.example" File "..\readme.md" File "..\readme-windows.txt" - ;File "C:\pthreads\Pre-built.2\dll\x86\pthreadVC2.dll" - ;File "C:\OpenSSL-Win32\libeay32.dll" - ;File "C:\OpenSSL-Win32\ssleay32.dll" + ;File "C:\pthreads\Pre-built.2\dll\x64\pthreadVC2.dll" + ;File "C:\OpenSSL-Win64\libeay32.dll" + ;File "C:\OpenSSL-Win64\ssleay32.dll" File "..\edl-v10" File "..\epl-v10" SetOutPath "$INSTDIR\devel" File "..\lib\mosquitto.h" - File "..\build\lib\Release\mosquitto.lib" + File "..\build64\lib\Release\mosquitto.lib" File "..\lib\cpp\mosquittopp.h" - File "..\build\lib\cpp\Release\mosquittopp.lib" + File "..\build64\lib\cpp\Release\mosquittopp.lib" File "..\src\mosquitto_plugin.h" WriteUninstaller "$INSTDIR\Uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "DisplayName" "Mosquitto MQTT broker" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "HelpLink" "http://mosquitto.org/" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "URLInfoAbout" "http://mosquitto.org/" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "DisplayVersion" "${VERSION}" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "NoModify" "1" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "NoRepair" "1" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "DisplayName" "Mosquitto MQTT broker (64 bit)" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "HelpLink" "http://mosquitto.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "URLInfoAbout" "http://mosquitto.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "DisplayVersion" "${VERSION}" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "NoModify" "1" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "NoRepair" "1" WriteRegExpandStr ${env_hklm} MOSQUITTO_DIR $INSTDIR SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 @@ -92,11 +97,6 @@ SectionEnd Section "Uninstall" ExecWait '"$INSTDIR\mosquitto.exe" uninstall' - ;Delete "$INSTDIR\cygwin1.dll" - ;Delete "$INSTDIR\cyggcc_s-1.dll" - ;Delete "$INSTDIR\cygcrypto-1.0.0.dll" - ;Delete "$INSTDIR\cygssl-1.0.0.dll" - ;Delete "$INSTDIR\cygz.dll" Delete "$INSTDIR\mosquitto.exe" Delete "$INSTDIR\mosquitto_passwd.exe" Delete "$INSTDIR\mosquitto_pub.exe" @@ -123,15 +123,51 @@ Section "Uninstall" Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" DeleteRegValue ${env_hklm} MOSQUITTO_DIR SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 SectionEnd LangString DESC_SecInstall ${LANG_ENGLISH} "The main installation." -LangString DESC_SecService ${LANG_ENGLISH} "Install mosquitto as a Windows service (needs all dependencies installed)?" +LangString DESC_SecService ${LANG_ENGLISH} "Install mosquitto as a Windows service?" !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecInstall} $(DESC_SecInstall) !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService) !insertmacro MUI_FUNCTION_DESCRIPTION_END + +Var Dialog +Var OSSLLink +Var PTHLink + +Function DependencyPage + nsDialogs::Create 1018 + Pop $Dialog + + ${If} $Dialog == error + Abort + ${EndIf} + + ${NSD_CreateLabel} 0 0 100% 12u "OpenSSL - install 'Win64 OpenSSL vXXXXX Light' then copy dlls to the mosquitto directory" + ${NSD_CreateLink} 13u 13u 100% 12u "http://slproweb.com/products/Win32OpenSSL.html" + Pop $OSSLLink + ${NSD_OnClick} $OSSLLink OnClick_OSSL + + ${NSD_CreateLabel} 0 26u 100% 12u "pthreads - copy 'pthreadVC2.dll' to the mosquitto directory" + ${NSD_CreateLink} 13u 39u 100% 12u "ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/dll/x64/" + Pop $PTHLink + ${NSD_OnClick} $PTHLink OnClick_PTH + + !insertmacro MUI_HEADER_TEXT_PAGE "Dependencies" "This page lists packages that must be installed if not already present" + nsDialogs::Show +FunctionEnd + +Function OnClick_OSSL + Pop $0 + ExecShell "open" "http://slproweb.com/products/Win32OpenSSL.html" +FunctionEnd + +Function OnClick_PTH + Pop $0 + ExecShell "open" "ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/dll/x64/" +FunctionEnd diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 98190e3f..05304654 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -4,7 +4,11 @@ option(WITH_THREADING "Include client library threading support?" ON) if (${WITH_THREADING} STREQUAL ON) add_definitions("-DWITH_THREADING") if (WIN32) - set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib) + if (CMAKE_CL_64) + set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x64\\pthreadVC2.lib) + else (CMAKE_CL_64) + set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib) + endif (CMAKE_CL_64) set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include) else (WIN32) set (PTHREAD_LIBRARIES pthread)