]> git.sesse.net Git - vlc/blob - extras/package/win32/package.mak
win64 package: use -win64 version string
[vlc] / extras / package / win32 / package.mak
1 if HAVE_WIN32
2 BUILT_SOURCES_distclean += \
3         extras/package/win32/vlc.win32.nsi extras/package/win32/spad.nsi
4 endif
5
6 win32_destdir=$(abs_top_builddir)/vlc-$(VERSION)
7 win32_debugdir=$(abs_top_builddir)/symbols-$(VERSION)
8 win32_xpi_destdir=$(win32_destdir)/vlc-plugin
9
10 7Z_OPTS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on
11
12
13 if HAVE_WINCE
14 build-npapi:
15         touch $@
16 else
17 if HAVE_WIN32
18 include extras/package/npapi.am
19 endif
20 endif
21
22 if HAVE_WIN64
23 WINVERSION=vlc-$(VERSION)-win64
24 else
25 WINVERSION=vlc-$(VERSION)-win32
26 endif
27
28 package-win-install:
29         $(MAKE) install
30         touch $@
31
32
33 package-win-common: package-win-install build-npapi
34         mkdir -p "$(win32_destdir)"/
35
36 # Executables, major libs+manifests
37         find $(prefix) -maxdepth 4 \( -name "*$(LIBEXT)" -o -name "*$(EXEEXT)" \) -exec cp {} "$(win32_destdir)/" \;
38         cd $(top_srcdir)/extras/package/win32 && cp vlc$(EXEEXT).manifest libvlc$(LIBEXT).manifest "$(win32_destdir)/"
39
40 # Text files, clean them from mail addresses
41         for file in AUTHORS THANKS ; \
42                 do sed 's/@/_AT_/' < "$(srcdir)/$$file" > "$(win32_destdir)/$${file}.txt"; \
43         done
44         for file in NEWS COPYING README; \
45                 do cp "$(srcdir)/$$file" "$(win32_destdir)/$${file}.txt"; \
46         done
47
48         cp $(srcdir)/share/icons/vlc.ico $(win32_destdir)
49         cp -r $(prefix)/lib/vlc/plugins $(win32_destdir)
50         -cp -r $(prefix)/share/locale $(win32_destdir)
51
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 endif
56
57 if BUILD_SKINS
58         rm -fr $(win32_destdir)/skins
59         cp -r $(prefix)/share/vlc/skins2 $(win32_destdir)/skins
60 endif
61
62 if BUILD_OSDMENU
63         cp -r $(prefix)/share/vlc/osdmenu "$(win32_destdir)/"
64         for file in $(win32_destdir)/osdmenu/*.cfg; do \
65                 sed -i.orig -e 's%share/osdmenu%osdmenu%g' -e 's%/%\\%g' "$$file"; \
66                 rm -f -- "$${file}.orig"; \
67         done
68 endif
69
70 if !HAVE_WINCE
71 if !HAVE_WIN64
72         cp "$(top_builddir)/npapi-vlc/activex/axvlc.dll.manifest" "$(win32_destdir)/"
73         cp "$(top_builddir)/npapi-vlc/installed/lib/axvlc.dll" "$(win32_destdir)/"
74 endif
75         cp "$(top_builddir)/npapi-vlc/npapi/npvlc.dll.manifest" "$(win32_destdir)/"
76         cp "$(top_builddir)/npapi-vlc/installed/lib/npvlc.dll" "$(win32_destdir)/"
77 endif
78
79 # Compiler shared DLLs, when using compilers built with --enable-shared
80 # If gcc_s_sjlj/stdc++-6 DLLs exist, our C++ modules were linked to them
81         gcc_lib_dir=`$(CXX) -v /dev/null 2>&1 | grep ^LIBRARY_PATH|cut -d= -f2|cut -d: -f1` ; \
82         cp "$${gcc_lib_dir}/libstdc++-6.dll" "$${gcc_lib_dir}/libgcc_s_sjlj-1.dll" "$(win32_destdir)/" ; true
83
84 # SDK
85         mkdir -p "$(win32_destdir)/sdk/lib/"
86         cp -r $(prefix)/include "$(win32_destdir)/sdk"
87         cp -r $(prefix)/lib/pkgconfig "$(win32_destdir)/sdk/lib"
88         cd $(prefix)/lib && cp -rv libvlc.dll.a libvlc.la libvlccore.dll.a libvlccore.la "$(win32_destdir)/sdk/lib/"
89 if !HAVE_WINCE
90         $(DLLTOOL) -D libvlc.dll -l "$(win32_destdir)/sdk/lib/libvlc.lib" -d "$(top_builddir)/lib/.libs/libvlc.dll.def" "$(prefix)/bin/libvlc.dll"
91         $(DLLTOOL) -D libvlccore.dll -l "$(win32_destdir)/sdk/lib/libvlccore.lib" -d "$(top_builddir)/src/.libs/libvlccore.dll.def" "$(prefix)/bin/libvlccore.dll"
92
93 if !HAVE_WIN64
94         mkdir -p "$(win32_destdir)/sdk/activex/"
95         cd $(top_builddir)/npapi-vlc && cp activex/README.TXT share/test.html $(win32_destdir)/sdk/activex/
96 endif
97 endif
98
99 # Convert to DOS line endings
100         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) {} \;
101
102 # Enable DEP and ASLR for all the binaries
103         find $(win32_destdir) -type f \( -name '*$(LIBEXT)' -print -o -name '*$(EXEEXT)' -print \) -exec $(top_srcdir)/extras/package/win32/peflags.pl {} \;
104
105 # Remove cruft
106         find $(win32_destdir)/plugins/ -type f \( -name '*.a' -or -name '*.la' \) -exec rm -rvf {} \;
107
108
109 package-win-strip: package-win-common
110         mkdir -p "$(win32_debugdir)"/
111         cd $(win32_destdir); find . -type f \( -name '*$(LIBEXT)' -or -name '*$(EXEEXT)' \) | while read i; \
112         do if test -n "$$i" ; then \
113             $(OBJCOPY) --only-keep-debug "$$i" "$(win32_debugdir)/`basename $$i.dbg`"; \
114             $(OBJCOPY) --strip-all "$$i" ; \
115             $(OBJCOPY) --add-gnu-debuglink="$(win32_debugdir)/`basename $$i.dbg`" "$$i" ; \
116           fi ; \
117         done
118
119
120 package-win32-webplugin-common: package-win-strip
121         mkdir -p "$(win32_xpi_destdir)/"
122         cp -r $(win32_destdir)/plugins/ "$(win32_xpi_destdir)/"
123         find $(prefix) -maxdepth 4 -name "*$(LIBEXT)" -exec cp {} "$(win32_xpi_destdir)/" \;
124         cp $(top_builddir)/npapi-vlc/npapi/npvlc.dll.manifest "$(win32_xpi_destdir)/plugins/"
125         cp "$(top_srcdir)/extras/package/win32/libvlc.dll.manifest" "$(win32_xpi_destdir)/plugins/"
126         rm -rf "$(win32_xpi_destdir)/plugins/*qt*"
127         rm -rf "$(win32_xpi_destdir)/plugins/*skins*"
128
129
130 package-win32-xpi: package-win32-webplugin-common
131         cp $(top_builddir)/npapi-vlc/npapi/install.rdf "$(win32_xpi_destdir)/"
132         cd $(win32_xpi_destdir) && zip -r "../vlc-$(VERSION).xpi" install.rdf plugins
133
134
135 package-win32-crx: package-win32-webplugin-common
136         cp $(top_builddir)/npapi-vlc/npapi/manifest.json "$(win32_xpi_destdir)/"
137         crxmake --pack-extension "$(win32_xpi_destdir)" \
138                 --extension-output "$(win32_destdir)/vlc-$(VERSION).crx" --ignore-file install.rdf
139
140
141 package-win32-exe: package-win-strip
142 # Script installer
143         cd "$(top_builddir)/extras/package/win32" && cp vlc.win32.nsi spad.nsi "$(win32_destdir)/"
144         cp -r $(srcdir)/extras/package/win32/languages/ "$(win32_destdir)/"
145         mkdir -p "$(win32_destdir)/NSIS/"
146         cd "$(top_srcdir)/extras/package/win32/" && cp UAC.dll UAC.nsh "$(win32_destdir)/NSIS"
147
148 # Create package
149         if makensis -VERSION >/dev/null 2>&1; then \
150             MAKENSIS="makensis"; \
151         elif [ -x "/cygdrive/c/Program Files/NSIS/makensis" ]; then \
152             MAKENSIS="/cygdrive/c/Program\ Files/NSIS/makensis"; \
153         elif [ -x "$(PROGRAMFILES)/NSIS/makensis" ]; then \
154             MAKENSIS="$(PROGRAMFILES)/NSIS/makensis"; \
155         elif wine --version >/dev/null 2>&1; then \
156             MAKENSIS="wine C:/Program\ Files/NSIS/makensis.exe"; \
157         else \
158             echo 'Error: cannot locate makensis tool'; exit 1; \
159         fi; \
160         eval "$$MAKENSIS $(win32_destdir)/spad.nsi"; \
161         eval "$$MAKENSIS $(win32_destdir)/vlc.win32.nsi"
162
163 package-win32-zip: package-win-strip
164         rm -f -- $(WINVERSION).zip
165         zip -r -9 $(WINVERSION).zip vlc-$(VERSION)
166
167 package-win32-debug-zip: package-win-common
168         rm -f -- $(WINVERSION)-debug.zip
169         zip -r -9 $(WINVERSION)-debug.zip vlc-$(VERSION)
170
171 package-win32-7zip: package-win-strip
172         7z a $(7Z_OPTS) $(WINVERSION).7z vlc-$(VERSION)
173
174 package-win32-debug-7zip: package-win-common
175         7z a $(7Z_OPTS) $(WINVERSION)-debug.7z vlc-$(VERSION)
176
177 package-win32-cleanup:
178         rm -Rf $(win32_destdir) $(win32_debugdir) $(win32_xpi_destdir)
179
180 package-win32: package-win32-zip package-win32-7zip package-win32-exe package-win32-xpi
181
182 package-win32-debug: package-win32-debug-zip package-win32-debug-7zip
183
184
185 #######
186 # WinCE
187 #######
188 package-wince: package-win-strip
189         rm -f -- vlc-$(VERSION)-wince.zip
190         zip -r -9 vlc-$(VERSION)-wince.zip vlc-$(VERSION)
191
192 .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