From 29633720898ffc07ab8f76223ba1c5bf18c0c089 Mon Sep 17 00:00:00 2001 From: crs Date: Sun, 28 Mar 2004 20:00:00 +0000 Subject: [PATCH] Added win32 installer project. --- dist/Makefile.am | 1 + dist/nullsoft/Makefile.am | 27 +++++++ dist/nullsoft/dosify.c | 99 +++++++++++++++++++++++ dist/nullsoft/installer.dsp | 124 +++++++++++++++++++++++++++++ dist/nullsoft/installer.mak | 28 +++++++ dist/nullsoft/synergy.nsi | 152 ++++++++++++++++++++++++++++++++++++ dist/rpm/Makefile.am | 1 + synergy.dsw | 12 +++ 8 files changed, 444 insertions(+) create mode 100644 dist/nullsoft/Makefile.am create mode 100644 dist/nullsoft/dosify.c create mode 100644 dist/nullsoft/installer.dsp create mode 100755 dist/nullsoft/installer.mak create mode 100644 dist/nullsoft/synergy.nsi diff --git a/dist/Makefile.am b/dist/Makefile.am index bf906cbf..b23a284e 100644 --- a/dist/Makefile.am +++ b/dist/Makefile.am @@ -17,6 +17,7 @@ VDEPTH = ./$(VPATH)/$(DEPTH) SUBDIRS = \ rpm \ + nullsoft \ $(NULL) EXTRA_DIST = \ diff --git a/dist/nullsoft/Makefile.am b/dist/nullsoft/Makefile.am new file mode 100644 index 00000000..b45cc611 --- /dev/null +++ b/dist/nullsoft/Makefile.am @@ -0,0 +1,27 @@ +# synergy -- mouse and keyboard sharing utility +# Copyright (C) 2002 Chris Schoeneman +# +# This package is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# found in the file COPYING that should have accompanied this file. +# +# This package 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. + +## Process this file with automake to produce Makefile.in +NULL = +DEPTH = ../.. +VDEPTH = ./$(VPATH)/$(DEPTH) + +EXTRA_DIST = \ + installer.dsp \ + installer.mak \ + synergy.nsi \ + dosify.c \ + $(NULL) + +MAINTAINERCLEANFILES = \ + Makefile.in \ + $(NULL) diff --git a/dist/nullsoft/dosify.c b/dist/nullsoft/dosify.c new file mode 100644 index 00000000..95d0caee --- /dev/null +++ b/dist/nullsoft/dosify.c @@ -0,0 +1,99 @@ +#include +#include +#include + +static +char* +concatPath(const char* dir, const char* name, const char* ext) +{ + size_t nDir = (dir != NULL) ? strlen(dir) : 0; + size_t nPath = nDir + 1 + strlen(name) + strlen(ext?ext:"") + 1; + char* path = malloc(nPath); + + /* directory */ + if (nDir > 0 && strcmp(dir, ".") != 0) { + strcpy(path, dir); + if (path[nDir - 1] != '\\' && path[nDir - 1] != '/') { + strcat(path, "\\"); + } + } + else { + strcpy(path, ""); + } + + + /* name */ + strcat(path, name); + + /* extension */ + if (ext != NULL && strrchr(name, '.') == NULL) { + strcat(path, ext); + } + + return path; +} + +static +int +dosify(const char* srcdir, const char* dstdir, const char* name) +{ + FILE* dFile, *sFile; + char* dName, *sName; + + sName = concatPath(srcdir, name, NULL); + dName = concatPath(dstdir, name, ".txt"); + + sFile = fopen(sName, "rb"); + if (sFile == NULL) { + fprintf(stderr, "Can't open \"%s\" for reading\n", sName); + return 0; + } + else { + dFile = fopen(dName, "w"); + if (dFile == NULL) { + fclose(sFile); + fprintf(stderr, "Can't open \"%s\" for writing\n", dName); + return 0; + } + else { + char buffer[1024]; + while (!ferror(dFile) && + fgets(buffer, sizeof(buffer), sFile) != NULL) { + fprintf(dFile, "%s", buffer); + } + if (ferror(sFile) || ferror(dFile)) { + fprintf(stderr, + "Error copying \"%s\" to \"%s\"\n", sName, dName); + fclose(dFile); + fclose(sFile); + _unlink(dName); + return 0; + } + } + } + + fclose(dFile); + fclose(sFile); + free(dName); + free(sName); + return 1; +} + +#include +int +main(int argc, char** argv) +{ + int i; + + if (argc < 3) { + fprintf(stderr, "usage: %s [files]\n", argv[0]); + return 1; + } + + for (i = 3; i < argc; ++i) { + if (!dosify(argv[1], argv[2], argv[i])) + return 1; + } + + return 0; +} diff --git a/dist/nullsoft/installer.dsp b/dist/nullsoft/installer.dsp new file mode 100644 index 00000000..c101f53f --- /dev/null +++ b/dist/nullsoft/installer.dsp @@ -0,0 +1,124 @@ +# Microsoft Developer Studio Project File - Name="installer" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=installer - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "installer.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "installer.mak" CFG="installer - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "installer - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "installer - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "installer - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "installer___Win32_Release" +# PROP BASE Intermediate_Dir "installer___Win32_Release" +# PROP BASE Cmd_Line "NMAKE /f installer.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "installer.exe" +# PROP BASE Bsc_Name "installer.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "." +# PROP Intermediate_Dir "." +# PROP Cmd_Line "nmake /nologo /f "installer.mak"" +# PROP Rebuild_Opt "/a" +# PROP Target_File "..\..\SynergyInstaller.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" +NSIS=makensis + +!ELSEIF "$(CFG)" == "installer - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "installer___Win32_Debug" +# PROP BASE Intermediate_Dir "installer___Win32_Debug" +# PROP BASE Cmd_Line "NMAKE /f installer.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "installer.exe" +# PROP BASE Bsc_Name "installer.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "." +# PROP Cmd_Line "echo "Can only build installer for Release configuration"" +# PROP Rebuild_Opt "" +# PROP Target_File "dummy.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" +NSIS=makensis + +!ENDIF + +# Begin Target + +# Name "installer - Win32 Release" +# Name "installer - Win32 Debug" + +!IF "$(CFG)" == "installer - Win32 Release" + +!ELSEIF "$(CFG)" == "installer - Win32 Debug" + +!ENDIF + +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\dosify.c +# PROP Intermediate_Dir "." +# End Source File +# Begin Source File + +SOURCE=.\installer.mak + +!IF "$(CFG)" == "installer - Win32 Release" + +# PROP Intermediate_Dir "." + +!ELSEIF "$(CFG)" == "installer - Win32 Debug" + +# PROP Intermediate_Dir "." + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\synergy.nsi +# PROP Intermediate_Dir "." +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/dist/nullsoft/installer.mak b/dist/nullsoft/installer.mak new file mode 100755 index 00000000..30d4d205 --- /dev/null +++ b/dist/nullsoft/installer.mak @@ -0,0 +1,28 @@ +NULL= +DEPTH=..\.. + +NSIS="D:\Program Files\NSIS\makensis" + +DOCS = \ + AUTHORS \ + BUGS \ + COPYING \ + ChangeLog \ + FAQ \ + HISTORY \ + INSTALL \ + NEWS \ + README \ + TODO \ + $(NULL) + +default: dosifydocs installer + +installer: + $(NSIS) synergy.nsi + +dosifydocs: dosify.exe + .\dosify.exe $(DEPTH) . $(DOCS) + +dosify.exe: dosify.c + $(CC) /nologo /Yd /Zi /MLd /Fe$@ $** diff --git a/dist/nullsoft/synergy.nsi b/dist/nullsoft/synergy.nsi new file mode 100644 index 00000000..00c5885f --- /dev/null +++ b/dist/nullsoft/synergy.nsi @@ -0,0 +1,152 @@ +; Synergy.nsi +; +; This script is based on example1.nsi, but it remember the directory, +; has uninstall support and (optionally) installs start menu shortcuts. +; +; It will install makensisw.exe into a directory that the user selects, + +;-------------------------------- + +; Path to root of tree +!define DEPTH "..\.." + +; The name of the installer +Name "Synergy" + +; The file to write +OutFile "${DEPTH}/SynergyInstaller.exe" + +; The default installation directory +InstallDir $PROGRAMFILES\Synergy + +; Registry key to check for directory (so if you install again, it will +; overwrite the old one automatically) +InstallDirRegKey HKLM "Software\Synergy" "Install_Dir" + +;-------------------------------- + +; Pages + +Page license +Page components +Page directory +Page instfiles + +UninstPage uninstConfirm +UninstPage instfiles + +;-------------------------------- + +; Text +ComponentText "This this install Synergy on your computer. Select the optional components you want to install." +DirText "Choose a directory to install Synergy to:" +UninstallText "This will uninstall Synergy from your computer." +LicenseText "Synergy is distributed under the GNU GPL:" +LicenseData "COPYING.txt" + +;-------------------------------- + +; The stuff to install +Section "Synergy (required)" + + SectionIn RO + + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put files there + File "${DEPTH}\Release\synergy.exe" + File "${DEPTH}\Release\synergyc.exe" + File "${DEPTH}\Release\synergys.exe" + File "${DEPTH}\Release\*.dll" + File AUTHORS.txt + File BUGS.txt + File COPYING.txt + File ChangeLog.txt + File FAQ.txt + File HISTORY.txt + File INSTALL.txt + File NEWS.txt + File README.txt + File TODO.txt + + ; Write the installation path into the registry + WriteRegStr HKLM SOFTWARE\Synergy "Install_Dir" "$INSTDIR" + + ; Write the uninstall keys for Windows + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "DisplayName" "Synergy" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "NoRepair" 1 + WriteUninstaller "uninstall.exe" + +SectionEnd + +; Optional section (can be disabled by the user) +Section "Start Menu Shortcuts" + + CreateDirectory "$SMPROGRAMS\Synergy" + CreateShortCut "$SMPROGRAMS\Synergy\Synergy.lnk" "$INSTDIR\synergy.exe" "" "$INSTDIR\synergy.exe" 0 + CreateShortCut "$SMPROGRAMS\Synergy\README.lnk" "$INSTDIR\README.txt" + CreateShortCut "$SMPROGRAMS\Synergy\NEWS.lnk" "$INSTDIR\NEWS.txt" + CreateShortCut "$SMPROGRAMS\Synergy\FAQ.lnk" "$INSTDIR\FAQ.txt" + CreateShortCut "$SMPROGRAMS\Synergy\Synergy Folder.lnk" "$INSTDIR" + CreateShortCut "$SMPROGRAMS\Synergy\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 + +SectionEnd + +;-------------------------------- + +; Uninstaller + +Section "Uninstall" + + ; Remove autorun registry keys for synergy + DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Synergy Server" + DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Synergy Client" + DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\RunServices" "Synergy Server" + DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\RunServices" "Synergy Client" + DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Synergy Server" + DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Synergy Client" + + ; not all keys will have existed, so errors WILL have happened + ClearErrors + + ; Remove registry keys + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" + DeleteRegKey HKLM SOFTWARE\Synergy + + ClearErrors + + ; First try to remove files that might be locked (if synergy is running) + Delete /REBOOTOK $INSTDIR\synergy.exe + Delete /REBOOTOK $INSTDIR\synergyc.exe + Delete /REBOOTOK $INSTDIR\synergys.exe + Delete /REBOOTOK $INSTDIR\synrgyhk.dll + + ; Remove files and directory + Delete $INSTDIR\*.* + RMDir $INSTDIR + + ; Remove shortcuts, if any + Delete "$SMPROGRAMS\Synergy\*.*" + + ; Remove directories used + RMDir "$SMPROGRAMS\Synergy" + RMDir "$INSTDIR" + + IfRebootFlag 0 EndOfAll + MessageBox MB_OKCANCEL "Uninstaller needs to reboot to finish cleaning up. reboot now?" IDCANCEL NoReboot + ClearErrors + Reboot + IfErrors 0 EndOfAll + MessageBox MB_OK "Uninstaller could not reboot. Please reboot manually. Thank you." + Abort "Uninstaller could not reboot. Please reboot manually. Thank you." + NoReboot: + DetailPrint "" + DetailPrint "Uninstaller could not reboot. Please reboot manually. Thank you." + DetailPrint "" + SetDetailsView show + EndOfAll: + +SectionEnd diff --git a/dist/rpm/Makefile.am b/dist/rpm/Makefile.am index 1f0c046b..e19d9eec 100644 --- a/dist/rpm/Makefile.am +++ b/dist/rpm/Makefile.am @@ -16,6 +16,7 @@ DEPTH = ../.. VDEPTH = ./$(VPATH)/$(DEPTH) EXTRA_DIST = \ + synergy.spec.in \ $(NULL) MAINTAINERCLEANFILES = \ diff --git a/synergy.dsw b/synergy.dsw index 63b402d9..225c09ed 100644 --- a/synergy.dsw +++ b/synergy.dsw @@ -84,6 +84,18 @@ Package=<4> ############################################################################### +Project: "installer"=".\DIST\NULLSOFT\installer.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "io"=".\lib\io\io.dsp" - Package Owner=<4> Package=<5>