package.mak 9.22 KB
Newer Older
1 2
if HAVE_WIN32
BUILT_SOURCES_distclean += \
3
	extras/package/win32/NSIS/vlc.win32.nsi extras/package/win32/NSIS/spad.nsi
4 5
endif

6 7
win32_destdir=$(abs_top_builddir)/vlc-$(VERSION)
win32_debugdir=$(abs_top_builddir)/symbols-$(VERSION)
8
win32_xpi_destdir=$(abs_top_builddir)/vlc-plugin-$(VERSION)
9

10 11 12
7Z_OPTS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on


13 14
if HAVE_WIN32
include extras/package/npapi.am
15 16

build-npapi: package-win-install
17 18
endif

19 20 21 22 23 24
if HAVE_WIN64
WINVERSION=vlc-$(VERSION)-win64
else
WINVERSION=vlc-$(VERSION)-win32
endif

25
package-win-install:
26
	$(MAKE) install
27 28
	touch $@

29
package-win-common: package-win-install
30
	mkdir -p "$(win32_destdir)"/
31 32

# Executables, major libs+manifests
33
	find $(prefix) -maxdepth 4 \( -name "*$(LIBEXT)" -o -name "*$(EXEEXT)" \) -exec cp {} "$(win32_destdir)/" \;
34
	cd $(top_srcdir)/extras/package/win32 && cp vlc$(EXEEXT).manifest libvlc$(LIBEXT).manifest "$(win32_destdir)/"
35

36
# Text files, clean them from mail addresses
37
	for file in AUTHORS THANKS ; \
38 39
		do sed 's/@/_AT_/' < "$(srcdir)/$$file" > "$(win32_destdir)/$${file}.txt"; \
	done
40
	for file in NEWS COPYING README; \
41 42
		do cp "$(srcdir)/$$file" "$(win32_destdir)/$${file}.txt"; \
	done
43 44

	cp $(srcdir)/share/icons/vlc.ico $(win32_destdir)
45 46
	mkdir -p "$(win32_destdir)"/plugins
	(cd $(prefix)/lib/vlc/plugins/ && find . -type f \( -not -name '*.la' -and -not -name '*.a' \) -exec cp -v --parents "{}" "$(win32_destdir)/plugins/" \;)
47
	-cp -r $(prefix)/share/locale $(win32_destdir)
48

49 50 51
# BD-J JAR
	-cp $(CONTRIB_DIR)/share/java/*.jar $(win32_destdir)/plugins/access/

52
if BUILD_LUA
53
	mkdir -p $(win32_destdir)/lua/
54
	cp -r $(prefix)/lib/vlc/lua/* $(prefix)/share/vlc/lua/* $(win32_destdir)/lua/
55 56 57
endif

if BUILD_SKINS
58
	rm -fr $(win32_destdir)/skins
59
	cp -r $(prefix)/share/vlc/skins2 $(win32_destdir)/skins
60
endif
61

62 63 64
# Compiler shared DLLs, when using compilers built with --enable-shared
# The shared DLLs may not necessarily be in the first LIBRARY_PATH, we
# should check them all.
65
	-library_path_list=`$(CXX) -v /dev/null 2>&1 | grep ^LIBRARY_PATH|cut -d= -f2` ;\
66
	-cygpath --version >/dev/null 2>/dev/null && library_path_list="`cygpath -p $$library_path_list`" ;\
67 68 69
	IFS=':' ;\
	for x in $$library_path_list ;\
	do \
70
		test -f "$$x/libgcc_s_sjlj-1.dll" && cp "$$x/libgcc_s_sjlj-1.dll" "$(win32_destdir)/" ; \
71
		test -f "$$x/libgcc_s_seh-1.dll" && cp "$$x/libgcc_s_seh-1.dll" "$(win32_destdir)/" ; \
72 73
	done

74
# SDK
75
	mkdir -p "$(win32_destdir)/sdk/lib/"
76 77
	cp -r $(prefix)/include "$(win32_destdir)/sdk"
	cp -r $(prefix)/lib/pkgconfig "$(win32_destdir)/sdk/lib"
78 79 80
	cd $(prefix)/lib && cp -rv libvlc.la libvlccore.la "$(win32_destdir)/sdk/lib/"
	cd $(prefix)/lib && cp -rv libvlc.dll.a "$(win32_destdir)/sdk/lib/libvlc.lib"
	cd $(prefix)/lib && cp -rv libvlccore.dll.a "$(win32_destdir)/sdk/lib/libvlccore.lib"
81
	$(DLLTOOL) -D libvlc.dll -l "$(win32_destdir)/sdk/lib/libvlc.lib" -d "$(top_builddir)/lib/.libs/libvlc.dll.def" "$(prefix)/bin/libvlc.dll"
Rafaël Carré's avatar
Rafaël Carré committed
82
	echo "INPUT(libvlc.lib)" > "$(win32_destdir)/sdk/lib/vlc.lib"
83
	$(DLLTOOL) -D libvlccore.dll -l "$(win32_destdir)/sdk/lib/libvlccore.lib" -d "$(top_builddir)/src/.libs/libvlccore.dll.def" "$(prefix)/bin/libvlccore.dll"
Rafaël Carré's avatar
Rafaël Carré committed
84
	echo "INPUT(libvlccore.lib)" > "$(win32_destdir)/sdk/lib/vlccore.lib"
85

86
# Convert to DOS line endings
87
	find $(win32_destdir) -type f \( -name "*xml" -or -name "*html" -or -name '*js' -or -name '*css' -or -name '*hosts' -or -iname '*txt' -or -name '*.cfg' -or -name '*.lua' \) -exec $(U2D) -q {} \;
88

89 90 91 92 93 94 95
package-win-npapi: build-npapi
	cp "$(top_builddir)/npapi-vlc/activex/axvlc.dll.manifest" "$(win32_destdir)/"
	cp "$(top_builddir)/npapi-vlc/installed/lib/axvlc.dll" "$(win32_destdir)/"
	cp "$(top_builddir)/npapi-vlc/npapi/package/npvlc.dll.manifest" "$(win32_destdir)/"
	cp "$(top_builddir)/npapi-vlc/installed/lib/npvlc.dll" "$(win32_destdir)/"
	mkdir -p "$(win32_destdir)/sdk/activex/"
	cd $(top_builddir)/npapi-vlc && cp activex/README.TXT share/test/test.html $(win32_destdir)/sdk/activex/
96

97
package-win-strip: package-win-common package-win-npapi
98 99
	mkdir -p "$(win32_debugdir)"/
	cd $(win32_destdir); find . -type f \( -name '*$(LIBEXT)' -or -name '*$(EXEEXT)' \) | while read i; \
100
	do if test -n "$$i" ; then \
101
	    $(OBJCOPY) --only-keep-debug "$$i" "$(win32_debugdir)/`basename $$i.dbg`"; \
102
	    $(OBJCOPY) --strip-all "$$i" ; \
103
	    $(OBJCOPY) --add-gnu-debuglink="$(win32_debugdir)/`basename $$i.dbg`" "$$i" ; \
104 105
	  fi ; \
	done
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
106 107 108
	if test -n "$(SIGNATURE)"; then \
	  cd $(win32_destdir); find . -type f \( -name '*$(LIBEXT)' -or -name '*$(EXEEXT)' \) | while read i; \
	  do if test -n "$$i" ; then \
109
	    osslsigncode sign -certs $(SIGNATURE)/cert.cer -key $(SIGNATURE)/videolan.key -n "VLC media player" -i http://www.videolan.org/ -t http://timestamp.verisign.com/scripts/timstamp.dll -in "$$i" -out "$$i.sign"; \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
110 111 112 113
	    mv "$$i.sign" "$$i" ; \
	  fi ; \
	  done \
	fi
114

115

116
package-win32-webplugin-common: package-win-strip
117 118 119
	mkdir -p "$(win32_xpi_destdir)/plugins/"
	cp -r $(win32_destdir)/plugins/ "$(win32_xpi_destdir)/plugins/"
	cp "$(win32_destdir)/libvlc.dll" "$(win32_destdir)/libvlccore.dll" "$(win32_destdir)/npvlc.dll" "$(win32_xpi_destdir)/plugins/"
120
	cp $(top_builddir)/npapi-vlc/npapi/package/npvlc.dll.manifest "$(win32_xpi_destdir)/plugins/"
121
	cp "$(top_srcdir)/extras/package/win32/libvlc.dll.manifest" "$(win32_xpi_destdir)/plugins/"
122
	rm -rf "$(win32_xpi_destdir)/plugins/plugins/gui/"
123

124 125

package-win32-xpi: package-win32-webplugin-common
126
	cp $(top_builddir)/npapi-vlc/npapi/package/install.rdf "$(win32_xpi_destdir)/"
127
	cd $(win32_xpi_destdir) && zip -r -9 "../$(WINVERSION).xpi" install.rdf plugins
128

129

130
package-win32-crx: package-win32-webplugin-common
131
	cp $(top_builddir)/npapi-vlc/npapi/package/manifest.json "$(win32_xpi_destdir)/"
132
	crxmake --pack-extension "$(win32_xpi_destdir)" \
133
		--extension-output "$(win32_destdir)/$(WINVERSION).crx" --ignore-file install.rdf
134

135

136
# nsis is a 32-bits installer, we need to build a 32bits DLL
137
$(win32_destdir)/NSIS/UAC.dll: extras/package/win32/NSIS/UAC/runas.cpp extras/package/win32/NSIS/UAC/uac.cpp
138 139
	mkdir -p "$(win32_destdir)/NSIS/"
if HAVE_WIN64
140
	i686-w64-mingw32-g++ $^ -shared -o $@ -lole32 -static-libstdc++ -static-libgcc
141 142
	i686-w64-mingw32-strip $@
else
143
	$(CXX) $^ -D_WIN32_IE=0x0601 -D__forceinline=inline -shared -o $@ -lole32 -static-libstdc++ -static-libgcc
144 145
	$(STRIP) $@
endif
146 147 148 149 150 151 152 153 154
$(win32_destdir)/NSIS/nsProcess.dll: extras/package/win32/NSIS/nsProcess/nsProcess.c extras/package/win32/NSIS/nsProcess/pluginapi.c
	mkdir -p "$(win32_destdir)/NSIS/"
if HAVE_WIN64
	i686-w64-mingw32-gcc $^ -shared -o $@ -lole32 -static-libgcc
	i686-w64-mingw32-strip $@
else
	$(CC) $^ -D_WIN32_IE=0x0601 -shared -o $@ -lole32 -static-libgcc
	$(STRIP) $@
endif
155 156


157
package-win32-exe: package-win-strip $(win32_destdir)/NSIS/UAC.dll $(win32_destdir)/NSIS/nsProcess.dll extras/package/win32/NSIS/vlc.win32.nsi
158
# Script installer
159 160
	cp    $(top_builddir)/extras/package/win32/NSIS/vlc.win32.nsi "$(win32_destdir)/"
	cp    $(top_builddir)/extras/package/win32/NSIS/spad.nsi      "$(win32_destdir)/"
161 162
	cp -r $(srcdir)/extras/package/win32/NSIS/languages    "$(win32_destdir)/"
	cp -r $(srcdir)/extras/package/win32/NSIS/helpers      "$(win32_destdir)/"
163
	mkdir -p "$(win32_destdir)/NSIS/"
164
	cp "$(top_srcdir)/extras/package/win32/NSIS/UAC.nsh" "$(win32_destdir)/NSIS/"
165
	cp "$(top_srcdir)/extras/package/win32/NSIS/nsProcess.nsh" "$(win32_destdir)/NSIS/"
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180

# Create package
	if makensis -VERSION >/dev/null 2>&1; then \
	    MAKENSIS="makensis"; \
	elif [ -x "/cygdrive/c/Program Files/NSIS/makensis" ]; then \
	    MAKENSIS="/cygdrive/c/Program\ Files/NSIS/makensis"; \
	elif [ -x "$(PROGRAMFILES)/NSIS/makensis" ]; then \
	    MAKENSIS="$(PROGRAMFILES)/NSIS/makensis"; \
	elif wine --version >/dev/null 2>&1; then \
	    MAKENSIS="wine C:/Program\ Files/NSIS/makensis.exe"; \
	else \
	    echo 'Error: cannot locate makensis tool'; exit 1; \
	fi; \
	eval "$$MAKENSIS $(win32_destdir)/spad.nsi"; \
	eval "$$MAKENSIS $(win32_destdir)/vlc.win32.nsi"
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
181
	if test -n "$(SIGNATURE)"; then \
182
		osslsigncode sign -certs $(SIGNATURE)/cert.cer -key $(SIGNATURE)/videolan.key -n "VLC media player" -i http://www.videolan.org/ -t http://timestamp.verisign.com/scripts/timstamp.dll -in "$(WINVERSION).exe" -out "$(WINVERSION).exe.sign"; \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
183 184
	    mv "$(WINVERSION).exe.sign" "$(WINVERSION).exe" ; \
	fi
185 186

package-win32-zip: package-win-strip
187
	rm -f -- $(WINVERSION).zip
188
	zip -r -9 $(WINVERSION).zip vlc-$(VERSION) --exclude \*.nsi \*NSIS\* \*languages\* \*sdk\* \*helpers\* spad\*
189 190

package-win32-debug-zip: package-win-common
191 192
	rm -f -- $(WINVERSION)-debug.zip
	zip -r -9 $(WINVERSION)-debug.zip vlc-$(VERSION)
193 194

package-win32-7zip: package-win-strip
195
	7z a $(7Z_OPTS) $(WINVERSION).7z vlc-$(VERSION)
196 197

package-win32-debug-7zip: package-win-common
198
	7z a $(7Z_OPTS) $(WINVERSION)-debug.7z vlc-$(VERSION)
199 200

package-win32-cleanup:
201
	rm -Rf $(win32_destdir) $(win32_debugdir) $(win32_xpi_destdir)
202 203 204 205 206 207 208 209 210 211 212 213 214 215

package-win32: package-win32-zip package-win32-7zip package-win32-exe package-win32-xpi

package-win32-debug: package-win32-debug-zip package-win32-debug-7zip


#######
# WinCE
#######
package-wince: package-win-strip
	rm -f -- vlc-$(VERSION)-wince.zip
	zip -r -9 vlc-$(VERSION)-wince.zip vlc-$(VERSION)

.PHONY: package-win-install package-win-common package-win-strip package-win32-webplugin-common package-win32-xpi package-win32-crx package-win32-exe package-win32-zip package-win32-debug-zip package-win32-7zip package-win32-debug-7zip package-win32-cleanup package-win32 package-win32-debug package-wince