mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-27 14:25:34 +00:00
Initial refactoring to support cpack-based packaging and OBS builds.
This commit is contained in:
+38
-43
@@ -6,63 +6,58 @@
|
||||
|
||||
|
||||
# Generate files
|
||||
|
||||
# Variables for .in files
|
||||
set(WINDOWS_SUFFIX "win32")
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(WINDOWS_SUFFIX "win64")
|
||||
endif()
|
||||
|
||||
configure_file("nsis/distribution.in.txt" "nsis/distribution.txt" ESCAPE_QUOTES @ONLY)
|
||||
configure_file("nsis/gsmartcontrol.in.nsi" "nsis/gsmartcontrol.nsi" ESCAPE_QUOTES @ONLY)
|
||||
|
||||
configure_file("gsmartcontrol.appdata.in.xml" "gsmartcontrol.appdata.xml" ESCAPE_QUOTES @ONLY)
|
||||
configure_file("gsmartcontrol.in.desktop" "gsmartcontrol.desktop" ESCAPE_QUOTES @ONLY)
|
||||
configure_file("gsmartcontrol-root.in.sh" "gsmartcontrol-root.sh" ESCAPE_QUOTES @ONLY)
|
||||
configure_file("org.gsmartcontrol.in.policy" "gsmartcontrol.policy" ESCAPE_QUOTES @ONLY)
|
||||
|
||||
configure_file("debian-postinst.in.sh" "${CMAKE_CURRENT_BINARY_DIR}/postinst" ESCAPE_QUOTES @ONLY)
|
||||
configure_file("debian-postrm.in.sh" "${CMAKE_CURRENT_BINARY_DIR}/postrm" ESCAPE_QUOTES @ONLY)
|
||||
|
||||
configure_file("rpm-post-install.in.sh" "${CMAKE_CURRENT_BINARY_DIR}/rpm-post-install.sh" ESCAPE_QUOTES @ONLY)
|
||||
configure_file("rpm-post-uninstall.in.sh" "${CMAKE_CURRENT_BINARY_DIR}/rpm-post-uninstall.sh" ESCAPE_QUOTES @ONLY)
|
||||
|
||||
# Install app icons
|
||||
foreach(dir 16 22 24 32 48 64 128 256)
|
||||
install(FILES "${dir}/gsmartcontrol.png"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/${dir}x${dir}/apps/")
|
||||
endforeach()
|
||||
install(CODE "execute_process (COMMAND gtk-update-icon-cache-3.0 -t -f \"@CMAKE_INSTALL_DATADIR@/icons/hicolor\")")
|
||||
if (NOT WIN32)
|
||||
foreach(dir 16 22 24 32 48 64 128 256)
|
||||
install(FILES "${dir}/gsmartcontrol.png"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/${dir}x${dir}/apps/")
|
||||
endforeach()
|
||||
install(CODE "execute_process (COMMAND gtk-update-icon-cache-3.0 -t -f \"@CMAKE_INSTALL_DATADIR@/icons/hicolor\")")
|
||||
endif()
|
||||
|
||||
# Application pixmap (fallback icon for desktop files).
|
||||
# Same as 48/gsmartcontrol.png.
|
||||
# Also, xpm for debian menu, 32x32.
|
||||
install(FILES 48/gsmartcontrol.png gsmartcontrol.xpm
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps/")
|
||||
|
||||
# We don't install .ico (it's only for Windows)
|
||||
if (WIN32)
|
||||
# .ico file
|
||||
install(FILES gsmartcontrol.ico DESTINATION .)
|
||||
endif()
|
||||
|
||||
# Install internal icons
|
||||
install(FILES icon_cddvd.png icon_hdd.png
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/gsmartcontrol/icons")
|
||||
if (WIN32)
|
||||
install(FILES icon_cddvd.png icon_hdd.png
|
||||
DESTINATION .)
|
||||
else()
|
||||
install(FILES icon_cddvd.png icon_hdd.png
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/gsmartcontrol/icons")
|
||||
endif()
|
||||
|
||||
# Desktop file
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol.desktop"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/gsmartcontrol/icons/")
|
||||
if (NOT WIN32)
|
||||
# Application pixmap (fallback icon for desktop files).
|
||||
# Same as 48/gsmartcontrol.png.
|
||||
# Also, xpm for debian menu, 32x32.
|
||||
install(FILES 48/gsmartcontrol.png gsmartcontrol.xpm
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps/")
|
||||
|
||||
# Appdata file
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol.appdata.xml"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/metainfo/")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol.desktop"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/gsmartcontrol/icons/")
|
||||
|
||||
# PolKit file
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.gsmartcontrol.policy"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/polkit-1/actions/")
|
||||
# Appdata file
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol.appdata.xml"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/metainfo/")
|
||||
|
||||
# Man pages
|
||||
install(FILES "gsmartcontrol.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1/")
|
||||
install(FILES "gsmartcontrol.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1/" RENAME "gsmartcontrol-root.1")
|
||||
# PolKit file
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.gsmartcontrol.policy"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/polkit-1/actions/")
|
||||
|
||||
# Scripts (this goes to bin, not sbin, as it doesn't require root privileges before running)
|
||||
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol-root.sh" TYPE BIN RENAME "gsmartcontrol-root")
|
||||
# Man pages
|
||||
install(FILES "gsmartcontrol.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1/")
|
||||
install(FILES "gsmartcontrol.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1/" RENAME "gsmartcontrol-root.1")
|
||||
|
||||
# Scripts (this goes to bin, not sbin, as it doesn't require root privileges before running)
|
||||
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol-root.sh" TYPE BIN RENAME "gsmartcontrol-root")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
###############################################################################
|
||||
# License: BSD Zero Clause License file
|
||||
# Copyright:
|
||||
# (C) 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
###############################################################################
|
||||
|
||||
# CPack options for this project
|
||||
|
||||
# Generators supported:
|
||||
# Linux: TBZ2 RPM DEB (possibly other archive-based ones as well)
|
||||
# Windows: NSIS ZIP.
|
||||
|
||||
# Per-generator settings
|
||||
#set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/data/cmake/cpack_project_config.cmake")
|
||||
|
||||
if (UNIX)
|
||||
# Make the "package" target build .tar.bz2
|
||||
set(CPACK_GENERATOR "TBZ2")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
# Make the "package" target build all supported packages (nsis and zip)
|
||||
set(CPACK_GENERATOR "")
|
||||
endif()
|
||||
|
||||
#set(APP_PACKAGE_NAME_DISPLAY "${APP_BRANDING_APP_DISPLAY_NAME}")
|
||||
#if (WIN32 AND APP_TARGET_64BIT)
|
||||
# set(APP_PACKAGE_NAME_DISPLAY "${APP_PACKAGE_NAME_DISPLAY} (64-Bit)")
|
||||
#endif()
|
||||
|
||||
#set(CPACK_PACKAGE_NAME "${APP_BRANDING_INTERNAL_APP_NAME}")
|
||||
#if (WIN32)
|
||||
# We set it to display name so that we get a different name for 32-bit version.
|
||||
# Default value is "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}".
|
||||
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "${APP_PACKAGE_NAME_DISPLAY}") # appended to e.g. CPACK_NSIS_INSTALL_ROOT
|
||||
# set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
||||
#endif()
|
||||
|
||||
#set(CPACK_PACKAGE_VENDOR "${APP_BRANDING_COPYRIGHT_NAME}")
|
||||
|
||||
#set(CPACK_PACKAGE_VERSION_MAJOR ${APP_VERSION_MAJOR})
|
||||
#set(CPACK_PACKAGE_VERSION_MINOR ${APP_VERSION_MINOR})
|
||||
#set(CPACK_PACKAGE_VERSION_PATCH ${APP_VERSION_PATCHLEVEL})
|
||||
|
||||
# Used by wix only?
|
||||
#set(APP_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/data/${APP_BRANDING_INTERNAL_APP_NAME}/package_description.txt")
|
||||
#if (EXISTS "${APP_PACKAGE_DESCRIPTION_FILE}")
|
||||
# set(CPACK_PACKAGE_DESCRIPTION_FILE "${APP_PACKAGE_DESCRIPTION_FILE}")
|
||||
#endif()
|
||||
|
||||
#set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${APP_BRANDING_DESCRIPTION}")
|
||||
|
||||
#set(CPACK_SYSTEM_NAME "${APP_TARGET_SYSTEM_NAME}")
|
||||
|
||||
|
||||
#if (WIN32)
|
||||
# Don't use CPACK_PACKAGE_NAME
|
||||
# set(CPACK_PACKAGE_FILE_NAME "${APP_BRANDING_INTERNAL_APP_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CPACK_SYSTEM_NAME}")
|
||||
#endif()
|
||||
|
||||
#set(APP_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/data/brandings/${APP_BRANDING_INTERNAL_APP_NAME}/eula.rtf")
|
||||
#if (EXISTS "${APP_RESOURCE_FILE_LICENSE}")
|
||||
# set(CPACK_RESOURCE_FILE_LICENSE "${APP_RESOURCE_FILE_LICENSE}")
|
||||
#endif()
|
||||
#set(CPACK_STRIP_FILES 0)
|
||||
#set(CPACK_SOURCE_STRIP_FILES 0)
|
||||
|
||||
# Icon in Add/Remove Programs
|
||||
#if (EXISTS "${CMAKE_SOURCE_DIR}/data/brandings/${APP_BRANDING_INTERNAL_APP_NAME}/app_icon.ico")
|
||||
# set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\data\\\\brandings\\\\${APP_BRANDING_INTERNAL_APP_NAME}\\\\app_icon.ico")
|
||||
#endif()
|
||||
|
||||
# Start menu shortcut
|
||||
#set(CPACK_PACKAGE_EXECUTABLES "${APP_BRANDING_INTERNAL_APP_NAME};${APP_PACKAGE_NAME_DISPLAY}")
|
||||
|
||||
# Force monolithic installers (ignore per-component stuff).
|
||||
# We don't want this because we want to avoid packing system_dlls component
|
||||
# in NSIS-based installer.
|
||||
# set(CPACK_MONOLITHIC_INSTALL true)
|
||||
|
||||
#SET(CPACK_SOURCE_IGNORE_FILES
|
||||
# "0*" # build dirs
|
||||
# ".*/\\\\.git/.*" # svn caches
|
||||
# ".*~$" # editor temporary files
|
||||
#)
|
||||
|
||||
|
||||
|
||||
# --- NSIS options
|
||||
|
||||
#set(CPACK_NSIS_DISPLAY_NAME "${APP_PACKAGE_NAME_DISPLAY}") # used in add/remove programs as a display text
|
||||
#set(CPACK_NSIS_PACKAGE_NAME "${APP_PACKAGE_NAME_DISPLAY}") # used in installer window title, start menu folder
|
||||
#if(APP_TARGET_64BIT)
|
||||
# set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
|
||||
#else()
|
||||
# set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
||||
#endif()
|
||||
#
|
||||
#set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}\\\\data\\\\package_data\\\\nsis_install.ico")
|
||||
#set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}\\\\data\\\\package_data\\\\nsis_uninstall.ico")
|
||||
#
|
||||
#set(CPACK_NSIS_HELP_LINK "mailto:${APP_BRANDING_CONTACT_EMAIL}")
|
||||
#set(CPACK_NSIS_URL_INFO_ABOUT "${APP_BRANDING_INFO_URL}")
|
||||
#set(CPACK_NSIS_CONTACT "${APP_BRANDING_CONTACT_EMAIL}")
|
||||
#set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
||||
#set(CPACK_NSIS_INSTALLED_ICON_NAME "${APP_BRANDING_INTERNAL_APP_NAME}.exe")
|
||||
#set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") # Relative to installation directory, start menu uses this.
|
||||
#set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") # Ask to uninstall before installing.
|
||||
## set(CPACK_NSIS_MUI_FINISHPAGE_RUN "${APP_BRANDING_INTERNAL_APP_NAME}.exe") # may conflict with UAC, better not use it.
|
||||
#set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
|
||||
# Delete \\\"$INSTDIR\\\\log.txt\\\"
|
||||
# Delete \\\"$INSTDIR\\\\log.old.txt\\\"
|
||||
# Delete \\\"$INSTDIR\\\\stderr.txt\\\"
|
||||
# Delete \\\"$INSTDIR\\\\stderr.old.txt\\\"
|
||||
# Delete \\\"$INSTDIR\\\\stdout.txt\\\"
|
||||
# Delete \\\"$INSTDIR\\\\stdout.old.txt\\\"
|
||||
#")
|
||||
|
||||
#set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") # so that the Start Menu shortcut is not to "bin/"
|
||||
#set(CPACK_NSIS_MENU_LINKS "${APP_BRANDING_INTERNAL_APP_NAME}" "${APP_PACKAGE_NAME_DISPLAY}")
|
||||
|
||||
|
||||
|
||||
# --- RPM options
|
||||
# FIXME All directories are left empty and not removed after rpm uninstall.
|
||||
#if (APP_TARGET_64BIT)
|
||||
# set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
|
||||
#else()
|
||||
# set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
|
||||
#endif()
|
||||
#set(CPACK_RPM_PACKAGE_LICENSE "GPL-3")
|
||||
#set(CPACK_RPM_PACKAGE_GROUP "Hardware/Other") # not sure
|
||||
#set(CPACK_RPM_PACKAGE_VENDOR "${APP_BRANDING_COPYRIGHT_NAME}")
|
||||
#set(CPACK_RPM_PACKAGE_URL "${APP_BRANDING_INFO_URL}")
|
||||
#set(CPACK_RPM_COMPRESSION_TYPE "bzip2")
|
||||
## set(CPACK_RPM_PACKAGE_REQUIRES "") # FIXME We could add libqt5 here, but it will prevent the usage of bundled Qt.
|
||||
## set(CPACK_RPM_PACKAGE_PROVIDES "${APP_BRANDING_INTERNAL_APP_NAME}")
|
||||
## set(CPACK_RPM_PACKAGE_RELOCATABLE ON)
|
||||
#
|
||||
#configure_file("${CMAKE_SOURCE_DIR}/data/package_data/rpm-post-install.in.sh" "${CMAKE_BINARY_DIR}/rpm-post-install.sh" ESCAPE_QUOTES @ONLY)
|
||||
#configure_file("${CMAKE_SOURCE_DIR}/data/package_data/rpm-post-uninstall.in.sh" "${CMAKE_BINARY_DIR}/rpm-post-uninstall
|
||||
#.sh" ESCAPE_QUOTES @ONLY)
|
||||
#
|
||||
#set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/data/rpm-post-install.sh")
|
||||
#set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/data/rpm-post-uninstall.sh")
|
||||
|
||||
|
||||
|
||||
# --- DEB options
|
||||
#if (APP_TARGET_64BIT)
|
||||
# set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
|
||||
#else()
|
||||
# set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
|
||||
#endif()
|
||||
#set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${APP_BRANDING_COPYRIGHT_NAME}")
|
||||
#set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${APP_BRANDING_INFO_URL}")
|
||||
#set(CPACK_DEBIAN_PACKAGE_SECTION "science")
|
||||
## set(CPACK_DEBIAN_PACKAGE_DEPENDS "") # FIXME We could add libqt5 here, but it will prevent the usage of bundled Qt.
|
||||
## set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
|
||||
#
|
||||
#configure_file("${CMAKE_SOURCE_DIR}/data/package_data/debian-postinst.in.sh"
|
||||
# "${CMAKE_BINARY_DIR}/postinst" ESCAPE_QUOTES @ONLY)
|
||||
#configure_file("${CMAKE_SOURCE_DIR}/data/package_data/debian-postrm.in.sh"
|
||||
# "${CMAKE_BINARY_DIR}/postrm" ESCAPE_QUOTES @ONLY)
|
||||
#
|
||||
#set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/data/postinst;${CMAKE_BINARY_DIR}/data/postrm")
|
||||
|
||||
|
||||
# All CPack variables must be set before this
|
||||
include(CPack)
|
||||
|
||||
|
||||
if (WIN32)
|
||||
add_custom_target(package_nsis
|
||||
COMMAND "${CMAKE_CPACK_COMMAND}" -G NSIS -C Release
|
||||
COMMENT "Creating NSIS installer..."
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
set_target_properties(package_nsis PROPERTIES
|
||||
EXCLUDE_FROM_ALL true
|
||||
EXCLUDE_FROM_DEFAULT_BUILD true
|
||||
PROJECT_LABEL "PACKAGE_NSIS_INSTALLER") # VS likes uppercase names for better visibility of special targets
|
||||
|
||||
add_custom_target(package_zip
|
||||
COMMAND "${CMAKE_CPACK_COMMAND}" -G ZIP -C Release
|
||||
COMMENT "Creating ZIP package..."
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
set_target_properties(package_zip PROPERTIES
|
||||
EXCLUDE_FROM_ALL true
|
||||
EXCLUDE_FROM_DEFAULT_BUILD true
|
||||
PROJECT_LABEL "PACKAGE_ZIP") # VS likes uppercase names for better visibility of special targets
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
add_custom_target(package_tbz2
|
||||
COMMAND "${CMAKE_CPACK_COMMAND}" -G TBZ2 -C Release
|
||||
COMMENT "Creating .tar.bz2 package..."
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
set_target_properties(package_tbz2 PROPERTIES
|
||||
EXCLUDE_FROM_ALL true
|
||||
EXCLUDE_FROM_DEFAULT_BUILD true)
|
||||
|
||||
add_custom_target(package_rpm
|
||||
COMMAND "${CMAKE_CPACK_COMMAND}" -G RPM -C Release
|
||||
COMMENT "Creating RPM package..."
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
set_target_properties(package_rpm PROPERTIES
|
||||
EXCLUDE_FROM_ALL true
|
||||
EXCLUDE_FROM_DEFAULT_BUILD true)
|
||||
|
||||
add_custom_target(package_deb
|
||||
COMMAND "${CMAKE_CPACK_COMMAND}" -G DEB -C Release
|
||||
COMMENT "Creating DEB package..."
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
set_target_properties(package_deb PROPERTIES
|
||||
EXCLUDE_FROM_ALL true
|
||||
EXCLUDE_FROM_DEFAULT_BUILD true)
|
||||
|
||||
add_custom_target(package_all
|
||||
DEPENDS package_tbz2 package_rpm
|
||||
COMMENT "Creating packages...")
|
||||
set_target_properties(package_all PROPERTIES
|
||||
EXCLUDE_FROM_ALL true
|
||||
EXCLUDE_FROM_DEFAULT_BUILD true)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
###############################################################################
|
||||
# License: BSD Zero Clause License file
|
||||
# Copyright:
|
||||
# (C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
###############################################################################
|
||||
|
||||
gtk-update-icon-cache-3.0 -f -t "@CMAKE_INSTALL_DATADIR@/icons/hicolor"
|
||||
@@ -1,7 +0,0 @@
|
||||
###############################################################################
|
||||
# License: BSD Zero Clause License file
|
||||
# Copyright:
|
||||
# (C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
###############################################################################
|
||||
|
||||
gtk-update-icon-cache-3.0 -f -t "@CMAKE_INSTALL_DATADIR@/icons/hicolor"
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
GSmartControl - Hard disk drive and SSD health inspection tool
|
||||
Version @CMAKE_PROJECT_VERSION@
|
||||
|
||||
The latest version of this distribution, as well as the source code of
|
||||
GSmartControl, can be found at
|
||||
https://gsmartcontrol.shaduri.dev
|
||||
and
|
||||
https://sourceforge.net/projects/gsmartcontrol/files/
|
||||
|
||||
|
||||
This distribution includes:
|
||||
|
||||
* GSmartControl binary (gsmartcontrol.exe) and associated resources.
|
||||
The binary was compiled against Gtkmm (http://www.gtkmm.org/), GTK+
|
||||
(http://gtk.org/) and related libraries, and PCRE (http://www.pcre.org/).
|
||||
|
||||
* Smartctl binaries (from smartmontools 6.6, http://smartmontools.sf.net/)
|
||||
- smartctl-nc.exe (compiled without console output), smartctl.exe (compiled
|
||||
with console output), update-smart-drivedb.exe (drive database updater).
|
||||
|
||||
|
||||
The combined distribution is licensed under GNU GPL version 3.
|
||||
See LICENSE.txt for details.
|
||||
@@ -1,325 +0,0 @@
|
||||
; License: BSD Zero Clause License file
|
||||
; Copyright:
|
||||
; (C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
|
||||
; NSIS2 Script
|
||||
; Compatible with NSIS Unicode 2.45.
|
||||
|
||||
!define PRODUCT_VERSION "@CMAKE_PROJECT_VERSION@"
|
||||
!define PRODUCT_NAME "GSmartControl"
|
||||
!define PRODUCT_NAME_SMALL "gsmartcontrol"
|
||||
!define PRODUCT_PUBLISHER "Alexander Shaduri"
|
||||
!define PRODUCT_WEB_SITE "https://gsmartcontrol.shaduri.dev"
|
||||
|
||||
;!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\AppMainExe.exe"
|
||||
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
||||
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
|
||||
|
||||
|
||||
!include "FileFunc.nsh" ; GetOptions
|
||||
|
||||
|
||||
|
||||
; --------------- General Settings
|
||||
|
||||
|
||||
; This is needed for proper start menu item manipulation (for all users) in vista
|
||||
RequestExecutionLevel admin
|
||||
|
||||
; This compressor gives us the best results
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
; Do a CRC check before installing
|
||||
CRCCheck On
|
||||
|
||||
; This is used in titles
|
||||
Name "${PRODUCT_NAME}" ; ${PRODUCT_VERSION}
|
||||
|
||||
; Output File Name
|
||||
OutFile "${PRODUCT_NAME_SMALL}-${PRODUCT_VERSION}-@WINDOWS_SUFFIX@.exe"
|
||||
|
||||
|
||||
; The Default Installation Directory:
|
||||
; Try to install to the same directory as runtime.
|
||||
InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
|
||||
; If already installed, try here
|
||||
InstallDirRegKey HKLM "SOFTWARE\${PRODUCT_NAME}" "InstallationDirectory"
|
||||
|
||||
|
||||
ShowInstDetails show
|
||||
ShowUnInstDetails show
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; --------------------- MUI INTERFACE
|
||||
|
||||
; MUI 2.0 compatible install
|
||||
!include "MUI2.nsh"
|
||||
!include "InstallOptions.nsh" ; section description macros
|
||||
|
||||
; Backgound Colors. uncomment to enable fullscreen.
|
||||
; BGGradient 0000FF 000000 FFFFFF
|
||||
|
||||
; MUI Settings
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_ICON "nsi_install.ico"
|
||||
!define MUI_UNICON "nsi_uninstall.ico"
|
||||
|
||||
|
||||
; Things that need to be extracted on first (keep these lines before any File command!).
|
||||
; Only useful for BZIP2 compression.
|
||||
;!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||
;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
||||
|
||||
|
||||
; 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"
|
||||
|
||||
!define LICENSE_FILE "doc\distribution.txt"
|
||||
|
||||
; Pages to show during installation
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "${LICENSE_FILE}"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
;!define MUI_FINISHPAGE_RUN "$INSTDIR\gsmartcontrol.exe"
|
||||
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Example.file"
|
||||
;!define MUI_FINISHPAGE_RUN_NOTCHECKED
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
|
||||
|
||||
; Uninstaller page
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
|
||||
|
||||
; Language files
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
|
||||
; --------------- END MUI
|
||||
|
||||
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "GSmartControl"
|
||||
|
||||
|
||||
var install_option_removeold ; uninstall the old version first (if present): yes (default), no.
|
||||
|
||||
|
||||
|
||||
; ----------------- INSTALLATION TYPES
|
||||
|
||||
; InstType "Recommended"
|
||||
; InstType "Full"
|
||||
; InstType "Minimal"
|
||||
|
||||
|
||||
|
||||
|
||||
Section "!GSmartControl" SecMain
|
||||
SectionIn 1 RO
|
||||
SetShellVarContext all ; use all user variables as opposed to current user
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
SetOverwrite Off ; don't overwrite the config file
|
||||
; File "gsmartcontrol2.conf"
|
||||
|
||||
SetOverwrite On
|
||||
File *.exe
|
||||
File *.dll
|
||||
File gsmartcontrol.exe.manifest
|
||||
File gsmartcontrol.ico
|
||||
File icon_*.png
|
||||
File drivedb.h
|
||||
|
||||
; Include the "doc" directory completely.
|
||||
File /r doc
|
||||
|
||||
; Include the "ui" directory completely.
|
||||
File /r ui
|
||||
|
||||
; GTK and stuff
|
||||
File /r etc
|
||||
File /r share
|
||||
|
||||
; Add Shortcuts (this inherits the exe's run permissions)
|
||||
CreateShortCut "$SMPROGRAMS\GSmartControl.lnk" "$INSTDIR\gsmartcontrol.exe" "" \
|
||||
"$INSTDIR\gsmartcontrol.ico" "" SW_SHOWNORMAL "" "GSmartControl - Hard disk drive and SSD health inspection tool"
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
|
||||
; Executed on installation start
|
||||
Function .onInit
|
||||
SetShellVarContext all ; use all user variables as opposed to current user
|
||||
|
||||
${GetOptions} "$CMDLINE" "/removeold=" $install_option_removeold
|
||||
|
||||
Call PreventMultipleInstances
|
||||
|
||||
Call DetectPrevInstallation
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
; ------------------ POST INSTALL
|
||||
|
||||
|
||||
Section -post
|
||||
SetShellVarContext all ; use all user variables as opposed to current user
|
||||
|
||||
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "InstallationDirectory" "$INSTDIR"
|
||||
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "Vendor" "${PRODUCT_PUBLISHER}"
|
||||
|
||||
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\gsmartcontrol_uninst.exe"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\gsmartcontrol.ico"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
||||
WriteRegDWORD HKLM "${PRODUCT_UNINST_KEY}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "${PRODUCT_UNINST_KEY}" "NoRepair" 1
|
||||
|
||||
; We don't need this, MUI takes care for us
|
||||
; WriteRegStr HKCU "Software\${PRODUCT_NAME}" "Installer Language" $sUAGE
|
||||
|
||||
; write out uninstaller
|
||||
WriteUninstaller "$INSTDIR\gsmartcontrol_uninst.exe"
|
||||
|
||||
; uninstall shortcut
|
||||
;CreateDirectory "$SMPROGRAMS\GSmartControl"
|
||||
;CreateShortCut "$SMPROGRAMS\GSmartControl\Uninstall GSmartControl.lnk" "$INSTDIR\gsmartcontrol_uninst.exe" "" ""
|
||||
|
||||
SectionEnd ; post
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------- UNINSTALL
|
||||
|
||||
|
||||
|
||||
Function un.onUninstSuccess
|
||||
HideWindow
|
||||
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
|
||||
Section Uninstall
|
||||
SetShellVarContext all ; use all user variables as opposed to current user
|
||||
SetAutoClose false
|
||||
|
||||
; add delete commands to delete whatever files/registry keys/etc you installed here.
|
||||
Delete "$INSTDIR\gsmartcontrol_uninst.exe"
|
||||
|
||||
DeleteRegKey HKLM "SOFTWARE\${PRODUCT_NAME}"
|
||||
DeleteRegKey HKLM "${PRODUCT_UNINST_KEY}"
|
||||
|
||||
Delete "$INSTDIR\*.exe"
|
||||
Delete "$INSTDIR\*.dll"
|
||||
Delete "$INSTDIR\gsmartcontrol.exe.manifest"
|
||||
Delete "$INSTDIR\gsmartcontrol.ico"
|
||||
Delete "$INSTDIR\icon_*.png"
|
||||
|
||||
; update-smart-drivedb may leave these
|
||||
Delete "$INSTDIR\drivedb.h"
|
||||
Delete "$INSTDIR\drivedb.h.*"
|
||||
|
||||
RMDir /r "$INSTDIR\doc"
|
||||
|
||||
RMDir /r "$INSTDIR\ui"
|
||||
|
||||
; GTK and stuff
|
||||
RMDir /r "$INSTDIR\etc"
|
||||
RMDir /r "$INSTDIR\share"
|
||||
|
||||
; clean up generated stuff
|
||||
Delete "$INSTDIR\*stdout.txt"
|
||||
Delete "$INSTDIR\*stderr.txt"
|
||||
|
||||
RMDir "$INSTDIR" ; only if empty
|
||||
|
||||
Delete "$SMPROGRAMS\GSmartControl.lnk"
|
||||
;Delete "$SMPROGRAMS\GSmartControl\Uninstall GSmartControl.lnk"
|
||||
|
||||
SectionEnd ; end of uninstall section
|
||||
|
||||
|
||||
|
||||
; --------------- Helpers
|
||||
|
||||
; Detect previous installation
|
||||
Function DetectPrevInstallation
|
||||
; if /removeold=no option is given, don't check anything.
|
||||
StrCmp $install_option_removeold "no" old_detect_done
|
||||
|
||||
SetShellVarContext all ; use all user variables as opposed to current user
|
||||
push $R0
|
||||
|
||||
; detect previous installation
|
||||
ReadRegStr $R0 HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
|
||||
StrCmp $R0 "" old_detect_done
|
||||
|
||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
|
||||
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
|
||||
previous version or `Cancel` to continue anyway." \
|
||||
/SD IDOK IDOK old_uninst
|
||||
; Abort
|
||||
goto old_detect_done
|
||||
|
||||
; Run the old uninstaller
|
||||
old_uninst:
|
||||
ClearErrors
|
||||
IfSilent old_silent_uninst old_nosilent_uninst
|
||||
|
||||
old_nosilent_uninst:
|
||||
ExecWait '$R0'
|
||||
goto old_uninst_continue
|
||||
|
||||
old_silent_uninst:
|
||||
ExecWait '$R0 /S _?=$INSTDIR'
|
||||
|
||||
old_uninst_continue:
|
||||
|
||||
IfErrors old_no_remove_uninstaller
|
||||
|
||||
; You can either use Delete /REBOOTOK in the uninstaller or add some code
|
||||
; here to remove to remove the uninstaller. Use a registry key to check
|
||||
; whether the user has chosen to uninstall. If you are using an uninstaller
|
||||
; components page, make sure all sections are uninstalled.
|
||||
old_no_remove_uninstaller:
|
||||
|
||||
old_detect_done: ; old installation not found, all ok
|
||||
|
||||
pop $R0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
; Prevent running multiple instances of the installer
|
||||
Function PreventMultipleInstances
|
||||
Push $R0
|
||||
System::Call 'kernel32::CreateMutexA(i 0, i 0, t ${PRODUCT_NAME}) ?e'
|
||||
Pop $R0
|
||||
StrCmp $R0 0 +3
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." /SD IDOK
|
||||
Abort
|
||||
Pop $R0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
; eof
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 766 B |
Binary file not shown.
|
Before Width: | Height: | Size: 766 B |
@@ -1,9 +0,0 @@
|
||||
###############################################################################
|
||||
# License: BSD Zero Clause License file
|
||||
# Copyright:
|
||||
# (C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
###############################################################################
|
||||
|
||||
# Note: %{_prefix} doesn't work here (always defaults to /usr)
|
||||
|
||||
gtk-update-icon-cache-3.0 -f -t "@CMAKE_INSTALL_DATADIR@/icons/hicolor"
|
||||
@@ -1,7 +0,0 @@
|
||||
###############################################################################
|
||||
# License: BSD Zero Clause License file
|
||||
# Copyright:
|
||||
# (C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
###############################################################################
|
||||
|
||||
gtk-update-icon-cache-3.0 -f -t "@CMAKE_INSTALL_DATADIR@/icons/hicolor"
|
||||
Reference in New Issue
Block a user