Windows 64 bit build and installer.

This commit is contained in:
Roger A. Light 2015-09-22 13:48:36 +01:00
parent 9a2eb2038f
commit 66924cd832
3 changed files with 80 additions and 40 deletions

View File

@ -86,7 +86,7 @@ WITH_SOCKS:=yes
# Also bump lib/mosquitto.h, CMakeLists.txt, # Also bump lib/mosquitto.h, CMakeLists.txt,
# installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi # installer/mosquitto.nsi, installer/mosquitto64.nsi
VERSION=1.4.90 VERSION=1.4.90
TIMESTAMP:=$(shell date "+%F %T%z") TIMESTAMP:=$(shell date "+%F %T%z")

View File

@ -1,6 +1,8 @@
; NSIS installer script for mosquitto ; NSIS installer script for mosquitto
!include "MUI.nsh" !include "MUI2.nsh"
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
; For environment variable code ; For environment variable code
!include "WinMessages.nsh" !include "WinMessages.nsh"
@ -8,22 +10,31 @@
Name "mosquitto" Name "mosquitto"
!define VERSION 1.4.90 !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" 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 ; Installer pages
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
Page custom DependencyPage
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES !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 !insertmacro MUI_PAGE_FINISH
;-------------------------------- ;--------------------------------
; Uninstaller pages ; Uninstaller pages
!insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_WELCOME
@ -33,7 +44,6 @@ InstallDir "$PROGRAMFILES\mosquitto"
;-------------------------------- ;--------------------------------
; Languages ; Languages
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
;-------------------------------- ;--------------------------------
@ -42,45 +52,40 @@ InstallDir "$PROGRAMFILES\mosquitto"
Section "Files" SecInstall Section "Files" SecInstall
SectionIn RO SectionIn RO
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
;File "c:\cygwin\bin\cygwin1.dll" File "..\build64\src\Release\mosquitto.exe"
;File "c:\cygwin\bin\cyggcc_s-1.dll" File "..\build64\src\Release\mosquitto_passwd.exe"
;File "c:\cygwin\bin\cygcrypto-1.0.0.dll" File "..\build64\client\Release\mosquitto_pub.exe"
;File "c:\cygwin\bin\cygssl-1.0.0.dll" File "..\build64\client\Release\mosquitto_sub.exe"
;File "c:\cygwin\bin\cygz.dll" File "..\build64\lib\Release\mosquitto.dll"
File "..\src\mosquitto.exe" File "..\build64\lib\cpp\Release\mosquittopp.dll"
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 "..\aclfile.example" File "..\aclfile.example"
File "..\ChangeLog.txt" File "..\ChangeLog.txt"
File "..\mosquitto.conf" File "..\mosquitto.conf"
File "..\pwfile.example" File "..\pwfile.example"
File "..\readme.md" File "..\readme.md"
File "..\readme-windows.txt" File "..\readme-windows.txt"
;File "C:\pthreads\Pre-built.2\dll\x86\pthreadVC2.dll" ;File "C:\pthreads\Pre-built.2\dll\x64\pthreadVC2.dll"
;File "C:\OpenSSL-Win32\libeay32.dll" ;File "C:\OpenSSL-Win64\libeay32.dll"
;File "C:\OpenSSL-Win32\ssleay32.dll" ;File "C:\OpenSSL-Win64\ssleay32.dll"
File "..\edl-v10" File "..\edl-v10"
File "..\epl-v10" File "..\epl-v10"
SetOutPath "$INSTDIR\devel" SetOutPath "$INSTDIR\devel"
File "..\lib\mosquitto.h" File "..\lib\mosquitto.h"
File "..\build\lib\Release\mosquitto.lib" File "..\build64\lib\Release\mosquitto.lib"
File "..\lib\cpp\mosquittopp.h" File "..\lib\cpp\mosquittopp.h"
File "..\build\lib\cpp\Release\mosquittopp.lib" File "..\build64\lib\cpp\Release\mosquittopp.lib"
File "..\src\mosquitto_plugin.h" File "..\src\mosquitto_plugin.h"
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "DisplayName" "Mosquitto MQTT broker" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "DisplayName" "Mosquitto MQTT broker (64 bit)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "HelpLink" "http://mosquitto.org/" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "HelpLink" "http://mosquitto.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "URLInfoAbout" "http://mosquitto.org/" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "URLInfoAbout" "http://mosquitto.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "DisplayVersion" "${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "DisplayVersion" "${VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "NoModify" "1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" "NoRepair" "1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "NoRepair" "1"
WriteRegExpandStr ${env_hklm} MOSQUITTO_DIR $INSTDIR WriteRegExpandStr ${env_hklm} MOSQUITTO_DIR $INSTDIR
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
@ -92,11 +97,6 @@ SectionEnd
Section "Uninstall" Section "Uninstall"
ExecWait '"$INSTDIR\mosquitto.exe" 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.exe"
Delete "$INSTDIR\mosquitto_passwd.exe" Delete "$INSTDIR\mosquitto_passwd.exe"
Delete "$INSTDIR\mosquitto_pub.exe" Delete "$INSTDIR\mosquitto_pub.exe"
@ -123,15 +123,51 @@ Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR" RMDir "$INSTDIR"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MosquittoCygwin" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64"
DeleteRegValue ${env_hklm} MOSQUITTO_DIR DeleteRegValue ${env_hklm} MOSQUITTO_DIR
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd SectionEnd
LangString DESC_SecInstall ${LANG_ENGLISH} "The main installation." 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_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecInstall} $(DESC_SecInstall) !insertmacro MUI_DESCRIPTION_TEXT ${SecInstall} $(DESC_SecInstall)
!insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService) !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
!insertmacro MUI_FUNCTION_DESCRIPTION_END !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

View File

@ -4,7 +4,11 @@ option(WITH_THREADING "Include client library threading support?" ON)
if (${WITH_THREADING} STREQUAL ON) if (${WITH_THREADING} STREQUAL ON)
add_definitions("-DWITH_THREADING") add_definitions("-DWITH_THREADING")
if (WIN32) if (WIN32)
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) 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) set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
else (WIN32) else (WIN32)
set (PTHREAD_LIBRARIES pthread) set (PTHREAD_LIBRARIES pthread)