diff --git a/Makefile.in b/Makefile.in index 3dcfb33..16668f1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -178,6 +178,10 @@ plugin: $(PRPL_LIBNAME) strip: $(PRPL_LIBNAME) $(STRIP) --strip-unneeded $(PRPL_LIBNAME) +.PHONY: build-nsi +build-nsi: telegram-purple.nsi.awk telegram-purple.nsi.awk-in + awk -f telegram-purple.nsi.awk telegram-purple.nsi.awk-in > telegram-purple.nsi + .PHONY: run run: pidgin -d | grep 'telegram\|plugin\|proxy' diff --git a/telegram-purple.nsi.awk b/telegram-purple.nsi.awk new file mode 100644 index 0000000..986cc85 --- /dev/null +++ b/telegram-purple.nsi.awk @@ -0,0 +1,14 @@ +{ + if (match($0,"%")) { + do { + prev=lang; + getline lang<"po/LINGUAS"; + l=$0; + gsub("%",lang,l); + if (prev!=lang) {print l} + } while (prev!=lang); + close("po/LINGUAS") + } else { + print $0 + } +} diff --git a/telegram-purple.nsi.awk-in b/telegram-purple.nsi.awk-in new file mode 100644 index 0000000..3578628 --- /dev/null +++ b/telegram-purple.nsi.awk-in @@ -0,0 +1,120 @@ +; This file is part of telegram-purple +; +; 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. +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +; +; Copyright Matthias Jentsch, Eion Robb 2014-2015 + +; Script based on the Skype4Pidgin and Off-the-Record Messaging NSI files + +SetCompress off + +; todo: SetBrandingImage +; HM NIS Edit Wizard helper defines +!define PRODUCT_NAME "telegram-purple" +!define PRODUCT_VERSION "${PLUGIN_VERSION}" +!define PRODUCT_PUBLISHER "The telegram-purple team" +!define PRODUCT_WEB_SITE "https://github.com/majn/telegram-purple" +!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" +!define PRODUCT_UNINST_ROOT_KEY "HKLM" + +; 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" + +; Welcome page +!insertmacro MUI_PAGE_WELCOME +; License page +!insertmacro MUI_PAGE_LICENSE "COPYING" +; Instfiles page +!insertmacro MUI_PAGE_INSTFILES +!define MUI_FINISHPAGE_RUN +!define MUI_FINISHPAGE_RUN_TEXT "Run Pidgin" +!define MUI_FINISHPAGE_RUN_FUNCTION "RunPidgin" +!insertmacro MUI_PAGE_FINISH + +; Uninstaller pages +;!insertmacro MUI_UNPAGE_INSTFILES + +; Language files +!insertmacro MUI_LANGUAGE "English" + +; MUI end ------ + +Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" +OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe" + +Var "PidginDir" + +ShowInstDetails show +ShowUnInstDetails show + +Section "MainSection" SEC01 + ;Check for pidgin installation + Call GetPidginInstPath + + SetOverwrite try + + SetOutPath "$PidginDir\pixmaps\pidgin" + File "/oname=protocols\16\telegram.png" "imgs\telegram16.png" + File "/oname=protocols\22\telegram.png" "imgs\telegram22.png" + File "/oname=protocols\48\telegram.png" "imgs\telegram48.png" + + SetOverwrite try + copy: + ClearErrors + Delete "$PidginDir\plugins\${PRPL_NAME}" + IfErrors dllbusy + SetOutPath "$PidginDir\plugins" + File "bin\${PRPL_NAME}" + Goto after_copy + dllbusy: + MessageBox MB_RETRYCANCEL "${PRPL_NAME} is busy. Please close Pidgin (including tray icon) and try again" IDCANCEL cancel + Goto copy + cancel: + Abort "Installation of telegram-purple aborted" + after_copy: + + SetOutPath "$PidginDir\locale" + File /nonfatal "/oname=%\LC_MESSAGES\telegram-purple.mo" "po\%.mo" + + SetOutPath "$PidginDir" + File "/oname=server.tglpub" "tg-server.tglpub" + File "${WIN32_DEV_TOP}\libgpg-error-1.12-2\bin\libgpg-error-0.dll" + File "${WIN32_DEV_TOP}\libgcrypt-1.6.3\bin\libgcrypt-20.dll" + File "${WIN32_DEV_TOP}\libwebp-0.4.3-1\bin\libwebp-5.dll" + File "${WIN32_DEV_TOP}\mingw\bin\libgcc_s_sjlj-1.dll" + +SectionEnd + +Function GetPidginInstPath + Push $0 + ReadRegStr $0 HKLM "Software\pidgin" "" + IfFileExists "$0\pidgin.exe" cont + ReadRegStr $0 HKCU "Software\pidgin" "" + IfFileExists "$0\pidgin.exe" cont + MessageBox MB_OK|MB_ICONINFORMATION "Failed to find Pidgin installation." + Abort "Failed to find Pidgin installation. Please install Pidgin first." + cont: + StrCpy $PidginDir $0 +FunctionEnd + +Function RunPidgin + ExecShell "" "$PidginDir\pidgin.exe" +FunctionEnd +