Update to use the generic manifest and make independent of the U3 packaging.
authorgal <gal@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 4 Jan 2008 14:12:22 +0000 (14:12 +0000)
committergal <gal@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 4 Jan 2008 14:12:22 +0000 (14:12 +0000)
Also tidy up.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24013 f5534014-38df-0310-8fa8-9805f1628bb7

packaging/portableapps/win32/WiresharkPortable.ini
packaging/portableapps/win32/WiresharkPortable.nsi
packaging/portableapps/win32/makefile.nmake
packaging/portableapps/win32/makenmake.pl [new file with mode: 0644]
packaging/portableapps/win32/readme.txt

index 22faab04934c205d887936b93914e2df97f74186..590c15175dbd3f197db94462188695a53981354a 100755 (executable)
@@ -4,10 +4,11 @@
 # $Id$
 #
 [WiresharkPortable]
-WiresharkDirectory=App\Wireshark
+
+WiresharkDirectory=App/Wireshark
 WiresharkExecutable=wireshark.exe
 AdditionalParameters=
-#DisableSplashScreen=false
+
 DisableWinPcapInstall=false
 WinPcapInstaller=WinPcap_4_0_2.exe
 
index c744ff3f59b47a3e26693185bdac0dbb00dd5b21..7b29822a4ce4881322caa64964eb787b8e5ac011 100755 (executable)
@@ -30,7 +30,6 @@
 !define WEBSITE "www.wireshark.org"
 !define DEFAULTEXE "wireshark.exe"
 !define DEFAULTAPPDIR "Wireshark"
-!define DEFAULTSETTINGSDIR "settings"
 !define DEFAULTWINPCAP "WinPcap_4_0_2.exe"
 
 ;=== Program Details
@@ -61,32 +60,26 @@ RequestExecutionLevel user
 ;=== Include
 !include "FileFunc.nsh"
 !insertmacro GetParameters
-;!insertmacro GetRoot
-;!include "ReplaceInFile.nsh"
-;!include "StrRep.nsh"
 
 ;=== Program Icon
 Icon "Files/App/AppInfo/${APP}.ico"
 
 Var PROGRAMDIRECTORY
-Var SETTINGSDIRECTORY
 Var ADDITIONALPARAMETERS
 Var EXECSTRING
 Var PROGRAMEXECUTABLE
 Var INIPATH
-Var SECONDARYLAUNCH
-Var DISABLESPLASHSCREEN
 Var DISABLEWINPCAPINSTALL
 Var WINPCAPINSTALLER
 Var WINPCAP_UNINSTALL ;declare variable for holding the value of a registry key
 Var PDRIVE
 
 Section "Main"
-       ;=== Check if already running
+       ;=== Check if another WiresharkPortable already running
        System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e'
        Pop $0
        StrCmp $0 0 CheckINI
-               StrCpy $SECONDARYLAUNCH "true"
+               Goto WarnAnotherInstance
 
        CheckINI:
                ;=== Find the INI file, if there is one
@@ -103,15 +96,13 @@ Section "Main"
                ;=== Read the parameters from the INI file
                ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "${APP}Directory"
                StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\$0"
-               ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "SettingsDirectory"
-               StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\$0"
        
                ;=== Check that the above required parameters are present
                IfErrors NoINI
 
-               ReadINIStr $PROGRAMEXECUTABLE "$INIPATH\${NAME}.ini" "${NAME}" "ProgramExecutable"              
+               ReadINIStr $PROGRAMEXECUTABLE "$INIPATH\${NAME}.ini" "${NAME}" "${APP}Executable"               
                ReadINIStr $ADDITIONALPARAMETERS "$INIPATH\${NAME}.ini" "${NAME}" "AdditionalParameters"
-               ReadINIStr $DISABLESPLASHSCREEN "$INIPATH\${NAME}.ini" "${NAME}" "DisableSplashScreen"
+
                ReadINIStr $DISABLEWINPCAPINSTALL "$INIPATH\${NAME}.ini" "${NAME}" "DisableWinPcapInstall"
                ReadINIStr $WINPCAPINSTALLER "$INIPATH\${NAME}.ini" "${NAME}" "WinPcapInstaller"
 
@@ -137,17 +128,15 @@ Section "Main"
 
                IfFileExists "$EXEDIR\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" CheckPortableProgramDIR
                        StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\App\${DEFAULTAPPDIR}"
-                       StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\Data\${DEFAULTSETTINGSDIR}"
                        GoTo EndINI
 
                CheckPortableProgramDIR:
                        IfFileExists "$EXEDIR\${NAME}\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" NoProgramEXE
                        StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\${NAME}\App\${DEFAULTAPPDIR}"
-                       StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\${NAME}\Data\${DEFAULTSETTINGSDIR}"
                        GoTo EndINI
 
        EndINI:
-               IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" FoundProgramEXE
+               IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" GetPassedParameters
 
        NoProgramEXE:
                ;=== Program executable not where expected
@@ -155,24 +144,16 @@ Section "Main"
                Abort
                
        FoundProgramEXE:
-               ;=== Check if running
-               StrCmp $SECONDARYLAUNCH "true" GetPassedParameters
+               ;=== Check if Wireshark running from somwehere else (e.g. U3 device)
                ; if the following step fails, you'll need the FindProcDLL plug-in from:
                ; http://nsis.sourceforge.net/Find_Process_By_Name 
-               FindProcDLL::FindProc "${DEFAULTEXE}"
-               StrCmp $R0 "1" WarnAnotherInstance DisplaySplash
+               FindProcDLL::FindProc "${PROGRAMEXECUTABLE}"
+               StrCmp $R0 "1" WarnAnotherInstance GetPassedParameters
 
        WarnAnotherInstance:
-               MessageBox MB_OK|MB_ICONINFORMATION `Another instance of ${APP} is already running.  Please close other instances of ${APP} before launching ${FULLNAME}.`
+               MessageBox MB_OK|MB_ICONINFORMATION `Another instance of ${APP} is already running. Please close other instances of ${APP} before launching ${FULLNAME}.`
                Abort
        
-       DisplaySplash:
-;              StrCmp $DISABLESPLASHSCREEN "true" GetPassedParameters
-                       ;=== Show the splash screen while processing registry entries
-;                      InitPluginsDir
-;                      File /oname=$PLUGINSDIR\splash.jpg "${NAME}.jpg"
-;                      newadvsplash::show /NOUNLOAD 1000 100 0 -1 /L $PLUGINSDIR\splash.jpg
-       
        GetPassedParameters:
                ;=== Get any passed parameters
                ${GetParameters} $0
@@ -221,34 +202,8 @@ Section "Main"
                System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_DEVICE_EXEC_PATH", "$EXEDIR\App\Wireshark").r0'
                System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_ENV_VERSION", "1.0").r0'
                System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_ENV_LANGUAGE", "1033").r0'
-;      SettingsDirectory:
-               ;=== Set the settings directory if we have a path
-;              IfFileExists "$SETTINGSDIRECTORY\*.*" CheckForSettings
-;                      CreateDirectory $SETTINGSDIRECTORY
-       
-;      CheckForSettings:
                StrCmp $SECONDARYLAUNCH "true" LaunchAndExit
-;              IfFileExists "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" AdjustPaths
-;              IfFileExists "$SETTINGSDIRECTORY\sumatrapdfprefs.txt" MoveSettings AdjustPaths
-               ;IfFileExists "$EXEDIR\App\DefaultData\sumatrapdfprefs.txt" "" LaunchNow
-               ;       CopyFiles /SILENT "$EXEDIR\App\DefaultData\sumatrapdfprefs.txt" "$PROGRAMDIRECTORY"
-               ;       Goto LaunchNow
-
-;      MoveSettings:
-;              Rename "$SETTINGSDIRECTORY\sumatrapdfprefs.txt" "$PROGRAMDIRECTORY\sumatrapdfprefs.txt"
-               
-;      AdjustPaths:
-;              ReadINIStr $LASTDRIVE "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive"
-;              ${GetRoot} $EXEDIR $CURRENTDRIVE
-;              StrCmp $LASTDRIVE $CURRENTDRIVE RememberPath
-;              IfFileExists "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" "" RememberPath
-;                      ${ReplaceInFile} "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" 'File: $LASTDRIVE' 'File: $CURRENTDRIVE'
-;                      Delete "$PROGRAMDIRECTORY\sumatrapdfprefs.txt.old"
-       
-;      RememberPath:
-;              WriteINIStr "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive" "$CURRENTDRIVE"
 
-       ;LaunchNow:
                ExecWait $EXECSTRING
                
        CheckRunning:
@@ -256,18 +211,13 @@ Section "Main"
                FindProcDLL::FindProc "${DEFAULTEXE}"                  
                StrCmp $R0 "1" CheckRunning
 
-       ;UninstallWinPcap: 
                StrCmp $WINPCAP_UNINSTALL "" TheEnd ;=== if we installed it, uninstall it
                ExecWait $WINPCAP_UNINSTALL     
 
-       ;=== Put the settings file back
-;      Sleep 500
-;      Rename "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" "$SETTINGSDIRECTORY\sumatrapdfprefs.txt"
        Goto TheEnd
        
        LaunchAndExit:
                Exec $EXECSTRING
 
        TheEnd:
-;              newadvsplash::wait
 SectionEnd
index 5fe3bf2ec852a3a74ea353c72b2634adca63b507..bcf5fde3d99b7b44dfcce5cc3fc8f21efe43107a 100644 (file)
@@ -13,6 +13,8 @@ APPINFO               = AppInfo
 WIRESHARK      = Wireshark
 SOURCE         = WiresharkPortableSource
 
+WSMANIFEST     = ../../wireshark.manifest
+
 FINDPROCDLL    = $(MAKENSIS)\..\Plugins\FindProcDLL.dll
 
 TOPDIR         = ..\..\..
@@ -24,6 +26,8 @@ COPY_FLAGS    = /d /y
 WIN32_SETUP_OPT=--download
 !ENDIF
 
+UPX_FLAGS = -q
+
 PAPPS_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO).0
 
 all:   package 
@@ -39,13 +43,31 @@ dirs:
        if not exist $(FILES)\$(OTHER) $(MKDIR) $(FILES)\$(OTHER)
        if not exist $(FILES)\$(OTHER)\$(SOURCE) $(MKDIR) $(FILES)\$(OTHER)\$(SOURCE)
 
-wireshark:
-       cd $(U3DIST)
-       nmake -f makefile.nmake test
-       cd ../../portableapps/win32
-       $(COPY) $(U3DIST)\device\* $(FILES)\$(APP)\$(WIRESHARK) /S $(COPY_FLAGS)                
-       $(COPY) $(U3DIST)\host\* $(FILES)\$(APP)\$(WIRESHARK) /S $(COPY_FLAGS)
-#      $(UPX) $(FILES)\$(APP)\$(WIRESHARK)\*.dll
+nsis-bits:
+       cd ../../nsis
+       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake user-guide.chm NEWS.txt
+       cd ../u3/win32
+
+$(WSMANIFEST):
+       cd ../..
+       $(MAKE) /$(MAKEFLAGS) -f makefile.nmake wireshark.manifest
+       cd portableapps/win32
+
+distribution.nmake:    $(WSMANIFEST) makenmake.pl
+       $(PERL) makenmake.pl $(WSMANIFEST) > $@ 
+
+distribution:  distribution.nmake
+       nmake -f distribution.nmake
+
+pack:  distribution
+!IFDEF UPX
+       -$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\*.exe 
+       -$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\*.dll
+       -$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\plugins\$(VERSION)\*.dll
+       -$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules\*.dll
+       -$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\$(GTK_WIMP_DLLDST_DIR)\*.dll
+!ENDIF
+
 
 appinfo.ini: appinfo.tmpl $(TOPDIR)\config.nmake
        sed -e 's/$$(PAPPS_VERSION)/$(PAPPS_VERSION)/g' \
@@ -67,7 +89,7 @@ findprocdll:
        @$(SH) $(TOPDIR)\tools\win32-setup.sh "$(WIN32_SETUP_OPT)" "$(MAKENSIS)\.." \
                Plugins FindProc.zip
 
-WiresharkPortable-$(VERSION).paf.exe : dirs appinfo wireshark source Files/WiresharkPortable.exe Installer.nsi 
+WiresharkPortable-$(VERSION).paf.exe : dirs appinfo nsis-bits pack source Files/WiresharkPortable.exe Installer.nsi 
        $(MAKENSIS) \
        /DVERSION=$(PAPPS_VERSION) \
        /DWSVERSION=$(VERSION) \
@@ -80,8 +102,12 @@ Files/WiresharkPortable.exe : WiresharkPortable.nsi findprocdll
        WiresharkPortable.nsi
 
 clean:
+       cd ../../
+       $(MAKE) -f makefile.nmake $@
+       cd portableapps/win32
        rm -rf $(FILES)
        rm -rf appinfo.ini
+       rm -rf distribution.nmake
        rm -rf WiresharkPortable-$(VERSION).paf.exe
        rm -rf *~ *.*~
 
diff --git a/packaging/portableapps/win32/makenmake.pl b/packaging/portableapps/win32/makenmake.pl
new file mode 100644 (file)
index 0000000..ad2c704
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# makenmake.pl - create a nmake file from a generic manifest file that will create the appropriate PortableApp structure
+# $Id$
+#
+
+print "
+include ../../../config.nmake
+include <win32.mak>
+
+FILES          = Files
+APP            = App
+WIRESHARK      = Wireshark
+
+TOPDIR = ..\\..\\..
+COPY   = xcopy
+MOVE    = mv
+MKDIR  = mkdir
+COPY_FLAGS     = /d /y 
+
+distribution:
+";
+
+while($line = <>) {
+    
+    if($line =~ /^\#/) { # comment
+       next;
+    } elsif($line =~ /^\[(\S+)/) { # new directory
+       $dir = $1;
+
+       $dir =~ s/\$INSTDIR?//; # remove $INSTDIR
+       
+       $dir =~ s/\{/\(/g; $dir =~ s/\}/\)/g; # convert curlies to round brackets
+
+       if($dir ne '') { 
+           print "\tif not exist \$(FILES)\\\$(APP)\\\$(WIRESHARK)$dir \$(MKDIR) \$(FILES)\\\$(APP)\\\$(WIRESHARK)$dir\n"; 
+       }
+       
+    } else { # this is a file
+
+       $line =~ /^\s+(\S+)/;
+       $file = $1;
+
+       $file =~ s/\{/\(/g; $file =~ s/\}/\)/g; # convert curlies to round brackets
+
+       if($file =~ /^[^\$]/) {
+           $file = "\$(TOPDIR)\\" . $file;
+       }
+
+       if($line =~ /ifdef=(\w+)/) { # dependency
+           if($define ne $1) {
+               if(defined $define) {
+                   print "!ENDIF\n";
+               }
+               $define = $1;
+               print "!IF DEFINED($define)";
+
+               if($define eq "GTK1_DIR") {
+                   # only include this if GTK2_DIR is not defined
+                   print "& !DEFINED(GTK2_DIR)";
+               }
+
+               print "\n";
+           }
+       } else {
+           
+           if(defined $define) {
+               print "!ENDIF\n";
+           }
+           undef $define;
+       }
+
+       $oname = "";
+
+       print "\t\$(COPY) $file \$(FILES)\\\$(APP)\\\$(WIRESHARK)$dir \$(COPY_FLAGS)\n";
+
+       if($line =~ /oname=(\S+)/) { # override this filename
+           $oname = $1;
+           $file =~ /\\(.*)$/;
+           $name = $1;
+
+           print "\t\$(MOVE) \$(FILES)\\\$(APP)\\\$(WIRESHARK)\\$dir\\$name \$(FILES)\\\$(APP)\\\$(WIRESHARK)\\$dir\\$oname\n";
+
+       }
+
+    }
+}
index 3cb6411c0c8c1b5bbc838ec4d4d68be937c4da6e..c6a32c4935c31e4d023c78fcae0a5f849d8c3476 100644 (file)
@@ -25,5 +25,22 @@ NSIS is used by the standard Win32 installation mechansim (packaging/nsis) but a
 
 INI Settings
 ============
+The Wireshark Portable Launcher will look for an ini file called WiresharkPortable.ini within its directory.  It is only necessary to have a ini file if you wish to change the default configuration. 
+There is an example INI included with this package to get you started.  The INI file is formatted as follows:
 
-To be documented.
+[WiresharkPortable]
+WiresharkDirectory
+WiresharkExecutable
+AdditionalParameters
+DisableWinPcapInstall
+WinPcapInstaller
+
+The WiresharkDirectory entry should be set to the *relative* path to the directory containing the Wireshark Portable Launcher (WiresharkPortable.exe). This entry must be present. 
+
+The WiresharkExecutable entry allows you to set the Wireshark Portable Launcher to use an alternate EXE call to launch Wireshark. 
+
+The AdditionalParameters entry allows you to pass additional commandline parameter entries to wireshark.exe. 
+
+The DisableWinPcapInstall allows you to disable the installation of WinPcap, even if it it not present on the host system.
+
+The WinPcapInstaller allows you to specify a different WinPcap installer than the default one included in the distribution. For example, if you download a later version.
\ No newline at end of file