diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2017-05-10 18:16:14 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2017-05-16 17:39:52 +0300 |
commit | 6c9e68548bdd62abdf182ed2485bb412656cadd3 (patch) | |
tree | 7f38951db44b7c807cef9d0886f4c553261df7e5 /win/misc | |
parent | 94be050aa6c35242f8daeb5caae40ff5677bd281 (diff) |
Switch to using MSYS2 for Windows build
Diffstat (limited to 'win/misc')
-rw-r--r-- | win/misc/create-launcher.py | 204 | ||||
-rw-r--r-- | win/misc/depcheck.py | 104 | ||||
-rw-r--r-- | win/misc/gajim-portable.nsi | 120 | ||||
-rw-r--r-- | win/misc/gajim.ico | bin | 0 -> 300318 bytes | |||
-rw-r--r-- | win/misc/gajim.nsi | 262 |
5 files changed, 690 insertions, 0 deletions
diff --git a/win/misc/create-launcher.py b/win/misc/create-launcher.py new file mode 100644 index 000000000..e625a5295 --- /dev/null +++ b/win/misc/create-launcher.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright 2016 Christoph Reiter +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +"""Creates simple Python .exe launchers for gui and cli apps + +./create-launcher.py "3.8.0" <target-dir> +""" + +import os +import sys +import subprocess +import shlex +import tempfile +import shutil +import struct +from distutils.spawn import find_executable + + +def build_resource(rc_path, out_path): + """Raises subprocess.CalledProcessError""" + + def is_64bit(): + return struct.calcsize("P") == 8 + + subprocess.check_call( + ["windres", "-O", "coff", "-F", + "pe-x86-64" if is_64bit() else "pe-i386", rc_path, + "-o", out_path]) + + +def get_build_args(): + python_name = os.path.splitext(os.path.basename(sys.executable))[0] + python_config = os.path.join( + os.path.dirname(sys.executable), python_name + "-config") + + cflags = subprocess.check_output( + ["sh", python_config, "--cflags"]).strip() + libs = subprocess.check_output( + ["sh", python_config, "--libs"]).strip() + + cflags = os.fsdecode(cflags) + libs = os.fsdecode(libs) + return shlex.split(cflags) + shlex.split(libs) + + +def build_exe(source_path, resource_path, is_gui, out_path): + args = ["gcc", "-s"] + if is_gui: + args.append("-mwindows") + args.extend(["-o", out_path, source_path, resource_path]) + args.extend(get_build_args()) + subprocess.check_call(args) + + +def get_launcher_code(entry_point): + template = """\ +#include "Python.h" +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <shellapi.h> + + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + int result; + LPWSTR *szArglist; + int nArgs; + int i; + + szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); + if( NULL == szArglist ) + { + printf("CommandLineToArgvW failed"); + return 0; + } + + Py_NoUserSiteDirectory = 1; + Py_IgnoreEnvironmentFlag = 1; + Py_DontWriteBytecodeFlag = 1; + Py_FrozenFlag = 1; + Py_Initialize(); + PySys_SetArgvEx(__argc, szArglist, 0); + FILE* file = fopen("../gajim/src/%(filename)s", "r"); + PyRun_SimpleString("import sys; import os;" + "os.chdir('../gajim/src');" + "sys.path.append(os.getcwd());" + "sys.frozen=True;" + ); + result = PyRun_SimpleFile(file, "../gajim/src/%(filename)s"); + Py_Finalize(); + return result; +} + """ + + return template % {"filename": entry_point} + + +def get_resouce_code(filename, file_version, file_desc, icon_path, + product_name, product_version, company_name): + + template = """\ +1 ICON "%(icon_path)s" +1 VERSIONINFO +FILEVERSION %(file_version_list)s +PRODUCTVERSION %(product_version_list)s +FILEOS 0x4 +FILETYPE 0x1 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "%(company_name)s" + VALUE "FileDescription", "%(file_desc)s" + VALUE "FileVersion", "%(file_version)s" + VALUE "InternalName", "%(internal_name)s" + VALUE "OriginalFilename", "%(filename)s" + VALUE "ProductName", "%(product_name)s" + VALUE "ProductVersion", "%(product_version)s" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END +""" + + def to_ver_list(v): + return ",".join(map(str, (list(map(int, v.split("."))) + [0] * 4)[:4])) + + file_version_list = to_ver_list(file_version) + product_version_list = to_ver_list(product_version) + + return template % { + "icon_path": icon_path, "file_version_list": file_version_list, + "product_version_list": product_version_list, + "file_version": file_version, "product_version": product_version, + "company_name": company_name, "filename": filename, + "internal_name": os.path.splitext(filename)[0], + "product_name": product_name, "file_desc": file_desc, + } + + +def build_launcher(out_path, icon_path, file_desc, product_name, product_version, + company_name, entry_point, is_gui): + + src_ico = os.path.abspath(icon_path) + target = os.path.abspath(out_path) + + file_version = product_version + + dir_ = os.getcwd() + temp = tempfile.mkdtemp() + try: + os.chdir(temp) + with open("launcher.c", "w") as h: + h.write(get_launcher_code(entry_point)) + shutil.copyfile(src_ico, "launcher.ico") + with open("launcher.rc", "w") as h: + h.write(get_resouce_code( + os.path.basename(target), file_version, file_desc, + "launcher.ico", product_name, product_version, company_name)) + + build_resource("launcher.rc", "launcher.res") + build_exe("launcher.c", "launcher.res", is_gui, target) + finally: + os.chdir(dir_) + shutil.rmtree(temp) + + +def main(): + argv = sys.argv + + version = argv[1] + target = argv[2] + + company_name = "Gajim" + misc = os.path.dirname(os.path.realpath(__file__)) + + build_launcher( + os.path.join(target, "Gajim.exe"), + os.path.join(misc, "gajim.ico"), "Gajim", "Gajim", + version, company_name, 'gajim.py', True) + + build_launcher( + os.path.join(target, "Gajim-Debug.exe"), + os.path.join(misc, "gajim.ico"), "Gajim", "Gajim", + version, company_name, 'gajim.py', False) + + build_launcher( + os.path.join(target, "history_manager.exe"), + os.path.join(misc, "gajim.ico"), "History Manager", "History Manager", + version, company_name, 'history_manager.py', True) + +if __name__ == "__main__": + main() diff --git a/win/misc/depcheck.py b/win/misc/depcheck.py new file mode 100644 index 000000000..01ad4d02a --- /dev/null +++ b/win/misc/depcheck.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 Christoph Reiter +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +""" +Deletes unneeded DLLs and checks DLL dependencies. +Execute with the build python, will figure out the rest. +""" + +import subprocess +import os +import sys + +import gi +gi.require_version("GIRepository", "2.0") +from gi.repository import GIRepository + + +def get_required_by_typelibs(): + deps = set() + repo = GIRepository.Repository() + for tl in os.listdir(repo.get_search_path()[0]): + namespace, version = os.path.splitext(tl)[0].split("-", 1) + repo.require(namespace, version, 0) + lib = repo.get_shared_library(namespace) + if lib: + deps.update(lib.split(",")) + return deps + + +EXTENSIONS = [".exe", ".pyd", ".dll"] +SYSTEM_LIBS = ['advapi32.dll', + "cabinet.dll", "comctl32.dll", "comdlg32.dll", "crypt32.dll", "d3d9.dll", + "dnsapi.dll", "dsound.dll", "dwmapi.dll", "gdi32.dll", "imm32.dll", + "iphlpapi.dll", "kernel32.dll", "ksuser.dll", "msi.dll", "msimg32.dll", + "msvcr71.dll", "msvcr80.dll", "msvcrt.dll", "ole32.dll", "oleaut32.dll", + "opengl32.dll", "rpcrt4.dll", "setupapi.dll", "shell32.dll", "user32.dll", + "usp10.dll", "winmm.dll", "winspool.drv", "wldap32.dll", "ws2_32.dll", + "wsock32.dll", "shlwapi.dll" +] + + +def get_dependencies(filename): + deps = [] + data = subprocess.check_output(["objdump", "-p", filename]) + data = data.decode("utf-8") + for line in data.splitlines(): + line = line.strip() + if line.startswith("DLL Name:"): + deps.append(line.split(":", 1)[-1].strip().lower()) + return deps + + +def find_lib(root, name): + search_path = os.path.join(root, "bin") + if os.path.exists(os.path.join(search_path, name)): + return os.path.join(search_path, name) + elif name in SYSTEM_LIBS: + return name + + +def get_things_to_delete(root): + all_libs = set() + needed = set() + for base, dirs, files in os.walk(root): + for f in files: + path = os.path.join(base, f) + if os.path.splitext(path)[-1].lower() in EXTENSIONS: + all_libs.add(f.lower()) + for lib in get_dependencies(path): + all_libs.add(lib) + needed.add(lib) + if not find_lib(root, lib): + print("MISSING:", path, lib) + + for lib in get_required_by_typelibs(): + needed.add(lib) + if not find_lib(root, lib): + print("MISSING:", path, lib) + + # get rid of things not in the search path, + # maybe loaded through other means? + not_needed = filter( + lambda l: find_lib(root, l) and \ + os.path.splitext(l)[-1].lower() != ".exe", all_libs - needed) + + return [find_lib(root, l) for l in not_needed] + + +def main(): + libs = get_things_to_delete(sys.prefix) + while libs: + for l in libs: + print("DELETE:", l) + os.unlink(l) + libs = get_things_to_delete(sys.prefix) + + +if __name__ == "__main__": + main() diff --git a/win/misc/gajim-portable.nsi b/win/misc/gajim-portable.nsi new file mode 100644 index 000000000..dda15b794 --- /dev/null +++ b/win/misc/gajim-portable.nsi @@ -0,0 +1,120 @@ +; File encoding 'UTF-8 with BOM' + +Unicode true +!include "MUI2.nsh" + +Name "Gajim" +OutFile "Gajim-Portable.exe" +SetCompressor /final /solid lzma +SetCompressorDictSize 32 + +!define myAppName "Gajim" + +InstallDir "$PROFILE\Gajim" +RequestExecutionLevel user + +!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP "mingw32\gajim\data\pixmaps\nsis_header.bmp" +!define MUI_WELCOMEFINISHPAGE_BITMAP "mingw32\gajim\data\pixmaps\nsis_wizard.bmp" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "mingw32\gajim\data\pixmaps\nsis_wizard.bmp" +!define MUI_COMPONENTSPAGE_SMALLDESC +!define MUI_ABORTWARNING + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "mingw32\gajim\COPYING" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +;Show all languages, despite user's codepage +!define MUI_LANGDLL_ALLLANGUAGES + +!insertmacro MUI_LANGUAGE "English" +!insertmacro MUI_LANGUAGE "French" +!insertmacro MUI_LANGUAGE "German" +!insertmacro MUI_LANGUAGE "Italian" +!insertmacro MUI_LANGUAGE "Russian" +!insertmacro MUI_LANGUAGE "Hebrew" +!insertmacro MUI_RESERVEFILE_LANGDLL + +; English +LangString NAME_Emoticons ${LANG_ENGLISH} "Emoticons" +LangString NAME_Iconsets ${LANG_ENGLISH} "Iconsets" +LangString NAME_Languages ${LANG_ENGLISH} "Languages" +LangString NAME_SecLanguagesOther ${LANG_ENGLISH} "Other" +LangString NAME_Themes ${LANG_ENGLISH} "Themes" +LangString DESC_SecGajim ${LANG_ENGLISH} "Installs the main Gajim files." + + +; French +LangString NAME_Emoticons ${LANG_FRENCH} "Emoticônes" +LangString NAME_Iconsets ${LANG_FRENCH} "Bibliothèque d'icônes" +LangString NAME_Languages ${LANG_FRENCH} "Langues" +LangString NAME_SecLanguagesOther ${LANG_FRENCH} "Autre" +LangString NAME_Themes ${LANG_FRENCH} "Thèmes" +LangString DESC_SecGajim ${LANG_FRENCH} "Installer les fichiers principaux de Gajim." + + +; German +LangString NAME_Emoticons ${LANG_GERMAN} "Emoticons" +LangString NAME_Iconsets ${LANG_GERMAN} "Symbolsets" +LangString NAME_Languages ${LANG_GERMAN} "Sprachen" +LangString NAME_SecLanguagesOther ${LANG_GERMAN} "Sonstige" +LangString NAME_Themes ${LANG_GERMAN} "Designs" +LangString DESC_SecGajim ${LANG_GERMAN} "Installiert die Hauptdateien von Gajim." + + +; Italian +LangString NAME_Emoticons ${LANG_ITALIAN} "Emoticons" +LangString NAME_Iconsets ${LANG_ITALIAN} "Set di icone" +LangString NAME_Languages ${LANG_ITALIAN} "Lingue" +LangString NAME_SecLanguagesOther ${LANG_ITALIAN} "Altre" +LangString NAME_Themes ${LANG_ITALIAN} "Temi" +LangString DESC_SecGajim ${LANG_ITALIAN} "Installa i file principali di Gajim." + + +; Russian +LangString NAME_Emoticons ${LANG_RUSSIAN} "Смайлики" +LangString NAME_Iconsets ${LANG_RUSSIAN} "Темы иконок" +LangString NAME_Languages ${LANG_RUSSIAN} "Языки" +LangString NAME_SecLanguagesOther ${LANG_RUSSIAN} "Другое" +LangString NAME_Themes ${LANG_RUSSIAN} "Темы" +LangString DESC_SecGajim ${LANG_RUSSIAN} "Установка основных файлов Gajim." + + +; Hebrew +LangString NAME_Emoticons ${LANG_HEBREW} "רגשונים" +LangString NAME_Iconsets ${LANG_HEBREW} "מערכי צלמית" +LangString NAME_Languages ${LANG_HEBREW} "שפות" +LangString NAME_SecLanguagesOther ${LANG_HEBREW} "אחרות" +LangString NAME_Themes ${LANG_HEBREW} "ערכאות נושא" +LangString DESC_SecGajim ${LANG_HEBREW} "מתקין קבצי Gajim עיקריים." + +Section "Gajim" SecGajim + SectionIn RO + + SetOutPath "$INSTDIR" + File /r "mingw32\*.*" + + SetOutPath "$INSTDIR\bin" + CreateShortCut "$INSTDIR\Gajim-Portable.lnk" "$INSTDIR\bin\Gajim.exe" \ + "-c ..\..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable" + CreateShortCut "$INSTDIR\Gajim-Portable-Debug.lnk" "$INSTDIR\bin\Gajim-Debug.exe" \ + "-c ..\..\UserData" "" "" SW_SHOWNORMAL "" "Gajim Portable Debug" + +SectionEnd + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SecGajim} $(DESC_SecGajim) +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +Function .onInit + !insertmacro MUI_LANGDLL_DISPLAY +FunctionEnd diff --git a/win/misc/gajim.ico b/win/misc/gajim.ico Binary files differnew file mode 100644 index 000000000..6f6159527 --- /dev/null +++ b/win/misc/gajim.ico diff --git a/win/misc/gajim.nsi b/win/misc/gajim.nsi new file mode 100644 index 000000000..0382e8cc5 --- /dev/null +++ b/win/misc/gajim.nsi @@ -0,0 +1,262 @@ +; File encoding 'UTF-8 with BOM' + +Unicode true +!include "MUI2.nsh" + +Name "Gajim" +OutFile "Gajim.exe" +SetCompressor /final /solid lzma +SetCompressorDictSize 32 + +!define myAppName "Gajim" + +InstallDir "$PROGRAMFILES\Gajim" +InstallDirRegKey HKCU "Software\Gajim" "" +RequestExecutionLevel admin + +Var StartMenuFolder + +!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP "mingw32\gajim\data\pixmaps\nsis_header.bmp" +!define MUI_WELCOMEFINISHPAGE_BITMAP "mingw32\gajim\data\pixmaps\nsis_wizard.bmp" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "mingw32\gajim\data\pixmaps\nsis_wizard.bmp" +;!define MUI_COMPONENTSPAGE_CHECKBITMAP "${NSISDIR}\Contrib\Graphics\Checks\colorful.bmp" +!define MUI_COMPONENTSPAGE_SMALLDESC +!define MUI_ABORTWARNING + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "mingw32\gajim\COPYING" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_DIRECTORY +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Gajim" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder +!insertmacro MUI_PAGE_INSTFILES +!define MUI_FINISHPAGE_RUN "$INSTDIR\bin\Gajim.exe" +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +;Show all languages, despite user's codepage +!define MUI_LANGDLL_ALLLANGUAGES + +!insertmacro MUI_LANGUAGE "English" +!insertmacro MUI_LANGUAGE "French" +!insertmacro MUI_LANGUAGE "German" +!insertmacro MUI_LANGUAGE "Italian" +!insertmacro MUI_LANGUAGE "Russian" +!insertmacro MUI_LANGUAGE "Hebrew" +!insertmacro MUI_RESERVEFILE_LANGDLL + +; English +LangString NAME_Emoticons ${LANG_ENGLISH} "Emoticons" +LangString NAME_Iconsets ${LANG_ENGLISH} "Iconsets" +LangString NAME_Languages ${LANG_ENGLISH} "Languages" +LangString NAME_SecLanguagesOther ${LANG_ENGLISH} "Other" +LangString NAME_Themes ${LANG_ENGLISH} "Themes" +LangString NAME_SecDesktopIcon ${LANG_ENGLISH} "Create icon on desktop" +LangString NAME_SecAutostart ${LANG_ENGLISH} "Start Gajim when Windows starts" +LangString DESC_SecGajim ${LANG_ENGLISH} "Installs the main Gajim files." +LangString DESC_SecDesktopIcon ${LANG_ENGLISH} "If set, a shortcut for Gajim will be created on the desktop." +LangString DESC_SecAutostart ${LANG_ENGLISH} "If set, Gajim will be automatically started when Windows starts." +LangString STR_Installed ${LANG_ENGLISH} "Apparently, Gajim is already installed. Uninstall it?" +LangString STR_Running ${LANG_ENGLISH} "It appears that Gajim is currently running.$\n\ + Please quit Gajim and restart the uninstaller." + +; French +LangString NAME_Emoticons ${LANG_FRENCH} "Emoticônes" +LangString NAME_Iconsets ${LANG_FRENCH} "Bibliothèque d'icônes" +LangString NAME_Languages ${LANG_FRENCH} "Langues" +LangString NAME_SecLanguagesOther ${LANG_FRENCH} "Autre" +LangString NAME_Themes ${LANG_FRENCH} "Thèmes" +LangString NAME_SecDesktopIcon ${LANG_FRENCH} "Créer une icône sur le bureau" +LangString NAME_SecAutostart ${LANG_FRENCH} "Lancer Gajim au démarrage de Windows" +LangString DESC_SecGajim ${LANG_FRENCH} "Installer les fichiers principaux de Gajim." +LangString DESC_SecDesktopIcon ${LANG_FRENCH} "Si selectionné, un raccourci pour Gajim sera créé sur le bureau." +LangString DESC_SecAutostart ${LANG_FRENCH} "Si activé, Gajim sera automatiquement lancé au démarrage de Windows." +LangString STR_Installed ${LANG_FRENCH} "Gajim est apparement déjà installé. Lancer la désinstallation ?" +LangString STR_Running ${LANG_FRENCH} "Gajim est apparament lancé.$\n\ + Fermez-le et redémarrez le désinstallateur." + +; German +LangString NAME_Emoticons ${LANG_GERMAN} "Emoticons" +LangString NAME_Iconsets ${LANG_GERMAN} "Symbolsets" +LangString NAME_Languages ${LANG_GERMAN} "Sprachen" +LangString NAME_SecLanguagesOther ${LANG_GERMAN} "Sonstige" +LangString NAME_Themes ${LANG_GERMAN} "Designs" +LangString NAME_SecDesktopIcon ${LANG_GERMAN} "Desktop-Icon erstellen" +LangString NAME_SecAutostart ${LANG_GERMAN} "Gajim mit Windows starten" +LangString DESC_SecGajim ${LANG_GERMAN} "Installiert die Hauptdateien von Gajim." +LangString DESC_SecDesktopIcon ${LANG_GERMAN} "Wenn dies aktiviert wird, wird ein Icon für Gajim auf dem Desktop erstellt." +LangString DESC_SecAutostart ${LANG_GERMAN} "Gajim wird automatisch gestartet, sowie Windows startet, wenn dies aktivier wird." +LangString STR_Installed ${LANG_GERMAN} "Gajim is apparently already installed. Uninstall it?" +LangString STR_Running ${LANG_GERMAN} "Es scheint, dass Gajim bereits läuft.$\n\ + Bitte beenden Sie es und starten Sie den Installer erneut.." + +; Italian +LangString NAME_Emoticons ${LANG_ITALIAN} "Emoticons" +LangString NAME_Iconsets ${LANG_ITALIAN} "Set di icone" +LangString NAME_Languages ${LANG_ITALIAN} "Lingue" +LangString NAME_SecLanguagesOther ${LANG_ITALIAN} "Altre" +LangString NAME_Themes ${LANG_ITALIAN} "Temi" +LangString NAME_SecDesktopIcon ${LANG_ITALIAN} "Crea un'icona sul desktop" +LangString NAME_SecAutostart ${LANG_ITALIAN} "Lancia Gajim quando parte Windows" +LangString DESC_SecGajim ${LANG_ITALIAN} "Installa i file principali di Gajim." +LangString DESC_SecDesktopIcon ${LANG_ITALIAN} "Se selezionato, un'icona verrà creata sul desktop." +LangString DESC_SecAutostart ${LANG_ITALIAN} "Se selezionato, Gajim sarà eseguito all'avvio di Windows." +LangString STR_Installed ${LANG_ITALIAN} "Gajim is apparently already installed. Uninstall it?" +LangString STR_Running ${LANG_ITALIAN} "It appears that Gajim is currently running.$\n\ + Close it and restart uninstaller." + +; Russian +LangString NAME_Emoticons ${LANG_RUSSIAN} "Смайлики" +LangString NAME_Iconsets ${LANG_RUSSIAN} "Темы иконок" +LangString NAME_Languages ${LANG_RUSSIAN} "Языки" +LangString NAME_SecLanguagesOther ${LANG_RUSSIAN} "Другое" +LangString NAME_Themes ${LANG_RUSSIAN} "Темы" +LangString NAME_SecDesktopIcon ${LANG_RUSSIAN} "Создать я лык на абочем столе" +LangString NAME_SecAutostart ${LANG_RUSSIAN} "Запускать Gajim при загрузке Windows" +LangString DESC_SecGajim ${LANG_RUSSIAN} "Установка основных файлов Gajim." +LangString DESC_SecDesktopIcon ${LANG_RUSSIAN} "Если отмечено, на рабочем столе будет создан ярлык Gajim." +LangString DESC_SecAutostart ${LANG_RUSSIAN} "Если отмечено, Gajim будет автоматически запускаться при загрузке Windows." +LangString STR_Installed ${LANG_RUSSIAN} "Похоже, Gajim уже установлен. Деинсталлировать установленную версию?" +LangString STR_Running ${LANG_RUSSIAN} "Похоже, Gajim уже запущен.$\n\ + Закройте его и запустите деинсталлятор снова." + +; Hebrew +LangString NAME_Emoticons ${LANG_HEBREW} "רגשונים" +LangString NAME_Iconsets ${LANG_HEBREW} "מערכי צלמית" +LangString NAME_Languages ${LANG_HEBREW} "שפות" +LangString NAME_SecLanguagesOther ${LANG_HEBREW} "אחרות" +LangString NAME_Themes ${LANG_HEBREW} "ערכאות נושא" +LangString NAME_SecDesktopIcon ${LANG_HEBREW} "צור סמל בשולחן עבודה" +LangString NAME_SecAutostart ${LANG_HEBREW} "הפעל את Gajim כאשר Windows מתחיל" +LangString DESC_SecGajim ${LANG_HEBREW} "מתקין קבצי Gajim עיקריים." +LangString DESC_SecDesktopIcon ${LANG_HEBREW} "במידה ונקבעת, קיצור דרך עבור Gajim יושם על שולחן העבודה." +LangString DESC_SecAutostart ${LANG_HEBREW} "במידה ונקבעת, Gajim יופעל אוטומטית כאשר Windows מתחיל." +LangString STR_Installed ${LANG_HEBREW} "כפי הנראה, Gajim כבר מותקן. להסיר אותו?" +LangString STR_Running ${LANG_HEBREW} "נראה שהתוכנית Gajim מורצת כעת.$\n\ + אנא צא מן Gajim ואתחל את מסיר ההתקנה." + +Section "Gajim" SecGajim + SectionIn RO + + SetOutPath "$INSTDIR" + File /r "mingw32\*.*" + + WriteRegStr HKCU "Software\Gajim" "" $INSTDIR + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gajim" "DisplayName" "Gajim" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gajim" "UninstallString" "$INSTDIR\Uninstall.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gajim" "DisplayIcon" "$INSTDIR\bin\Gajim.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gajim" "DisplayVersion" "${VERSION}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gajim" "URLInfoAbout" "https://www.gajim.org/" + WriteUninstaller "$INSTDIR\Uninstall.exe" + + SetOutPath "$INSTDIR\bin" + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + SetShellVarContext current + CreateDirectory "$SMPROGRAMS\$StartMenuFolder" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Gajim.lnk" "$INSTDIR\bin\Gajim.exe" + SetShellVarContext all + CreateDirectory "$SMPROGRAMS\$StartMenuFolder" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Gajim.lnk" "$INSTDIR\bin\Gajim.exe" + !insertmacro MUI_STARTMENU_WRITE_END + +SectionEnd + +Section $(NAME_SecDesktopIcon) SecDesktopIcon + SetShellVarContext current + SetOutPath "$INSTDIR\bin" + CreateShortCut "$DESKTOP\Gajim.lnk" "$INSTDIR\bin\Gajim.exe" +SectionEnd + +Section $(NAME_SecAutostart) SecAutostart + SetShellVarContext current + SetOutPath "$INSTDIR\bin" + CreateShortCut "$SMSTARTUP\Gajim.lnk" "$INSTDIR\bin\Gajim.exe" +SectionEnd + +Section "Uninstall" + RMDir /r "$INSTDIR" + + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder + + SetShellVarContext current + Delete "$SMPROGRAMS\$StartMenuFolder\Gajim.lnk" + Delete "$SMPROGRAMS\$StartMenuFolder\Change Theme.lnk" + RMDir "$SMPROGRAMS\$StartMenuFolder" + Delete "$DESKTOP\Gajim.lnk" + Delete "$SMSTARTUP\Gajim.lnk" + SetShellVarContext all + Delete "$SMPROGRAMS\$StartMenuFolder\Gajim.lnk" + Delete "$SMPROGRAMS\$StartMenuFolder\Change Theme.lnk" + RMDir "$SMPROGRAMS\$StartMenuFolder" + + DeleteRegKey /ifempty HKCU "Software\Gajim" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gajim" +SectionEnd + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SecGajim} $(DESC_SecGajim) + !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} $(DESC_SecDesktopIcon) + !insertmacro MUI_DESCRIPTION_TEXT ${SecAutostart} $(DESC_SecAutostart) +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +Function un.onInit +; Check that Gajim is not running before uninstalling + FindWindow $0 "gdkWindowToplevel" "Gajim" + StrCmp $0 0 Remove + MessageBox MB_ICONSTOP|MB_OK $(STR_Running) + Quit +Remove: + !insertmacro MUI_UNGETLANGUAGE +FunctionEnd + +Function .onInit + BringToFront +; Check if already running +; If so don't open another but bring to front + System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e" + Pop $0 + StrCmp $0 0 launch + StrLen $0 "$(^Name)" + IntOp $0 $0 + 1 + FindWindow $1 '#32770' '' 0 $1 + IntCmp $1 0 +3 + System::Call "user32::ShowWindow(i r1,i 9) i." ; If minimized then maximize + System::Call "user32::SetForegroundWindow(i r1) i." ; Bring to front + Abort + +launch: +; Check to see if old install (inno setup) is already installed + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gajim_is1" "UninstallString" +; remove first and last " char + StrLen $0 $R0 + IntOp $0 $0 - 2 + strcpy $1 $R0 $0 1 + IfFileExists $1 +1 NotInstalled + MessageBox MB_YESNO|MB_DEFBUTTON2|MB_TOPMOST $(STR_Installed) IDNO Quit + StrCmp $R1 2 Quit +1 + ExecWait '$R0 _?=$INSTDIR' $R2 + StrCmp $R2 0 +1 Quit + +NotInstalled: +; Check to see if new installer (NSIS)already installed + ReadRegStr $R3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gajim" "UninstallString" + IfFileExists $R3 +1 ReallyNotInstalled + MessageBox MB_YESNO|MB_DEFBUTTON2|MB_TOPMOST $(STR_Installed) IDNO Quit + StrCmp $R4 2 Quit +1 + ExecWait '$R3 _?=$INSTDIR' $R5 + StrCmp $R5 0 ReallyNotInstalled Quit +Quit: + Quit + +ReallyNotInstalled: + !insertmacro MUI_LANGDLL_DISPLAY +FunctionEnd |