From fed79c7de02fab9461807342ca0ee136155f86f8 Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Fri, 26 Feb 2021 14:01:09 +0400 Subject: [PATCH] Updated .in files to use cmake variables. --- data/CMakeLists.txt | 10 +++++++++- data/gsmartcontrol-root.in.sh | 6 +++--- data/gsmartcontrol.in.desktop | 2 +- data/nsis/distribution.in.txt | 6 +++--- data/nsis/gsmartcontrol.in.nsi | 4 ++-- ...trol.policy => org.gsmartcontrol.in.policy} | 2 +- debian.dist/changelog.in | 4 ++-- dependencies/CMakeLists.txt | 3 +++ gsmartcontrol.in.spec | 2 +- po/Makefile.in.in | 4 ++-- src/CMakeLists.txt | 18 +++++------------- src/gsc_winres.in.rc | 6 +++--- 12 files changed, 35 insertions(+), 32 deletions(-) rename data/{org.gsmartcontrol.policy => org.gsmartcontrol.in.policy} (85%) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 2320e73..74c4c52 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,11 +1,19 @@ # 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_BINARY_DIR}/postinst" ESCAPE_QUOTES @ONLY) configure_file("debian-postrm.in.sh" "${CMAKE_BINARY_DIR}/postrm" ESCAPE_QUOTES @ONLY) @@ -41,7 +49,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATADIR}/metainfo/") # PolKit file -install(FILES "org.gsmartcontrol.policy" +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.gsmartcontrol.policy" DESTINATION "${CMAKE_INSTALL_DATADIR}/polkit-1/actions/") # Man pages diff --git a/data/gsmartcontrol-root.in.sh b/data/gsmartcontrol-root.in.sh index c5448fc..3ebdee1 100644 --- a/data/gsmartcontrol-root.in.sh +++ b/data/gsmartcontrol-root.in.sh @@ -8,7 +8,7 @@ # Run gsmartcontrol with root, asking for root password first. # export GSMARTCONTROL_SU to override a su command (e.g. "kdesu -c"). -EXEC_BIN="@prefix@/sbin/gsmartcontrol"; +EXEC_BIN="@CMAKE_INSTALL_SBINDIR@/gsmartcontrol"; prog_name="gsmartcontrol" @@ -115,10 +115,10 @@ fi # Add these directories _before_ existing PATH, so that the user is not # tricked into running it from some other path (we're running as root with # the user's env after all). -# Add @prefix@/sbin as well (freebsd seems to require it). +# Add sbindir as well (freebsd seems to require it). # Note that beesu won't show a GUI login box if /usr/sbin is before /usr/bin, # so add it first as well. -EXTRA_PATHS="/usr/bin:/usr/sbin:/usr/local/sbin:@prefix@/sbin"; +EXTRA_PATHS="/usr/bin:/usr/sbin:/usr/local/sbin:@CMAKE_INSTALL_SBINDIR@"; export PATH="$EXTRA_PATHS:$PATH" diff --git a/data/gsmartcontrol.in.desktop b/data/gsmartcontrol.in.desktop index 0e13f51..32488b3 100644 --- a/data/gsmartcontrol.in.desktop +++ b/data/gsmartcontrol.in.desktop @@ -26,4 +26,4 @@ Icon=gsmartcontrol #X-KDE-RootOnly=true # Run with root permissions. -Exec="@prefix@/bin/gsmartcontrol-root" +Exec="@CMAKE_INSTALL_BINDIR@/bin/gsmartcontrol-root" diff --git a/data/nsis/distribution.in.txt b/data/nsis/distribution.in.txt index f50f149..89fb878 100644 --- a/data/nsis/distribution.in.txt +++ b/data/nsis/distribution.in.txt @@ -1,10 +1,10 @@ GSmartControl - Hard disk drive and SSD health inspection tool -Version @VERSION@ +Version @CMAKE_PROJECT_VERSION@ The latest version of this distribution, as well as the source code of GSmartControl, can be found at -https://gsmartcontrol.sourceforge.io +https://gsmartcontrol.shaduri.dev and https://sourceforge.net/projects/gsmartcontrol/files/ @@ -21,4 +21,4 @@ with console output), update-smart-drivedb.exe (drive database updater). The combined distribution is licensed under GNU GPL version 3. -See LICENSE_gpl3.txt for details. +See LICENSE.txt for details. diff --git a/data/nsis/gsmartcontrol.in.nsi b/data/nsis/gsmartcontrol.in.nsi index 5ad760e..9ff421e 100644 --- a/data/nsis/gsmartcontrol.in.nsi +++ b/data/nsis/gsmartcontrol.in.nsi @@ -4,11 +4,11 @@ ; Compatible with NSIS Unicode 2.45. ; Public Domain -!define PRODUCT_VERSION "@VERSION@" +!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.sourceforge.io" +!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}" diff --git a/data/org.gsmartcontrol.policy b/data/org.gsmartcontrol.in.policy similarity index 85% rename from data/org.gsmartcontrol.policy rename to data/org.gsmartcontrol.in.policy index 3d8ae3f..5ee1a93 100644 --- a/data/org.gsmartcontrol.policy +++ b/data/org.gsmartcontrol.in.policy @@ -12,7 +12,7 @@ auth_admin auth_admin - /usr/sbin/gsmartcontrol + @CMAKE_INSTALL_SBINDIR@/gsmartcontrol true diff --git a/debian.dist/changelog.in b/debian.dist/changelog.in index 4997995..0fbb316 100644 --- a/debian.dist/changelog.in +++ b/debian.dist/changelog.in @@ -1,5 +1,5 @@ -gsmartcontrol (@VERSION@+nmu1) unstable; urgency=low +gsmartcontrol (@CMAKE_PROJECT_VERSION@+nmu1) unstable; urgency=low * Permanently Initial Release. - -- Alexander Shaduri Sat, 15 Nov 2008 00:12:04 +0400 + -- Alexander Shaduri Sat, 15 Nov 2008 00:12:04 +0400 diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 836084e..4e719ce 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -14,6 +14,9 @@ target_compile_definitions(app_gtkmm_interface INTERFACE ENABLE_GLIB=1 ENABLE_GLIBMM=1 + # For porting to GTK4 + GDK_DISABLE_DEPRECATED=1 + GTK_DISABLE_DEPRECATED=1 ) diff --git a/gsmartcontrol.in.spec b/gsmartcontrol.in.spec index b0506a7..d0febdc 100644 --- a/gsmartcontrol.in.spec +++ b/gsmartcontrol.in.spec @@ -3,7 +3,7 @@ # Supported distributions: openSUSE, Fedora, CentOS, RHEL. Name: gsmartcontrol -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Release: 0 License: GPL-3.0 Url: https://gsmartcontrol.sourceforge.io/ diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 65184f6..88bb65c 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -12,7 +12,7 @@ GETTEXT_MACRO_VERSION = 0.19 PACKAGE = @PACKAGE@ -VERSION = @VERSION@ +VERSION = @CMAKE_PROJECT_VERSION@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ SED = @SED@ @@ -192,7 +192,7 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --package-name="$${package_prefix}@PACKAGE@" \ - --package-version='@VERSION@' \ + --package-version='@CMAKE_PROJECT_VERSION@' \ --msgid-bugs-address="$$msgid_bugs_address" \ ;; \ esac diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0ef6dbd..9418d2a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,11 @@ # Manifest file if (WIN32) + set(WINDOWS_ARCH "x86") + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(WINDOWS_ARCH "amd64") + endif() + configure_file("gsmartcontrol.exe.in.manifest" "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol.exe.manifest" ESCAPE_QUOTES @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gsmartcontrol.exe.manifest" DESTINATION "${CMAKE_INSTALL_SBINDIR}/") endif() @@ -52,19 +57,6 @@ target_link_libraries(gsmartcontrol install(TARGETS gsmartcontrol DESTINATION "${CMAKE_INSTALL_SBINDIR}/") -# TODO -#target_compile_definitions(gsmartcontrol -# PRIVATE -# -DPACKAGE_PKGDATA_DIR=\"/usr/local/share/gsmartcontrol\" -# -DPACKAGE_SYSCONF_DIR=\"/usr/local/etc\" -# -DPACKAGE_LOCALE_DIR=\"/usr/local/share/locale/gsmartcontrol\" -# -DPACKAGE_DOC_DIR=\"/usr/share/doc/packages/gsmartcontrol\" -# -DTOP_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -# -DHZ_USE_LIBDEBUG=1 -# -DHZ_ENABLE_COMPILED_RES_DATA -# -DDEBUG_BUILD -#) - add_subdirectory(build_config) add_subdirectory(applib) diff --git a/src/gsc_winres.in.rc b/src/gsc_winres.in.rc index 7cacbcd..4ad6f8d 100644 --- a/src/gsc_winres.in.rc +++ b/src/gsc_winres.in.rc @@ -12,12 +12,12 @@ BEGIN BLOCK "04090025" BEGIN VALUE "FileDescription", "GSmartControl - Hard disk drive and SSD health inspection tool" - VALUE "FileVersion", "@VERSION@" + VALUE "FileVersion", "@CMAKE_PROJECT_VERSION@" VALUE "InternalName", "gsmartcontrol.exe" - VALUE "LegalCopyright", "Copyright (C) 2008 - 2018 Alexander Shaduri" + VALUE "LegalCopyright", "Copyright (C) 2008 - 2021 Alexander Shaduri" VALUE "OriginalFilename", "gsmartcontrol.exe" VALUE "ProductName", "GSmartControl" - VALUE "ProductVersion", "@VERSION@" + VALUE "ProductVersion", "@CMAKE_PROJECT_VERSION@" END END BLOCK "VarFileInfo"