aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/portableapps/Makefile.nmake
blob: efe08ea07e5d0f20e36492c0b6666e4fda750d22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#

TOPDIR		= ..\..
TOOLS_DIR	= $(TOPDIR)\tools

include ../../config.nmake

PROGRAM_PORTABLE	= $(PROGRAM_NAME)Portable

STAGING_DIR	= $(PROGRAM_PORTABLE)
APP 		= $(STAGING_DIR)\App
APPINFO		= $(APP)\AppInfo
LAUNCHER_DIR	= $(APPINFO)\Launcher
WIRESHARK_DIR 	= $(APP)\$(PROGRAM_NAME)
DATA		= $(STAGING_DIR)\Data
OTHER		= $(STAGING_DIR)\Other
SOURCE		= $(OTHER)\Source

APPINFO_INI	= $(APPINFO)\appinfo.ini
LAUNCHER_INI	= $(LAUNCHER_DIR)\$(PROGRAM_PORTABLE).ini

WSMANIFEST	= ../wireshark.manifest

NSIS_PLUGINS	= nsis-plugins
FINDPROCDLL	= $(WIRESHARK_LIB_DIR)\$(NSIS_PLUGINS)\FindProcDLL.dll

COPY		= xcopy
MKDIR		= mkdir
COPY_FLAGS	= /d /y
!IFNDEF WIN32_SETUP_OPT
WIN32_SETUP_OPT	= --download
!ENDIF

NSIS_DIR        = $(TOPDIR)\packaging\nsis

# XXX This should be defined in config.nmake.
!IF EXIST("$(TOPDIR)\wireshark-qt-release\wireshark.exe")
QT_DIR		= "$(TOPDIR)\wireshark-qt-release"
!ENDIF
!IF EXIST("$(TOPDIR)\wireshark-qt-release\Qt5Core.dll")
NEED_QT5_DLL	= USE
!ENDIF
!IF EXIST("$(TOPDIR)\wireshark-qt-release\QtCore4.dll")
NEED_QT4_DLL	= USE
!ENDIF

UPX_FLAGS = -q

PAPPS_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO).0
PAPPS_PACKAGE=$(PROGRAM_PORTABLE)-$(VERSION).paf.exe

all: package

package: $(PAPPS_PACKAGE)

dirs:
	if not exist $(STAGING_DIR) $(MKDIR) $(STAGING_DIR)
	if not exist $(APP) $(MKDIR) $(APP)
	if not exist $(APPINFO) $(MKDIR) $(APPINFO)
	if not exist $(LAUNCHER_DIR) $(MKDIR) $(LAUNCHER_DIR)
	if not exist $(WIRESHARK_DIR) $(MKDIR) $(WIRESHARK_DIR)
	if not exist $(DATA) $(MKDIR) $(DATA)
	if not exist $(OTHER) $(MKDIR) $(OTHER)
	if not exist $(SOURCE) $(MKDIR) $(SOURCE)

# XXX - Figure out how to use the PA AppCompactor non-interactively and
# use it instead.
#pack:	distribution
#!IFDEF UPX
#	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\[a-z]*.exe
#	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\*.dll
#	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\extcap\*.dll
#	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\plugins\$(VERSION)\*.dll
#	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders\*.dll
#	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules\*.dll
#	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\$(GTK_WIMP_DLLDST_DIR)\*.dll
#!ENDIF

$(APPINFO_INI): dirs appinfo.tmpl $(TOPDIR)\config.nmake
	sed -e 's/$$(PAPPS_VERSION)/$(PAPPS_VERSION)/g' \
	    -e 's/$$(VERSION)/$(VERSION)/g' \
	< appinfo.tmpl > $@

$(LAUNCHER_INI): dirs $(PROGRAM_PORTABLE).ini
	copy $(PROGRAM_PORTABLE).ini $(LAUNCHER_INI) /y

appinfo: $(APPINFO_INI) $(LAUNCHER_INI)
	copy help.html $(STAGING_DIR)\help.html /y
	copy $(TOPDIR)\image\wireshark.ico $(APPINFO)\appicon.ico /y
	copy $(TOPDIR)\image\wsicon16.png $(APPINFO)\appicon_16.png /y
	copy $(TOPDIR)\image\wsicon32.png $(APPINFO)\appicon_32.png /y
	copy $(TOPDIR)\image\wsicon128.png $(APPINFO)\appicon_128.png /y

# It'd be nice if we could get some sort of status or debugging output. For now
# just cross our fingers.
applauncher: appinfo
	$(PORTABLEAPPS_DIR)\PortableApps.comLauncher\PortableApps.comLauncherGenerator.exe \
		$(MAKEDIR)\$(PROGRAM_PORTABLE)

appbinaries: applauncher
	xcopy $(TOPDIR)\wireshark-qt-release $(WIRESHARK_DIR) /D /I /E /Y
	xcopy $(TOPDIR)\capinfos.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\captype.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\dumpcap.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\editcap.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\mergecap.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\randpkt.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\reordercap.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\rawshark.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\text2pcap.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\tfshark.exe $(WIRESHARK_DIR) /d
	xcopy $(TOPDIR)\tshark.exe $(WIRESHARK_DIR) /d

source: dirs
	$(COPY) readme.txt $(SOURCE) $(COPY_FLAGS)
	$(TEXTIFY) -Destination $(SOURCE) \
                $(TOPDIR)/COPYING \
                $(TOPDIR)/NEWS \
                $(TOPDIR)/README.windows

$(PAPPS_PACKAGE) : dirs appinfo appbinaries source
!IFDEF PORTABLEAPPS_DIR
	$(PORTABLEAPPS_DIR)\PortableApps.comInstaller\PortableApps.comInstaller.exe \
		$(MAKEDIR)\$(PROGRAM_PORTABLE)
!ELSE
!MESSAGE PORTABLEAPPS_DIR not configured in config.nmake. Skipping.
!ENDIF

clean:
	cd ..
	$(MAKE) -f Makefile.nmake $@
	cd portableapps
	rm -rf $(STAGING_DIR)
	rm -rf appinfo.ini
	rm -rf $(PAPPS_PACKAGE)
	rm -rf *~ *.*~

distclean:	clean
	rm -rf WiresharkPortable*.paf.exe

maintainer-clean:	distclean