Skip to content

Commit

Permalink
Use nsis install
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Dec 14, 2016
1 parent 4cc7b02 commit ff54af7
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 11 deletions.
163 changes: 163 additions & 0 deletions Install/Install.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "RabbitGIS"
!define PRODUCT_VERSION "0.0.1"
!define PRODUCT_PUBLISHER "KangLin studio"
!define PRODUCT_WEB_SITE "https://github.com/KangLin/RabbitGIS"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\RabbitGIS.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\RabbitGIS"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

SetCompressor lzma

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "install\LICENSE.md"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\RabbitGIS.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "SimpChinese"

LangString LANG_PRODUCT_NAME ${LANG_ENGLISH} "RabbitGIS"
LangString LANG_PRODUCT_NAME ${LANG_SIMPCHINESE} "玉兔地理信息系统"

LangString LANG_UNINSTALL_CONFIRM ${LANG_ENGLISH} "Thank you very much! $(^Name) has been successfully removed."
LangString LANG_UNINSTALL_CONFIRM ${LANG_SIMPCHINESE} "非常感謝您的使用! $(^Name) 已成功地从您的计算机中移除。"

LangString LANG_REMOVE_COMPONENT ${LANG_ENGLISH} "You sure you want to completely remove $ (^ Name), and all of its components?"
LangString LANG_REMOVE_COMPONENT ${LANG_SIMPCHINESE} "你确实要完全移除 $(^Name) ,其及所有的组件?"

; MUI end ------

Name "$(LANG_PRODUCT_NAME) ${PRODUCT_VERSION}"
OutFile "RabbitGIS-Setup-${PRODUCT_VERSION}.exe"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
#RequestExecutionLevel user

; Install vc runtime
Function InstallVC
Push $R0
ClearErrors
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}" "Version"

; check regist
IfErrors 0 VSRedistInstalled
Exec "$INSTDIR\vcredist_x86.exe /q"
StrCpy $R0 "-1"

VSRedistInstalled:
;MessageBox MB_OK "Installed"
Exch $R0
Delete "$INSTDIR\vcredist_x86.exe"
FunctionEnd

Function InstallFont
StrCmp $LANGUAGE "2052" 0 +3
;Modify environment variable for default font to simsun.ttc
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "OSGEARTH_DEFAULT_FONT" "simsun.ttc"
;Reflash environment variable
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment"
FunctionEnd

Function InstallRuntime
IfFileExists "$INSTDIR\vcredist_x86.exe" 0 +2
call InstallVC
FunctionEnd

Function .onInit
; !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

Section "${PRODUCT_NAME}" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File /r "install\*"
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\RabbitGIS.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\RabbitGIS.exe"
SetShellVarContext current
call InstallRuntime
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
SetShellVarContext current
SectionEnd

Section -Post
; WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\RabbitGIS.exe"
call InstallFont
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\RabbitGIS.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd

; Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "$(LANG_PRODUCT_NAME)"
!insertmacro MUI_FUNCTION_DESCRIPTION_END

Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(LANG_UNINSTALL_CONFIRM)"
FunctionEnd

Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(LANG_REMOVE_COMPONENT)" IDYES +2
Abort
FunctionEnd

Section Uninstall
SetShellVarContext all
RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}"
Delete "$DESKTOP\RabbitGIS.lnk"
SetOutPath "$SMPROGRAMS"
SetShellVarContext current
RMDir /r "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "OSGEARTH_DEFAULT_FONT"
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment"
SetAutoClose true
SectionEnd
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|[<img src="Resource/png/China.png" alt="Chinese" title="Chinese" width="16" height="16" />Chinese](README_ZH.md)|

-----------------------------------------------------------------------------
## Build
## Build and package
### 1. Download Precompiled or compiled third-party libraries
#### 1.1. Download the precompiled third-party libraries
Download from https://sourceforge.net/projects/rabbitim-third-library/files/release/
Expand Down Expand Up @@ -53,6 +53,16 @@ Open "project->build and run->run->run environment"
#### 3.1 Automatically build the generated application
Download:https://sourceforge.net/projects/rabbitgis/files/

#### 3.2 Manual packing
##### 3.2.1 windows
1. Copy Install/Install.nsi to output directory

cp Install/Install.nsi build_${BUILD_TARGERT}

2. Execute

"/C/Program Files (x86)/NSIS/makensis.exe" "build_${BUILD_TARGERT}/Install.nsi"

## depend third-party libraries
* osgearth
* osg
Expand Down
12 changes: 11 additions & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
|[<img src="Resource/png/English.png" alt="English" title="English" width="16" height="16" />英语](README.md)|

-----------------------------------------------------------------------------
## 编译
## 编译和打包
### 1. 下载预编译或编译第三方依赖库
#### 1.1. 下载预编译第三方依赖库
https://sourceforge.net/projects/rabbitim-third-library/files/release/ 下载与你编译器和QT版本相同的库。
Expand Down Expand Up @@ -54,6 +54,16 @@ See [RabbitThirdLibrary](https://github.com/KangLin/RabbitThirdLibrary)
#### 3.1 自动编译产生的应用程序
下载:https://sourceforge.net/projects/rabbitgis/files/

#### 3.2 手动打包
##### 3.2.1 windows
1. 把Install/Install.nsi复制到编译输出目录下

cp Install/Install.nsi build_${BUILD_TARGERT}

2. 执行

"/C/Program Files (x86)/NSIS/makensis.exe" "build_${BUILD_TARGERT}/Install.nsi"

## 第三方依赖库
* osgearth
* osg
Expand Down
21 changes: 14 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ environment:
QT_VERSION: qt5.7
QT_ROOT: /C/Qt/5.7/msvc2015
AUTOBUILD_ARCH: x86
IsDeploy: true
DOWNLOAD_FILE: https://sourceforge.net/projects/rabbitthirdlibrary/files/rabbit_windows_msvc14_x86_qt5.7.tar.gz/download
PASSWORD:
secure: 2WEtOQrdty3V3g0aEVvS3Q==
Expand Down Expand Up @@ -167,7 +168,7 @@ init:
- del C:\msys64\usr\bin\link.exe

install:
#- C:\msys64\usr\bin\pacman.exe -Syu --noconfirm
#- C:\msys64\usr\bin\pacman.exe -Syu --noconfirm
#- C:\msys64\autorebase.bat
- C:\msys64\usr\bin\pacman.exe -S --noconfirm nasm yasm unzip curl zip expect
- C:\msys64\autorebase.bat
Expand All @@ -180,14 +181,18 @@ before_build:
build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- C:\msys64\usr\bin\bash.exe %APPVEYOR_BUILD_FOLDER%\ci\build.sh
# - C:\msys64\usr\bin\bash.exe %APPVEYOR_BUILD_FOLDER%\ci\Deploy.sh
- C:\msys64\usr\bin\bash.exe %APPVEYOR_BUILD_FOLDER%\ci\Deploy.sh

#after_build:

artifacts:
- path: build_$(BUILD_TARGERT)/install
#- path: build_$(BUILD_TARGERT)/install
# name: RabbitGIS_$(BUILD_TARGERT)$(TOOLCHAIN_VERSION)_$(AUTOBUILD_ARCH)_$(QT_VERSION)_v$(appveyor_build_version)
# type: zip

- path: build_${BUILD_TARGERT}/RabbitGIS-Setup-*.exe
name: RabbitGIS_$(BUILD_TARGERT)$(TOOLCHAIN_VERSION)_$(AUTOBUILD_ARCH)_$(QT_VERSION)_v$(appveyor_build_version)
type: zip
# type: zip

test: off

Expand All @@ -197,13 +202,15 @@ deploy:
host: frs.sourceforge.net
username: kl222,rabbitgis
#密码用这个加密 https://ci.appveyor.com/tools/encrypt
password:
secure: 2WEtOQrdty3V3g0aEVvS3Q==
password:
secure: 2WEtOQrdty3V3g0aEVvS3Q==
folder: pfs #link pfs to /home/frs/project/r/ra/rabbitgis
draft: false
active_mode: false
on:
branch: master
#branch: master
appveyor_repo_tag: true
IsDeploy: true

#deploy:
# provider: GitHub
Expand Down
6 changes: 4 additions & 2 deletions ci/Deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ fi

cd ${SOURCE_DIR}
if [ "${BUILD_TARGERT}" != "android" ]; then
zip -rq RabbitGIS_${BUILD_TARGERT}${TOOLCHAIN_VERSION}_${AUTOBUILD_ARCH}_${QT_VERSION}_v${BUILD_VERSION}.zip build_${BUILD_TARGERT}/install
cp Install/Install.nsi build_${BUILD_TARGERT}
"/C/Program Files (x86)/NSIS/makensis.exe" "build_${BUILD_TARGERT}/Install.nsi"
#zip -rq RabbitGIS_${BUILD_TARGERT}${TOOLCHAIN_VERSION}_${AUTOBUILD_ARCH}_${QT_VERSION}_v${BUILD_VERSION}.zip build_${BUILD_TARGERT}/install
fi
expect ${SOURCE_DIR}/ci/scp.exp frs.sourceforge.net kl222,rabbitgis ${PASSWORD} RabbitGIS_${BUILD_TARGERT}${TOOLCHAIN_VERSION}_${AUTOBUILD_ARCH}_${QT_VERSION}_v${BUILD_VERSION}.zip pfs/.
#expect ${SOURCE_DIR}/ci/scp.exp frs.sourceforge.net kl222,rabbitgis ${PASSWORD} RabbitGIS_${BUILD_TARGERT}${TOOLCHAIN_VERSION}_${AUTOBUILD_ARCH}_${QT_VERSION}_v${BUILD_VERSION}.zip pfs/.

0 comments on commit ff54af7

Please sign in to comment.