2
# ***** BEGIN LICENSE BLOCK *****
3
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
# The contents of this file are subject to the Mozilla Public License Version
6
# 1.1 (the "License"); you may not use this file except in compliance with
7
# the License. You may obtain a copy of the License at
8
# http://www.mozilla.org/MPL/
10
# Software distributed under the License is distributed on an "AS IS" basis,
11
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
# for the specific language governing rights and limitations under the
15
# The Original Code is Mozilla Communicator client code, released
18
# The Initial Developer of the Original Code is
19
# Netscape Communications Corporation.
20
# Portions created by the Initial Developer are Copyright (C) 1998
21
# the Initial Developer. All Rights Reserved.
25
# Alternatively, the contents of this file may be used under the terms of
26
# either of the GNU General Public License Version 2 or later (the "GPL"),
27
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
# in which case the provisions of the GPL or the LGPL are applicable instead
29
# of those above. If you wish to allow use of your version of this file only
30
# under the terms of either the GPL or the LGPL, and not to allow others to
31
# use your version of this file under the terms of the MPL, indicate your
32
# decision by deleting the provisions above and replace them with the notice
33
# and other provisions required by the GPL or the LGPL. If you do not delete
34
# the provisions above, a recipient may use your version of this file under
35
# the terms of any one of the MPL, the GPL or the LGPL.
37
# ***** END LICENSE BLOCK *****
40
topsrcdir = @top_srcdir@
44
include $(DEPTH)/config/autoconf.mk
47
# This is how we create the Unix binary packages we release to the public.
48
# Currently the only format is tar.gz (TGZ), but it should be fairly easy
49
# to add .rpm (RPM) and .deb (DEB) later.
52
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
55
ifeq (,$(filter-out OS2 WINNT, $(OS_ARCH)))
57
INSTALLER_DIR = windows
59
ifeq (,$(filter-out SunOS, $(OS_ARCH)))
67
endif # MOZ_PKG_FORMAT
68
ifndef MOZ_PKG_APPNAME
69
MOZ_PKG_APPNAME = $(MOZ_APP_NAME)
71
ifndef SDK_PKG_APPNAME
72
SDK_PKG_APPNAME = gecko
75
MAKE_PACKAGE = echo "Sorry, don't know how to build a $(MOZ_PKG_FORMAT) file yet...."
78
PKG_BASENAME := $(MOZ_PKG_APPNAME)-$(TARGET_CPU)-$(TARGET_VENDOR)-$(TARGET_OS)
79
PACKAGE = $(PKG_BASENAME)$(PKG_SUFFIX)
82
SDK = $(SDK_PKG_APPNAME)-$(SDK_DIR)-$(TARGET_CPU)-$(TARGET_VENDOR)-$(TARGET_OS)$(PKG_SUFFIX)
84
TAR_CREATE_FLAGS = -cvhf
86
ifeq ($(OS_ARCH),BSD_OS)
87
TAR_CREATE_FLAGS = -cvLf
90
CREATE_FINAL_TAR = tar -c --owner=0 --group=0 --numeric-owner --mode="go-w" -f
92
ifeq ($(MOZ_PKG_FORMAT),TAR)
94
MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_APPNAME) > $(PACKAGE)
95
MAKE_SDK = $(CREATE_FINAL_TAR) - $(SDK_PKG_APPNAME)-$(SDK_DIR) > $(SDK)
97
ifeq ($(MOZ_PKG_FORMAT),TGZ)
99
MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_APPNAME) | gzip -vf9 > $(PACKAGE)
100
MAKE_SDK = $(CREATE_FINAL_TAR) - $(SDK_PKG_APPNAME)-$(SDK_DIR) | gzip -vf9 > $(SDK)
102
ifeq ($(MOZ_PKG_FORMAT),BZ2)
103
PKG_SUFFIX = .tar.bz2
104
MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_APPNAME) | bzip2 -vf > $(PACKAGE)
105
MAKE_SDK = $(CREATE_FINAL_TAR) - $(SDK_PKG_APPNAME)-$(SDK_DIR) | bzip2 -vf > $(SDK)
107
ifeq ($(MOZ_PKG_FORMAT),ZIP)
109
MAKE_PACKAGE = $(ZIP) -r9D $(PACKAGE) $(MOZ_PKG_APPNAME)
110
MAKE_SDK = $(ZIP) -r9D $(SDK) $(SDK_PKG_APPNAME)-$(SDK_DIR)
112
ifeq ($(MOZ_PKG_FORMAT),DMG)
113
ifndef MOZ_PKG_APPNAME
114
MOZ_PKG_APPNAME = Mozilla
117
_APPNAME = $(MOZ_PKG_APPNAME)Debug.app
119
_APPNAME = $(MOZ_PKG_APPNAME).app
122
_ABS_TOPSRCDIR = $(shell cd $(topsrcdir) && pwd)
123
MAKE_PACKAGE = $(_ABS_TOPSRCDIR)/build/package/mac_osx/make-diskimage $(PKG_BASENAME).dmg $(MOZ_PKG_APPNAME) $(MOZ_PKG_APPNAME) && gzip -vf9 $(PKG_BASENAME).dmg
126
ifeq ($(MOZ_PKG_FORMAT),RPM)
129
ifeq ($(MOZ_PKG_FORMAT),DEB)
133
# dummy macro if we don't have PSM built
137
SIGN_NSS = @echo signing nss libraries;
139
SIGN_ENV = LD_LIBRARY_PATH=$(DIST)/bin:${LD_LIBRARY_PATH} \
140
LD_LIBRARYN32_PATH=$(DIST)/bin:${LD_LIBRARYN32_PATH} \
141
LD_LIBRARYN64_PATH=$(DIST)/bin:${LD_LIBRARYN64_PATH} \
142
LD_LIBRARY_PATH_64=$(DIST)/bin:${LD_LIBRARY_PATH_64} \
143
SHLIB_PATH=$(DIST)/bin:${SHLIB_PATH} LIBPATH=$(DIST)/bin:${LIBPATH} \
144
DYLD_LIBRARY_PATH=$(DIST)/bin:${DYLD_LIBRARY_PATH} \
145
LIBRARY_PATH=$(DIST)/bin:${LIBRARY_PATH}
147
SIGN_CMD = cd $(DIST)/$(MOZ_PKG_APPNAME) && $(SIGN_ENV) $(DIST)/bin/shlibsign -v -i
149
SOFTOKN = $(DIST)/$(MOZ_PKG_APPNAME)/$(DLL_PREFIX)softokn3$(DLL_SUFFIX)
150
FREEBL_HYBRID = $(DIST)/$(MOZ_PKG_APPNAME)/$(DLL_PREFIX)freebl_hybrid_3$(DLL_SUFFIX)
151
FREEBL_PURE = $(DIST)/$(MOZ_PKG_APPNAME)/$(DLL_PREFIX)freebl_pure32_3$(DLL_SUFFIX)
153
SIGN_NSS += $(SIGN_CMD) $(SOFTOKN); \
154
if test -f $(FREEBL_HYBRID); then $(SIGN_CMD) $(FREEBL_HYBRID); fi; \
155
if test -f $(FREEBL_PURE); then $(SIGN_CMD) $(FREEBL_PURE); fi;
158
endif # !CROSS_COMPILE
160
TARGETS = $(PACKAGE) $(SDK)
162
NSPR_LDIR = $(findstring -L,$(NSPR_LIBS))
163
ifneq ($(NSPR_LDIR),)
164
NSPR_LDIR = $(subst -L,,$(word 1,$(NSPR_LIBS)))
169
$(DIST)/bin/bsdecho \
171
$(DIST)/bin/jscpucfg \
172
$(DIST)/bin/nsinstall \
178
include $(topsrcdir)/config/rules.mk
180
GARBAGE += $(DIST)/$(PACKAGE) $(PACKAGE) $(SDK)
183
ifdef USE_SHORT_LIBNAME
184
MOZILLA_BIN = $(DIST)/bin/$(MOZ_PKG_APPNAME)$(BIN_SUFFIX)
186
MOZILLA_BIN = $(DIST)/bin/$(MOZ_PKG_APPNAME)-bin
189
ifeq ($(OS_ARCH),IRIX)
192
ifeq ($(OS_ARCH),BeOS)
194
PLATFORM_EXCLUDE_LIST = ! -name "*.stub" ! -name "$(MOZ_PKG_APPNAME)-bin"
196
ifeq ($(OS_ARCH),OS2)
197
STRIP = $(srcdir)/os2/strip.cmd
200
TAR_CREATE_FLAGS = -cvf
201
PLATFORM_EXCLUDE_LIST = ! -name "*.ico"
207
@rm -rf $(DIST)/$(SDK_PKG_APPNAME)-$(SDK_DIR) $@
208
@mkdir $(DIST)/$(SDK_PKG_APPNAME)-$(SDK_DIR)
209
@cd $(DIST)/$(SDK_DIR) && tar $(TAR_CREATE_FLAGS) - * | (cd ../$(SDK_PKG_APPNAME)-$(SDK_DIR); tar -xf -)
210
cd $(DIST) && $(MAKE_SDK)
214
$(PACKAGE): $(MOZILLA_BIN)
215
@rm -rf $(DIST)/$(MOZ_PKG_APPNAME) $(DIST)/$(PKG_BASENAME).tar $@ $(EXCLUDE_LIST)
216
# NOTE: this must be a tar now that dist links into the tree so that we
217
# do not strip the binaries actually in the tree.
218
@echo "Creating package directory..."
219
@mkdir $(DIST)/$(MOZ_PKG_APPNAME)
220
ifeq ($(MOZ_PKG_FORMAT),DMG)
221
@cd $(DIST) && rsync -auvL $(_APPNAME) $(MOZ_PKG_APPNAME)
223
@cd $(DIST)/bin && tar $(TAR_CREATE_FLAGS) - * | (cd ../$(MOZ_PKG_APPNAME); tar -xf -)
224
ifdef MOZ_NATIVE_NSPR
225
ifndef EXCLUDE_NSPR_LIBS
226
@echo "Copying NSPR libs..."
227
@cp -p $(NSPR_LDIR)/*$(DLL_SUFFIX) $(DIST)/$(MOZ_PKG_APPNAME)
228
@chmod 755 $(DIST)/$(MOZ_PKG_APPNAME)/*$(DLL_SUFFIX)
232
@echo "Stripping package directory..."
233
@cd $(DIST)/$(MOZ_PKG_APPNAME); find . ! -type d \
243
! -name "*.properties" \
254
$(PLATFORM_EXCLUDE_LIST) \
255
-exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
257
ifeq (,$(filter mozilla firefox,$(MOZ_PKG_APPNAME)))
258
@echo "Creating start script $(MOZ_PKG_APPNAME)..."
259
cd $(DIST)/$(MOZ_PKG_APPNAME); if [ -f mozilla ]; then cp mozilla $(MOZ_PKG_APPNAME); fi
262
@echo "Removing unpackaged files..."
263
ifeq ($(MOZ_PKG_FORMAT),DMG)
264
cd $(DIST)/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS; rm -rf $(NO_PKG_FILES)
266
cd $(DIST)/$(MOZ_PKG_APPNAME); rm -rf $(NO_PKG_FILES)
269
@echo "Compressing..."
270
cd $(DIST); $(MAKE_PACKAGE)
274
@echo "Please define MOZ_PKG_DEST first. It must be an absolute path to a dir outside the source tree. It should be empty (files might get deleted without warning)."
275
@echo "Other options (not required):"
276
@echo "MOZ_PKG_FORMAT: Either TGZ for .tar.gz or BZ2 for .tar.bz2. Default TGZ."
277
@echo "MOZ_PKG_APPNAME: Application name, used for tarball filename, top-level dir in tarball and application start script. Default mozilla."
279
@if [ ! -d $(MOZ_PKG_DEST) ]; then mkdir $(MOZ_PKG_DEST); fi
280
@cd $(MOZ_PKG_DEST); rm -rf bin $(MOZ_PKG_APPNAME) $(PACKAGE)
281
@echo "Creating distribution tarball in $(MOZ_PKG_DEST)..."
282
$(PERL) $(srcdir)/pkgcp.pl --source $(DEPTH)/dist --destination $(MOZ_PKG_DEST) --file $(srcdir)/packages-$(OSPACKAGE) --os $(OSPACKAGE) --flat
283
@cd $(MOZ_PKG_DEST); mv bin $(MOZ_PKG_APPNAME)
284
ifneq ($(MOZ_PKG_APPNAME),mozilla)
285
@echo "Creating start script $(MOZ_PKG_APPNAME)..."
286
cd $(MOZ_PKG_DEST)/$(MOZ_PKG_APPNAME); cp mozilla $(MOZ_PKG_APPNAME)
288
@echo "Compressing..."
289
cd $(MOZ_PKG_DEST); $(MAKE_PACKAGE)
290
@echo "Deleting work files..."
291
@cd $(MOZ_PKG_DEST); rm -rf $(MOZ_PKG_APPNAME)
292
@echo "Done creating $(PACKAGE)."
297
make -C $(INSTALLER_DIR) installer