Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / toolkit / mozapps / installer / packager.mk
blob54e9138ab7b85303c9b0062524df3d8a12470df7
1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
12 # License.
14 # The Original Code is Mozilla Communicator client code, released
15 # March 31, 1998.
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1998
20 # the Initial Developer. All Rights Reserved.
22 # Contributor(s):
23 # Benjamin Smedberg <bsmedberg@covad.net>
24 # Arthur Wiebe <artooro@gmail.com>
25 # Mark Mentovai <mark@moxienet.com>
27 # Alternatively, the contents of this file may be used under the terms of
28 # either of the GNU General Public License Version 2 or later (the "GPL"),
29 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
39 # ***** END LICENSE BLOCK *****
41 include $(MOZILLA_DIR)/toolkit/mozapps/installer/package-name.mk
43 # This is how we create the Unix binary packages we release to the public.
44 # Currently the only format is tar.gz (TGZ), but it should be fairly easy
45 # to add .rpm (RPM) and .deb (DEB) later.
47 ifndef MOZ_PKG_FORMAT
48 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
49 MOZ_PKG_FORMAT = DMG
50 else
51 ifeq (,$(filter-out OS2 WINNT BeOS, $(OS_ARCH)))
52 MOZ_PKG_FORMAT = ZIP
53 ifeq ($(OS_ARCH),OS2)
54 INSTALLER_DIR = os2
55 else
56 ifeq ($(OS_ARCH), WINNT)
57 INSTALLER_DIR = windows
58 endif
59 endif
60 else
61 ifeq (,$(filter-out SunOS, $(OS_ARCH)))
62 MOZ_PKG_FORMAT = BZ2
63 else
64 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
65 MOZ_PKG_FORMAT = BZ2
66 else
67 MOZ_PKG_FORMAT = TGZ
68 endif
69 endif
70 INSTALLER_DIR = unix
71 endif
72 endif
73 endif # MOZ_PKG_FORMAT
75 PACKAGE = $(PKG_PATH)$(PKG_BASENAME)$(PKG_SUFFIX)
77 MOZ_PKG_DIR = $(MOZ_APP_NAME)
79 # By default, the SDK uses the same packaging type as the main bundle,
80 # but on mac it is a .tar.bz2
81 SDK_SUFFIX = $(PKG_SUFFIX)
82 SDK = $(PKG_PATH)$(PKG_BASENAME).sdk$(SDK_SUFFIX)
84 MAKE_PACKAGE = $(error What is a $(MOZ_PKG_FORMAT) package format?);
86 CREATE_FINAL_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
87 --mode="go-w" -f
88 UNPACK_TAR = tar -x
90 ifeq ($(MOZ_PKG_FORMAT),TAR)
91 PKG_SUFFIX = .tar
92 MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) > $(PACKAGE)
93 UNMAKE_PACKAGE = $(UNPACK_TAR) < $(UNPACKAGE)
94 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk > $(SDK)
95 endif
96 ifeq ($(MOZ_PKG_FORMAT),TGZ)
97 PKG_SUFFIX = .tar.gz
98 MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) | gzip -vf9 > $(PACKAGE)
99 UNMAKE_PACKAGE = gunzip -c $(UNPACKAGE) | $(UNPACK_TAR)
100 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | gzip -vf9 > $(SDK)
101 endif
102 ifeq ($(MOZ_PKG_FORMAT),BZ2)
103 PKG_SUFFIX = .tar.bz2
104 MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) | bzip2 -vf > $(PACKAGE)
105 UNMAKE_PACKAGE = bunzip2 -c $(UNPACKAGE) | $(UNPACK_TAR)
106 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
107 endif
108 ifeq ($(MOZ_PKG_FORMAT),ZIP)
109 PKG_SUFFIX = .zip
110 MAKE_PACKAGE = $(ZIP) -r9D $(PACKAGE) $(MOZ_PKG_DIR)
111 UNMAKE_PACKAGE = $(UNZIP) $(UNPACKAGE)
112 MAKE_SDK = $(ZIP) -r9D $(SDK) $(MOZ_APP_NAME)-sdk
113 endif
114 ifeq ($(MOZ_PKG_FORMAT),DMG)
115 ifndef _APPNAME
116 ifdef MOZ_DEBUG
117 _APPNAME = $(MOZ_APP_DISPLAYNAME)Debug.app
118 else
119 _APPNAME = $(MOZ_APP_DISPLAYNAME).app
120 endif
121 endif
122 ifndef _BINPATH
123 _BINPATH = /$(_APPNAME)/Contents/MacOS
124 endif # _BINPATH
125 PKG_SUFFIX = .dmg
126 PKG_DMG_FLAGS =
127 ifneq (,$(MOZ_PKG_MAC_DSSTORE))
128 PKG_DMG_FLAGS += --copy "$(MOZ_PKG_MAC_DSSTORE):/.DS_Store"
129 endif
130 ifneq (,$(MOZ_PKG_MAC_BACKGROUND))
131 PKG_DMG_FLAGS += --mkdir /.background --copy "$(MOZ_PKG_MAC_BACKGROUND):/.background"
132 endif
133 ifneq (,$(MOZ_PKG_MAC_ICON))
134 PKG_DMG_FLAGS += --icon "$(MOZ_PKG_MAC_ICON)"
135 endif
136 ifneq (,$(MOZ_PKG_MAC_RSRC))
137 PKG_DMG_FLAGS += --resource "$(MOZ_PKG_MAC_RSRC)"
138 endif
139 ifneq (,$(MOZ_PKG_MAC_EXTRA))
140 PKG_DMG_FLAGS += $(MOZ_PKG_MAC_EXTRA)
141 endif
142 _ABS_MOZSRCDIR = $(shell cd $(MOZILLA_DIR) && pwd)
143 ifdef UNIVERSAL_BINARY
144 STAGEPATH = universal/
145 endif
146 ifndef PKG_DMG_SOURCE
147 PKG_DMG_SOURCE = $(STAGEPATH)$(MOZ_PKG_DIR)
148 endif
149 MAKE_PACKAGE = $(_ABS_MOZSRCDIR)/build/package/mac_osx/pkg-dmg \
150 --source "$(PKG_DMG_SOURCE)" --target "$(PACKAGE)" \
151 --volname "$(MOZ_APP_DISPLAYNAME)" $(PKG_DMG_FLAGS)
152 UNMAKE_PACKAGE = \
153 set -ex; \
154 function cleanup() { \
155 hdiutil detach $${DEV_NAME} || \
156 { sleep 5 && hdiutil detach $${DEV_NAME} -force; }; \
157 return $$1 && $$?; \
158 }; \
159 unset NEXT_ROOT; \
160 export PAGER=true; \
161 expect $(_ABS_MOZSRCDIR)/build/package/mac_osx/installdmg.ex $(UNPACKAGE) > hdi.output; \
162 DEV_NAME=`perl -n -e 'if($$_=~/(\/dev\/disk[^ ]*)/) {print $$1."\n";exit;}'< hdi.output`; \
163 MOUNTPOINT=`perl -n -e 'split(/\/dev\/disk[^ ]*/,$$_,2);if($$_[1]=~/(\/.[^\r]*)/) {print $$1;exit;}'< hdi.output` || cleanup 1; \
164 rsync -a "$${MOUNTPOINT}/$(_APPNAME)" $(MOZ_PKG_DIR) || cleanup 1; \
165 test -n "$(MOZ_PKG_MAC_DSSTORE)" && \
166 { rsync -a "$${MOUNTPOINT}/.DS_Store" "$(MOZ_PKG_MAC_DSSTORE)" || cleanup 1; }; \
167 test -n "$(MOZ_PKG_MAC_BACKGROUND)" && \
168 { rsync -a "$${MOUNTPOINT}/.background/`basename "$(MOZ_PKG_MAC_BACKGROUND)"`" "$(MOZ_PKG_MAC_BACKGROUND)" || cleanup 1; }; \
169 test -n "$(MOZ_PKG_MAC_ICON)" && \
170 { rsync -a "$${MOUNTPOINT}/.VolumeIcon.icns" "$(MOZ_PKG_MAC_ICON)" || cleanup 1; }; \
171 cleanup 0; \
172 if test -n "$(MOZ_PKG_MAC_RSRC)" ; then \
173 cp $(UNPACKAGE) $(MOZ_PKG_APPNAME).tmp.dmg && \
174 hdiutil unflatten $(MOZ_PKG_APPNAME).tmp.dmg && \
175 { /Developer/Tools/DeRez -skip plst -skip blkx $(MOZ_PKG_APPNAME).tmp.dmg > "$(MOZ_PKG_MAC_RSRC)" || { rm -f $(MOZ_PKG_APPNAME).tmp.dmg && false; }; } && \
176 rm -f $(MOZ_PKG_APPNAME).tmp.dmg; \
177 fi; \
178 $(NULL)
179 # The plst and blkx resources are skipped because they belong to each
180 # individual dmg and are created by hdiutil.
181 SDK_SUFFIX = .tar.bz2
182 SDK = $(MOZ_PKG_APPNAME)-$(MOZ_PKG_VERSION).$(AB_CD).mac-$(TARGET_CPU).sdk$(SDK_SUFFIX)
183 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
184 endif
186 # dummy macro if we don't have PSM built
187 SIGN_NSS =
188 ifneq (1_,$(if $(CROSS_COMPILE),1,0)_$(UNIVERSAL_BINARY))
189 ifdef MOZ_PSM
190 SIGN_NSS = @echo signing nss libraries;
192 NSS_DLL_SUFFIX = $(DLL_SUFFIX)
193 ifdef UNIVERSAL_BINARY
194 NATIVE_ARCH = $(shell uname -p | sed -e s/powerpc/ppc/)
195 NATIVE_DIST = $(DIST:$(DEPTH)/%=$(DEPTH)/../$(NATIVE_ARCH)/%)
196 SIGN_CMD = $(NATIVE_DIST)/bin/run-mozilla.sh $(NATIVE_DIST)/bin/shlibsign -v -i
197 else
198 ifeq ($(OS_ARCH),OS2)
199 # uppercase extension to get the correct output file from shlibsign
200 NSS_DLL_SUFFIX = .DLL
201 SIGN_CMD = $(MOZILLA_DIR)/toolkit/mozapps/installer/os2/sign.cmd $(DIST)
202 else
203 SIGN_CMD = $(RUN_TEST_PROGRAM) $(DIST)/bin/shlibsign -v -i
204 endif
205 endif
207 SOFTOKN = $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)softokn3$(NSS_DLL_SUFFIX)
208 FREEBL = $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl3$(NSS_DLL_SUFFIX)
209 FREEBL_32FPU = $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl_32fpu_3$(DLL_SUFFIX)
210 FREEBL_32INT = $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl_32int_3$(DLL_SUFFIX)
211 FREEBL_32INT64 = $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl_32int64_3$(DLL_SUFFIX)
212 FREEBL_64FPU = $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl_64fpu_3$(DLL_SUFFIX)
213 FREEBL_64INT = $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(DLL_PREFIX)freebl_64int_3$(DLL_SUFFIX)
215 SIGN_NSS += $(SIGN_CMD) $(SOFTOKN); \
216 if test -f $(FREEBL); then $(SIGN_CMD) $(FREEBL); fi; \
217 if test -f $(FREEBL_32FPU); then $(SIGN_CMD) $(FREEBL_32FPU); fi; \
218 if test -f $(FREEBL_32INT); then $(SIGN_CMD) $(FREEBL_32INT); fi; \
219 if test -f $(FREEBL_32INT64); then $(SIGN_CMD) $(FREEBL_32INT64); fi; \
220 if test -f $(FREEBL_64FPU); then $(SIGN_CMD) $(FREEBL_64FPU); fi; \
221 if test -f $(FREEBL_64INT); then $(SIGN_CMD) $(FREEBL_64INT); fi;
223 endif # MOZ_PSM
224 endif # !CROSS_COMPILE
226 NO_PKG_FILES += \
227 core \
228 bsdecho \
229 gtscc \
230 js-config \
231 jscpucfg \
232 nsinstall \
233 viewer \
234 TestGtkEmbed \
235 bloaturls.txt \
236 codesighs* \
237 elf-dynstr-gc \
238 mangle* \
239 maptsv* \
240 mfc* \
241 mkdepend* \
242 msdump* \
243 msmap* \
244 nm2tsv* \
245 nsinstall* \
246 rebasedlls* \
247 res/samples \
248 res/throbber \
249 shlibsign* \
250 ssltunnel* \
251 certutil* \
252 pk12util* \
253 winEmbed.exe \
254 os2Embed.exe \
255 chrome/chrome.rdf \
256 chrome/app-chrome.manifest \
257 chrome/overlayinfo \
258 components/compreg.dat \
259 components/xpti.dat \
260 content_unit_tests \
261 necko_unit_tests \
262 *.dSYM \
263 $(NULL)
265 # browser/locales/Makefile uses this makefile for its variable defs, but
266 # doesn't want the libs:: rule.
267 ifndef PACKAGER_NO_LIBS
268 libs:: make-package
269 endif
271 DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX)
273 ifdef MOZ_PKG_REMOVALS
274 MOZ_PKG_REMOVALS_GEN = removed-files
276 $(MOZ_PKG_REMOVALS_GEN): $(MOZ_PKG_REMOVALS) $(GLOBAL_DEPS)
277 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $(MOZ_PKG_REMOVALS) > $(MOZ_PKG_REMOVALS_GEN)
279 GARBAGE += $(MOZ_PKG_REMOVALS_GEN)
280 endif
282 GARBAGE += $(DIST)/$(PACKAGE) $(PACKAGE)
284 ifeq ($(OS_ARCH),IRIX)
285 STRIP_FLAGS = -f
286 endif
287 ifeq ($(OS_ARCH),BeOS)
288 STRIP_FLAGS = -g
289 PLATFORM_EXCLUDE_LIST = ! -name "*.stub" ! -name "$(MOZ_PKG_APPNAME)-bin"
290 endif
291 ifeq ($(OS_ARCH),OS2)
292 STRIP = $(MOZILLA_DIR)/toolkit/mozapps/installer/os2/strip.cmd
293 STRIP_FLAGS =
294 PLATFORM_EXCLUDE_LIST = ! -name "*.ico" ! -name "$(MOZ_PKG_APPNAME).exe"
295 endif
297 ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
298 PKGCP_OS = dos
299 else
300 PKGCP_OS = unix
301 endif
303 # The following target stages files into three directories: one directory for
304 # locale-independent files, one for locale-specific files, and one for optional
305 # extensions based on the information in the MOZ_PKG_MANIFEST file and the
306 # following vars:
307 # MOZ_NONLOCALIZED_PKG_LIST
308 # MOZ_LOCALIZED_PKG_LIST
309 # MOZ_OPTIONAL_PKG_LIST
311 PKG_ARG = , "$(pkg)"
313 # Define packager macro to work around make 3.81 backslash issue (bug #339933)
314 define PACKAGER_COPY
315 $(PERL) -I$(MOZILLA_DIR)/xpinstall/packager -e 'use Packager; \
316 Packager::Copy($1,$2,$3,$4,$5,$6,$7);'
317 endef
319 installer-stage: $(MOZ_PKG_MANIFEST)
320 ifndef MOZ_PKG_MANIFEST
321 $(error MOZ_PKG_MANIFEST unspecified!)
322 endif
323 @rm -rf $(DEPTH)/installer-stage $(DIST)/xpt
324 @echo "Staging installer files..."
325 @$(NSINSTALL) -D $(DEPTH)/installer-stage/nonlocalized
326 @$(NSINSTALL) -D $(DEPTH)/installer-stage/localized
327 @$(NSINSTALL) -D $(DEPTH)/installer-stage/optional
328 @$(NSINSTALL) -D $(DIST)/xpt
329 $(call PACKAGER_COPY, "$(DIST)",\
330 "$(DEPTH)/installer-stage/nonlocalized", \
331 "$(MOZ_PKG_MANIFEST)", "$(PKGCP_OS)", 1, 0, 1 \
332 $(foreach pkg,$(MOZ_NONLOCALIZED_PKG_LIST),$(PKG_ARG)) )
333 $(call PACKAGER_COPY, "$(DIST)",\
334 "$(DEPTH)/installer-stage/localized", \
335 "$(MOZ_PKG_MANIFEST)", "$(PKGCP_OS)", 1, 0, 1 \
336 $(foreach pkg,$(MOZ_LOCALIZED_PKG_LIST),$(PKG_ARG)) )
337 ifdef MOZ_OPTIONAL_PKG_LIST
338 $(call PACKAGER_COPY, "$(DIST)",\
339 "$(DEPTH)/installer-stage/optional", \
340 "$(MOZ_PKG_MANIFEST)", "$(PKGCP_OS)", 1, 0, 1 \
341 $(foreach pkg,$(MOZ_OPTIONAL_PKG_LIST),$(PKG_ARG)) )
342 endif
343 $(PERL) $(MOZILLA_DIR)/xpinstall/packager/xptlink.pl -s $(DIST) -d $(DIST)/xpt -f $(DEPTH)/installer-stage/nonlocalized/components -v -x "$(XPIDL_LINK)"
345 stage-package: $(MOZ_PKG_MANIFEST) $(MOZ_PKG_REMOVALS_GEN)
346 @rm -rf $(DIST)/$(MOZ_PKG_DIR) $(DIST)/$(PKG_PATH)$(PKG_BASENAME).tar $(DIST)/$(PKG_PATH)$(PKG_BASENAME).dmg $@ $(EXCLUDE_LIST)
347 # NOTE: this must be a tar now that dist links into the tree so that we
348 # do not strip the binaries actually in the tree.
349 @echo "Creating package directory..."
350 @mkdir $(DIST)/$(MOZ_PKG_DIR)
351 ifdef MOZ_PKG_MANIFEST
352 $(RM) -rf $(DIST)/xpt
353 $(call PACKAGER_COPY, "$(DIST)",\
354 "$(DIST)/$(MOZ_PKG_DIR)", \
355 "$(MOZ_PKG_MANIFEST)", "$(PKGCP_OS)", 1, 0, 1)
356 $(PERL) $(MOZILLA_DIR)/xpinstall/packager/xptlink.pl -s $(DIST) -d $(DIST)/xpt -f $(DIST)/$(MOZ_PKG_DIR)/components -v -x "$(XPIDL_LINK)"
357 else # !MOZ_PKG_MANIFEST
358 ifeq ($(MOZ_PKG_FORMAT),DMG)
359 # If UNIVERSAL_BINARY, the package will be made from an already-prepared
360 # STAGEPATH
361 ifndef UNIVERSAL_BINARY
362 ifndef STAGE_SDK
363 @cd $(DIST) && rsync -auv --copy-unsafe-links $(_APPNAME) $(MOZ_PKG_DIR)
364 else
365 @cd $(DIST)/bin && tar $(TAR_CREATE_FLAGS) - * | (cd ../$(MOZ_PKG_DIR); tar -xf -)
366 endif
367 endif
368 else
369 @cd $(DIST)/bin && tar $(TAR_CREATE_FLAGS) - * | (cd ../$(MOZ_PKG_DIR); tar -xf -)
370 endif # DMG
371 endif # MOZ_PKG_MANIFEST
372 ifndef PKG_SKIP_STRIP
373 @echo "Stripping package directory..."
374 @cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR); find . ! -type d \
375 ! -name "*.js" \
376 ! -name "*.xpt" \
377 ! -name "*.gif" \
378 ! -name "*.jpg" \
379 ! -name "*.png" \
380 ! -name "*.xpm" \
381 ! -name "*.txt" \
382 ! -name "*.rdf" \
383 ! -name "*.sh" \
384 ! -name "*.properties" \
385 ! -name "*.dtd" \
386 ! -name "*.html" \
387 ! -name "*.xul" \
388 ! -name "*.css" \
389 ! -name "*.xml" \
390 ! -name "*.jar" \
391 ! -name "*.dat" \
392 ! -name "*.tbl" \
393 ! -name "*.src" \
394 ! -name "*.reg" \
395 $(PLATFORM_EXCLUDE_LIST) \
396 -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
397 $(SIGN_NSS)
398 endif
399 @echo "Removing unpackaged files..."
400 ifdef NO_PKG_FILES
401 cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH); rm -rf $(NO_PKG_FILES)
402 endif
403 ifdef MOZ_PKG_REMOVALS
404 $(SYSINSTALL) $(IFLAGS1) $(MOZ_PKG_REMOVALS_GEN) $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)
405 endif # MOZ_PKG_REMOVALS
407 make-package: stage-package
408 @echo "Compressing..."
409 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
410 cd $(DIST) && $(MAKE_PACKAGE)
412 # The install target will install the application to prefix/lib/appname-version
413 # In addition if INSTALL_SDK is set, it will install the development headers,
414 # libraries, and IDL files as follows:
415 # dist/sdk/include -> prefix/include/appname-version/stable
416 # dist/include -> prefix/include/appname-version/unstable
417 # dist/sdk/idl -> prefix/share/idl/appname-version/stable
418 # dist/idl -> prefix/share/idl/appname-version/unstable
419 # dist/sdk/lib -> prefix/lib/appname-devel-version/lib
420 # prefix/lib/appname-devel-version/* symlinks to the above directories
421 install:: stage-package
422 ifneq (,$(filter WINNT Darwin,$(OS_ARCH)))
423 $(error "make install" is not supported on this platform. Use "make package" instead.)
424 endif
425 $(NSINSTALL) -D $(DESTDIR)$(installdir)
426 (cd $(DIST)/$(MOZ_PKG_DIR) && tar $(TAR_CREATE_FLAGS) - .) | \
427 (cd $(DESTDIR)$(installdir) && tar -xf -)
428 $(NSINSTALL) -D $(DESTDIR)$(bindir)
429 $(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
430 ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
431 ifdef INSTALL_SDK # Here comes the hard part
432 # include directory is stable (dist/sdk/include) and unstable (dist/include)
433 $(NSINSTALL) -D $(DESTDIR)$(includedir)/stable
434 $(NSINSTALL) -D $(DESTDIR)$(includedir)/unstable
435 (cd $(DIST)/sdk/include && tar $(TAR_CREATE_FLAGS) - .) | \
436 (cd $(DESTDIR)$(includedir)/stable && tar -xf -)
437 # The dist/include has module subdirectories that we need to flatten
438 find $(DIST)/include -xtype f -exec $(SYSINSTALL) $(IFLAGS1) {} $(DESTDIR)$(includedir)/unstable \;
439 # IDL directory is stable (dist/sdk/idl) and unstable (dist/idl)
440 $(NSINSTALL) -D $(DESTDIR)$(idldir)/stable
441 $(NSINSTALL) -D $(DESTDIR)$(idldir)/unstable
442 (cd $(DIST)/sdk/idl && tar $(TAR_CREATE_FLAGS) - .) | \
443 (cd $(DESTDIR)$(idldir)/stable && tar -xf -)
444 (cd $(DIST)/idl && tar $(TAR_CREATE_FLAGS) - .) | \
445 (cd $(DESTDIR)$(idldir)/unstable && tar -xf -)
446 # SDK directory is the libs + a bunch of symlinks
447 $(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/lib
448 if test -f $(DIST)/sdk/include/xpcom-config.h; then \
449 $(SYSINSTALL) $(IFLAGS1) $(DIST)/sdk/include/xpcom-config.h $(DESTDIR)$(sdkdir); \
451 (cd $(DIST)/sdk/lib && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/lib && tar -xf -)
452 $(RM) -f $(DESTDIR)$(sdkdir)/lib $(DESTDIR)$(sdkdir)/bin $(DESTDIR)$(sdkdir)/sdk/include $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/sdk/idl $(DESTDIR)$(sdkdir)/idl
453 ln -s $(sdkdir)/sdk/lib $(DESTDIR)$(sdkdir)/lib
454 ln -s $(installdir) $(DESTDIR)$(sdkdir)/bin
455 ln -s $(includedir)/stable $(DESTDIR)$(sdkdir)/sdk/include
456 ln -s $(includedir)/unstable $(DESTDIR)$(sdkdir)/include
457 ln -s $(idldir)/stable $(DESTDIR)$(sdkdir)/sdk/idl
458 ln -s $(idldir)/unstable $(DESTDIR)$(sdkdir)/idl
459 endif # INSTALL_SDK
461 make-sdk:
462 $(MAKE) stage-package UNIVERSAL_BINARY= STAGE_SDK=1 MOZ_PKG_DIR=sdk-stage
463 @echo "Packaging SDK..."
464 $(RM) -rf $(DIST)/$(MOZ_APP_NAME)-sdk
465 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/bin
466 (cd $(DIST)/sdk-stage && tar $(TAR_CREATE_FLAGS) - .) | \
467 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/bin && tar -xf -)
468 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin
469 (cd $(DIST)/host/bin && tar $(TAR_CREATE_FLAGS) - .) | \
470 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin && tar -xf -)
471 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/sdk
472 (cd $(DIST)/sdk && tar $(TAR_CREATE_FLAGS) - .) | \
473 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/sdk && tar -xf -)
474 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/include
475 (cd $(DIST)/include && tar $(TAR_CREATE_FLAGS) - .) | \
476 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/include && tar -xf -)
477 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/idl
478 (cd $(DIST)/idl && tar $(TAR_CREATE_FLAGS) - .) | \
479 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/idl && tar -xf -)
480 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/lib
481 # sdk/lib is the same as sdk/sdk/lib
482 (cd $(DIST)/sdk/lib && tar $(TAR_CREATE_FLAGS) - .) | \
483 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/lib && tar -xf -)
484 cd $(DIST) && $(MAKE_SDK)
486 ifeq ($(OS_TARGET), WINNT)
487 INSTALLER_PACKAGE = $(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
488 endif
490 upload:
491 $(PYTHON) $(topsrcdir)/build/upload.py --base-path $(DIST) $(DIST)/$(PACKAGE) $(INSTALLER_PACKAGE)
493 ifndef MOZ_PKG_SRCDIR
494 MOZ_PKG_SRCDIR = $(topsrcdir)
495 endif
497 CREATE_SOURCE_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
498 --mode="go-w" --exclude=".hg*" --exclude="CVS" --exclude=".cvs*" -f
500 # source-package creates a source tarball from the files in MOZ_PKG_SRCDIR,
501 # which is either set to a clean checkout or defaults to $topsrcdir
502 source-package:
503 @echo "Packaging source tarball..."
504 (cd $(MOZ_PKG_SRCDIR) && $(CREATE_SOURCE_TAR) - .) | bzip2 -vf > $(DIST)/$(PKG_SRCPACK_PATH)$(PKG_SRCPACK_BASENAME).tar.bz2