changeset 94:b2f22ae5f810

64 bit support for diff_ext_for_kdiff3 and installer
author joachim99
date Sun, 28 Feb 2010 19:43:48 +0000
parents 7756588e8519
children 6f42f5bd218e
files kdiff3/diff_ext_for_kdiff3/Makefile_64bit kdiff3/diff_ext_for_kdiff3/server.cpp kdiff3/windows_installer/kdiff3.nsi
diffstat 3 files changed, 132 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kdiff3/diff_ext_for_kdiff3/Makefile_64bit	Sun Feb 28 19:43:48 2010 +0000
@@ -0,0 +1,64 @@
+# Project: diff_ext
+# Generates diff_ext_for_kdiff3.dll with gcc.
+# Can be used for Cygwin and MingW (MingW ignores -mno-cygwin)
+#
+PROJ := diff_ext_for_kdiff3
+
+CXX  := x86_64-w64-mingw32-g++.exe
+
+ifdef DEBUG
+  CXXFLAGS ?= -g
+else
+  CXXFLAGS ?= -Os
+  LDFLAGS += -s
+endif
+CXXFLAGS += -ansi -pedantic -Wall -W -D_UNICODE -DUNICODE
+
+LIBS := -luuid -lole32
+DEFFILE = $(PROJ).def
+STATICLIB = $(PROJ).a
+EXPLIB = $(PROJ).exp
+
+SRC-CXX = $(wildcard *.cpp)
+SRC-RC = $(wildcard *.rc)
+
+OBJ  := $(SRC-CXX:.cpp=.o)
+RES  := $(SRC-RC:.rc=.res)
+OBJ += $(RES)
+DLL  := $(PROJ).dll
+
+.PHONY: all clean
+
+.SUFFIXES: .rc .res
+
+all: .depend $(DLL)
+
+debug:
+	$(MAKE) DEBUG=YES UNICODE=YES
+
+release:
+	$(MAKE) 
+
+.depend: Makefile $(SRC-RC) $(SRC-CXX)
+	$(CXX) -M $(CXXFLAGS) $(SRC-RC) $(SRC-CXX) > .depend
+	
+include .depend
+
+clean: clean-custom
+	${RM}  $(OBJ) $(DLL) ${EXPLIB} $(STATICLIB)
+	
+$(DLL): $(OBJ)
+	x86_64-w64-mingw32-dllwrap.exe \
+		--mno-cygwin \
+		--def $(DEFFILE) \
+		--output-exp ${EXPLIB} \
+		--driver-name x86_64-w64-mingw32-g++ -static-libgcc  -L/Users/Joachim/qt/mingw-w64-bin_i686-mingw_20100105/mingw/lib \
+		--implib $(STATICLIB) \
+		$(OBJ) $(LDFLAGS) $(LIBS) \
+		-o $@
+
+.cpp.o:
+	$(CXX) $(CXXFLAGS) -c $< -o $@ 
+
+.rc.res:
+	x86_64-w64-mingw32-windres.exe  $< -J rc -o $@ -O coff -DMING
--- a/kdiff3/diff_ext_for_kdiff3/server.cpp	Sun Feb 28 19:32:54 2010 +0000
+++ b/kdiff3/diff_ext_for_kdiff3/server.cpp	Sun Feb 28 19:43:48 2010 +0000
@@ -33,9 +33,9 @@
 
 // registry key util struct
 struct REGSTRUCT {
-  LPTSTR subkey;
-  LPTSTR name;
-  LPTSTR value;
+  LPCTSTR subkey;
+  LPCTSTR name;
+  LPCTSTR value;
 };
 
 SERVER* SERVER::_instance = 0;
@@ -43,8 +43,12 @@
 
 //DEFINE_GUID(CLSID_DIFF_EXT, 0xA0482097, 0xC69D, 0x4DEC, 0x8A, 0xB6, 0xD3, 0xA2, 0x59, 0xAC, 0xC1, 0x51);
 // New class id for DIFF_EXT for KDiff3
+#ifdef _WIN64
+// {34471FFB-4002-438b-8952-E4588D0C0FE9}
+DEFINE_GUID( CLSID_DIFF_EXT, 0x34471FFB, 0x4002, 0x438b, 0x89, 0x52, 0xE4, 0x58, 0x8D, 0x0C, 0x0F, 0xE9 );
+#else
 DEFINE_GUID( CLSID_DIFF_EXT, 0x9f8528e4, 0xab20, 0x456e, 0x84, 0xe5, 0x3c, 0xe6, 0x9d, 0x87, 0x20, 0xf3 );
-
+#endif
 
 tstring SERVER::getRegistryKeyString( const tstring& subKey, const tstring& value )
 {
--- a/kdiff3/windows_installer/kdiff3.nsi	Sun Feb 28 19:32:54 2010 +0000
+++ b/kdiff3/windows_installer/kdiff3.nsi	Sun Feb 28 19:43:48 2010 +0000
@@ -3,13 +3,15 @@
 ;Apdapted for KDiff3 by Sebastien Fricker and Joachim Eibl
 ;Requires nsis_v2.19
 
-!define KDIFF3_VERSION "0.9.93"
-!define DIFF_EXT_CLSID "{9F8528E4-AB20-456E-84E5-3CE69D8720F3}"
+!define KDIFF3_VERSION "0.9.95"
+!define DIFF_EXT32_CLSID "{9F8528E4-AB20-456E-84E5-3CE69D8720F3}"
+!define DIFF_EXT64_CLSID "{34471FFB-4002-438b-8952-E4588D0C0FE9}"
 
 ;--------------------------------
 ;Include Modern UI
 
   !include "MUI.nsh"
+  !include "x64.nsh"
 
 ;--------------------------------
 ;General
@@ -31,7 +33,10 @@
 
   Var MUI_TEMP
   Var STARTMENU_FOLDER
-
+  Var DIFF_EXT_CLSID
+  Var DIFF_EXT_DLL
+  Var DIFF_EXT_OLD_DLL
+  
 ;--------------------------------
 ;Interface Settings
 
@@ -227,7 +232,7 @@
     File "COPYING.txt"
     File "Readme_Win.txt"
     File "ChangeLog.txt"
-
+  Delete "$INSTDIR\kdiff3-QT4.exe"
   
   ;Store installation folder
   WriteRegStr HKCU "Software\KDiff3" "" $INSTDIR
@@ -273,26 +278,48 @@
 
 Section "Diff-Ext" SecIntegrationDiffExtForKDiff3
   DetailPrint "Diff-Ext for KDiff3"
+
+${If} ${RunningX64}
+  StrCpy $DIFF_EXT_CLSID ${DIFF_EXT64_CLSID}
+  StrCpy $DIFF_EXT_DLL "diff_ext_for_kdiff3_64.dll"
+  StrCpy $DIFF_EXT_OLD_DLL "diff_ext_for_kdiff3_64_old.dll"
+${Else}
+  StrCpy $DIFF_EXT_CLSID ${DIFF_EXT32_CLSID}
+  StrCpy $DIFF_EXT_DLL "diff_ext_for_kdiff3.dll"
+  StrCpy $DIFF_EXT_OLD_DLL "diff_ext_for_kdiff3_old.dll"
+${EndIf}
+
+  IfFileExists "$INSTDIR\$DIFF_EXT_OLD_DLL" 0 +2
+     Delete "$INSTDIR\$DIFF_EXT_OLD_DLL"
+     
+  IfFileExists "$INSTDIR\$DIFF_EXT_DLL" 0 +2
+     Rename "$INSTDIR\$DIFF_EXT_DLL" "$INSTDIR\$DIFF_EXT_OLD_DLL"
+
   
-  IfFileExists "$INSTDIR\diff_ext_for_kdiff3_old.dll" 0 +2
-     Delete "$INSTDIR\diff_ext_for_kdiff3_old.dll"
-     
-  IfFileExists "$INSTDIR\diff_ext_for_kdiff3.dll" 0 +2
-     Rename "$INSTDIR\diff_ext_for_kdiff3.dll" "$INSTDIR\diff_ext_for_kdiff3_old.dll"
+${If} ${RunningX64}
+	File "diff_ext_for_kdiff3_64.dll"
+${Else}
+	File "diff_ext_for_kdiff3.dll"
+${EndIf}
 
-  File "diff_ext_for_kdiff3.dll"
-  File "DIFF-EXT-LICENSE.txt"
-  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Diff-Ext License.lnk"    "$INSTDIR\DIFF-EXT-LICENSE.txt"
+  SetRegView 64
+
   WriteRegStr HKCU  "Software\KDiff3\diff-ext" "" ""
   WriteRegStr SHCTX "Software\KDiff3\diff-ext" "InstallDir" "$INSTDIR"
   WriteRegStr SHCTX "Software\KDiff3\diff-ext" "diffcommand" "$INSTDIR\kdiff3.exe"
-  WriteRegStr SHCTX "Software\Classes\CLSID\${DIFF_EXT_CLSID}"                ""  "diff-ext-for-kdiff3"
-  WriteRegStr SHCTX "Software\Classes\CLSID\${DIFF_EXT_CLSID}\InProcServer32" ""  "$INSTDIR\diff_ext_for_kdiff3.dll"
-  WriteRegStr SHCTX "Software\Classes\CLSID\${DIFF_EXT_CLSID}\InProcServer32" "ThreadingModel" "Apartment"
-  WriteRegStr SHCTX "Software\Classes\*\shellex\ContextMenuHandlers\diff-ext-for-kdiff3" "" "${DIFF_EXT_CLSID}"
-  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${DIFF_EXT_CLSID}" "diff-ext-for-kdiff3"
-  WriteRegStr SHCTX "Software\Classes\Folder\shellex\ContextMenuHandlers\diff-ext-for-kdiff3" "" "${DIFF_EXT_CLSID}"
-  WriteRegStr SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\diff-ext-for-kdiff3" "" "${DIFF_EXT_CLSID}"
+  WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID"                ""  "diff-ext-for-kdiff3"
+  WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID\InProcServer32" ""  "$INSTDIR\$DIFF_EXT_DLL"
+  WriteRegStr SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID\InProcServer32" "ThreadingModel" "Apartment"
+  WriteRegStr SHCTX "Software\Classes\*\shellex\ContextMenuHandlers\diff-ext-for-kdiff3" "" "$DIFF_EXT_CLSID"
+  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "$DIFF_EXT_CLSID" "diff-ext-for-kdiff3"
+  WriteRegStr SHCTX "Software\Classes\Folder\shellex\ContextMenuHandlers\diff-ext-for-kdiff3" "" "$DIFF_EXT_CLSID"
+  WriteRegStr SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\diff-ext-for-kdiff3" "" "$DIFF_EXT_CLSID"
+
+  SetRegView 32
+
+  File "DIFF-EXT-LICENSE.txt"  
+  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Diff-Ext License.lnk"    "$INSTDIR\DIFF-EXT-LICENSE.txt"
+  
 SectionEnd
 
 Section "WinCVS" SecIntegrationWinCVS
@@ -343,6 +370,7 @@
 
 FunctionEnd
 
+
 ;--------------------------------
 ;Descriptions
 
@@ -373,15 +401,16 @@
     SetShellVarContext current
     Goto +2
     SetShellVarContext all
-
+	
   Delete "$INSTDIR\Uninstall.exe"
   Delete "$INSTDIR\kdiff3.exe"
-  Delete "$INSTDIR\kdiff3-QT4.exe"
   Delete "$INSTDIR\COPYING.txt"
   Delete "$INSTDIR\Readme_Win.txt"
   Delete "$INSTDIR\ChangeLog.txt"
   Delete "$INSTDIR\diff_ext_for_kdiff3.dll"
   Delete "$INSTDIR\diff_ext_for_kdiff3_old.dll"
+  Delete "$INSTDIR\diff_ext_for_kdiff3_64.dll"
+  Delete "$INSTDIR\diff_ext_for_kdiff3_64_old.dll"
   Delete "$INSTDIR\DIFF-EXT-LICENSE.txt"
 
   RMDir /r "$INSTDIR\doc"
@@ -413,17 +442,24 @@
   
     StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
   startMenuDeleteLoopDone:
-
+  
   DeleteRegKey HKCU  "Software\KDiff3"
   DeleteRegKey SHCTX "Software\KDiff3"
   DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\KDiff3"
 
   ; diff_ext_for_kdiff3
-  DeleteRegKey SHCTX "Software\Classes\CLSID\${DIFF_EXT_CLSID}"
+${If} ${RunningX64}
+  StrCpy $DIFF_EXT_CLSID ${DIFF_EXT64_CLSID}
+${Else}
+  StrCpy $DIFF_EXT_CLSID ${DIFF_EXT32_CLSID}
+${EndIf}
+  SetRegView 64
+  DeleteRegKey SHCTX "Software\Classes\CLSID\$DIFF_EXT_CLSID"
   DeleteRegKey SHCTX "Software\Classes\*\shellex\ContextMenuHandlers\diff-ext-for-kdiff3"
   DeleteRegKey SHCTX "Software\Classes\Folder\shellex\ContextMenuHandlers\diff-ext-for-kdiff3"
   DeleteRegKey SHCTX "Software\Classes\Directory\shellex\ContextMenuHandlers\diff-ext-for-kdiff3"
-  DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${DIFF_EXT_CLSID}"
+  DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "$DIFF_EXT_CLSID"
+  SetRegView 32
 
   ; clearcase
   ccInstallHelper::nsisPlugin "uninstall" "$INSTDIR\kdiff3.exe"