Companion build on Linux

This commit is contained in:
Bertrand Songis
2013-12-02 18:47:43 +01:00
parent 942e658c8e
commit 2f8f2df3c7
530 changed files with 230710 additions and 0 deletions
@@ -0,0 +1,190 @@
/*
_____________________________________________________________________________
File Association
_____________________________________________________________________________
Based on code taken from http://nsis.sourceforge.net/File_Association
Usage in script:
1. !include "FileAssociation.nsh"
2. [Section|Function]
${FileAssociationFunction} "Param1" "Param2" "..." $var
[SectionEnd|FunctionEnd]
FileAssociationFunction=[RegisterExtension|UnRegisterExtension]
_____________________________________________________________________________
${RegisterExtension} "[executable]" "[extension]" "[description]"
"[executable]" ; executable which opens the file format
;
"[extension]" ; extension, which represents the file format to open
;
"[description]" ; description for the extension. This will be display in Windows Explorer.
;
${UnRegisterExtension} "[extension]" "[description]"
"[extension]" ; extension, which represents the file format to open
;
"[description]" ; description for the extension. This will be display in Windows Explorer.
;
_____________________________________________________________________________
Macros
_____________________________________________________________________________
Change log window verbosity (default: 3=no script)
Example:
!include "FileAssociation.nsh"
!insertmacro RegisterExtension
${FileAssociation_VERBOSE} 4 # all verbosity
!insertmacro UnRegisterExtension
${FileAssociation_VERBOSE} 3 # no script
*/
!ifndef FileAssociation_INCLUDED
!define FileAssociation_INCLUDED
!include Util.nsh
!verbose push
!verbose 3
!ifndef _FileAssociation_VERBOSE
!define _FileAssociation_VERBOSE 3
!endif
!verbose ${_FileAssociation_VERBOSE}
!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE`
!verbose pop
!macro FileAssociation_VERBOSE _VERBOSE
!verbose push
!verbose 3
!undef _FileAssociation_VERBOSE
!define _FileAssociation_VERBOSE ${_VERBOSE}
!verbose pop
!macroend
!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION
!verbose push
!verbose ${_FileAssociation_VERBOSE}
Push `${_DESCRIPTION}`
Push `${_EXTENSION}`
Push `${_EXECUTABLE}`
${CallArtificialFunction} RegisterExtension_
!verbose pop
!macroend
!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION
!verbose push
!verbose ${_FileAssociation_VERBOSE}
Push `${_EXTENSION}`
Push `${_DESCRIPTION}`
${CallArtificialFunction} UnRegisterExtension_
!verbose pop
!macroend
!define RegisterExtension `!insertmacro RegisterExtensionCall`
!define un.RegisterExtension `!insertmacro RegisterExtensionCall`
!macro RegisterExtension
!macroend
!macro un.RegisterExtension
!macroend
!macro RegisterExtension_
!verbose push
!verbose ${_FileAssociation_VERBOSE}
Exch $R2 ;exe
Exch
Exch $R1 ;ext
Exch
Exch 2
Exch $R0 ;desc
Exch 2
Push $0
Push $1
ReadRegStr $1 HKCR $R1 "" ; read current file association
StrCmp "$1" "" NoBackup ; is it empty
StrCmp "$1" "$R0" NoBackup ; is it our own
WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value
NoBackup:
WriteRegStr HKCR $R1 "" "$R0" ; set our file association
ReadRegStr $0 HKCR $R0 ""
StrCmp $0 "" 0 Skip
WriteRegStr HKCR "$R0" "" "$R0"
WriteRegStr HKCR "$R0\shell" "" "open"
WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0"
Skip:
WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"'
WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0"
WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"'
Pop $1
Pop $0
Pop $R2
Pop $R1
Pop $R0
!verbose pop
!macroend
!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
!macro UnRegisterExtension
!macroend
!macro un.UnRegisterExtension
!macroend
!macro UnRegisterExtension_
!verbose push
!verbose ${_FileAssociation_VERBOSE}
Exch $R1 ;desc
Exch
Exch $R0 ;ext
Exch
Push $0
Push $1
ReadRegStr $1 HKCR $R0 ""
StrCmp $1 $R1 0 NoOwn ; only do this if we own it
ReadRegStr $1 HKCR $R0 "backup_val"
StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
DeleteRegKey HKCR $R0
Goto NoOwn
Restore:
WriteRegStr HKCR $R0 "" $1
DeleteRegValue HKCR $R0 "backup_val"
DeleteRegKey HKCR $R1 ;Delete key with association name settings
NoOwn:
Pop $1
Pop $0
Pop $R1
Pop $R0
!verbose pop
!macroend
!endif # !FileAssociation_INCLUDED
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,186 @@
;NSIS Modern User Interface
;Start Menu Folder Selection Example Script
;Written by Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
!include "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\FileAssociation.nsh"
;--------------------------------
;General
;Name and file
Name "companion9x"
OutFile "companion9xInstall_v@C9X_VERSION@.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\companion9x"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\companion9x" ""
;Compressor options
SetCompressor /FINAL /SOLID lzma
SetCompressorDictSize 64
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Variables
Var StartMenuFolder
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\companion9x"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
# These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Launch companion9x"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
# !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
# !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
;--------------------------------
;Installer Sections
Section "companion9x" SecDummy
SetOutPath "$INSTDIR"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\license.txt"
File "companion9x.exe"
File "C:\Programs\xerces\src\.libs\libxerces-c-3-1.dll"
File "C:\MinGW\bin\libgcc_s_dw2-1.dll"
File "C:\MinGW\bin\mingwm10.dll"
File "C:\MinGW\bin\libstdc++-6.dll"
File "@QT_BINARY_DIR@\QtCore4.dll"
File "@QT_BINARY_DIR@\QtGui4.dll"
File "@QT_BINARY_DIR@\QtXml4.dll"
File "@QT_BINARY_DIR@\QtNetwork4.dll"
File "@QT_BINARY_DIR@\Phonon4.dll"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\avrdude.exe"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\avrdude.conf"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\libusb0.dll"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\dfu-util.exe"
CreateDirectory "$INSTDIR\lang"
SetOutPath "$INSTDIR\lang"
File "*.qm"
SetOutPath "$INSTDIR"
;Store installation folder
WriteRegStr HKCU "Software\companion9x" "" $INSTDIR
;Associate with extentions ,bin and .hex
${registerExtension} "$INSTDIR\companion9x.exe" ".bin" "BIN_File"
${registerExtension} "$INSTDIR\companion9x.exe" ".hex" "HEX_File"
${registerExtension} "$INSTDIR\companion9x.exe" ".companion9x" "EEPE_File"
${registerExtension} "$INSTDIR\companion9x.exe" ".eepm" "EEPM_File"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\companion9x.lnk" "$INSTDIR\companion9x.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "companion9x EEPROM editor."
LangString DESC_SecDummy ${LANG_FRENCH} "companion9x editeur d'EEPROM"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\license.txt"
Delete "$INSTDIR\companion9x.exe"
Delete "$INSTDIR\libxerces-c-3-1.dll"
Delete "$INSTDIR\libgcc_s_dw2-1.dll"
Delete "$INSTDIR\mingwm10.dll"
Delete "$INSTDIR\libstdc++-6.dll"
Delete "$INSTDIR\QtCore4.dll"
Delete "$INSTDIR\QtGui4.dll"
Delete "$INSTDIR\QtNetwork4.dll"
Delete "$INSTDIR\Phonon4.dll"
Delete "$INSTDIR\QtXml4.dll"
Delete "$INSTDIR\avrdude.exe"
Delete "$INSTDIR\avrdude.conf"
Delete "$INSTDIR\libusb0.dll"
Delete "$INSTDIR\dfu-util.exe"
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\lang\*.*"
RMDir "$INSTDIR\lang"
RMDir "$INSTDIR"
${unregisterExtension} ".bin" "BIN File"
${unregisterExtension} ".hex" "HEX File"
${unregisterExtension} ".eepm" "EEPE File"
${unregisterExtension} ".companion9x" "EEPM File"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\companion9x.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
DeleteRegKey /ifempty HKCU "Software\companion9x"
SectionEnd
Function LaunchLink
ExecShell "" "$INSTDIR\companion9x.exe"
FunctionEnd
@@ -0,0 +1,214 @@
;NSIS Modern User Interface
;Start Menu Folder Selection Example Script
;Written by Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
!include "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\FileAssociation.nsh"
;--------------------------------
;General
;Name and file
Name "companion9x"
OutFile "companion9xInstall_v@C9X_VERSION@.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\companion9x"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\companion9x" ""
;Compressor options
SetCompressor /FINAL /SOLID lzma
SetCompressorDictSize 64
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Variables
Var StartMenuFolder
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;File Exists Macro
; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation
!macro !defineifexist _VAR_NAME _FILE_NAME
!tempfile _TEMPFILE
!ifdef NSIS_WIN32_MAKENSIS
; Windows - cmd.exe
!system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"'
!else
; Posix - sh
!system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi'
!endif
!include '${_TEMPFILE}'
!delfile '${_TEMPFILE}'
!undef _TEMPFILE
!macroend
!define !defineifexist "!insertmacro !defineifexist"
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\companion9x"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
# These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Launch companion9x"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
# !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
# !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
;--------------------------------
;Installer Sections
Section "companion9x" SecDummy
SetOutPath "$INSTDIR"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\license.txt"
File "Release\companion9x.exe"
${!defineifexist} PTHREAD_WINDIR "C:\Programs\pthreads\Pre-built.2\lib\pthreadVC2.dll"
!ifdef PTHREAD_WINDIR
File "C:\Programs\pthreads\Pre-built.2\lib\pthreadVC2.dll"
!else
File "@SYSDIR@\system32\pthreadVC2.dll"
!endif
File "C:\Programs\xerces-vc\bin\xerces-c_3_1.dll"
File "C:\Programs\SDL\lib\SDL.dll"
File "@SYSDIR@\msvcp100.dll"
File "@SYSDIR@\msvcr100.dll"
File "@QT_BINARY_DIR@\QtCore4.dll"
File "@QT_BINARY_DIR@\QtGui4.dll"
File "@QT_BINARY_DIR@\QtNetwork4.dll"
File "@QT_BINARY_DIR@\Phonon4.dll"
File "@QT_BINARY_DIR@\QtXml4.dll"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\avrdude.exe"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\avrdude.conf"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\libusb0.dll"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\dfu-util.exe"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\winbuild\libusb-1.0.dll"
CreateDirectory "$INSTDIR\lang"
SetOutPath "$INSTDIR\lang"
File "*.qm"
SetOutPath "$INSTDIR"
;Store installation folder
WriteRegStr HKCU "Software\companion9x" "" $INSTDIR
;Associate with extentions ,bin and .hex
${registerExtension} "$INSTDIR\companion9x.exe" ".bin" "BIN_File"
${registerExtension} "$INSTDIR\companion9x.exe" ".hex" "HEX_File"
${registerExtension} "$INSTDIR\companion9x.exe" ".companion9x" "EEPE_File"
${registerExtension} "$INSTDIR\companion9x.exe" ".eepm" "EEPM_File"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\companion9x.lnk" "$INSTDIR\companion9x.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "companion9x EEPROM editor."
LangString DESC_SecDummy ${LANG_FRENCH} "companion9x editeur d'EEPROM"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\license.txt"
Delete "$INSTDIR\companion9x.exe"
Delete "$INSTDIR\pthreadVC2.dll"
Delete "$INSTDIR\xerces-c_3_1.dll"
Delete "$INSTDIR\SDL.dll"
Delete "$INSTDIR\msvcp100.dll"
Delete "$INSTDIR\msvcr100.dll"
Delete "$INSTDIR\QtCore4.dll"
Delete "$INSTDIR\QtGui4.dll"
Delete "$INSTDIR\QtXml4.dll"
Delete "$INSTDIR\QtNetwork4.dll"
Delete "$INSTDIR\Phonon4.dll"
Delete "$INSTDIR\avrdude.exe"
Delete "$INSTDIR\avrdude.conf"
Delete "$INSTDIR\libusb0.dll"
Delete "$INSTDIR\dfu-util.exe"
Delete "$INSTDIR\libusb-1.0.dll"
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\lang\*.*"
RMDir "$INSTDIR\lang"
RMDir "$INSTDIR"
${unregisterExtension} ".bin" "BIN File"
${unregisterExtension} ".hex" "HEX File"
${unregisterExtension} ".eepm" "EEPE File"
${unregisterExtension} ".companion9x" "EEPM File"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\companion9x.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
DeleteRegKey /ifempty HKCU "Software\companion9x"
SectionEnd
Function LaunchLink
ExecShell "" "$INSTDIR\companion9x.exe"
FunctionEnd
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
Copyright © 2011-2013 Bertrand Songis and Romolo Manfredini
companion9x is based on code named eePe by author - Erez Raviv <erezraviv@gmail.com>
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.
+28
View File
@@ -0,0 +1,28 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef WINBUILD_H
#define WINBUILD_H
#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
#define FORCEINLINE inline
#define NOINLINE
#define round(x) floor(x+0.5)
#define strcasecmp _stricmp
#define strncasecmp _tcsnicmp
#endif