Bug 391308 - Make the new-style SDK package, r=luser
authorbenjamin@smedbergs.us
Thu, 09 Aug 2007 12:53:08 -0700
changeset 4419 fb0a496e009f6454c7bbf11c061fcb1978be41d4
parent 4418 f22ceaf5632f063f98c6ae668c39502ed2a6b5a7
child 4420 4924101c6def0cec6c3ea23f2885223dee830552
push idunknown
push userunknown
push dateunknown
reviewersluser
bugs391308
milestone1.9a8pre
Bug 391308 - Make the new-style SDK package, r=luser
toolkit/mozapps/installer/packager.mk
xulrunner/build.mk
xulrunner/installer/Makefile.in
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -67,41 +67,50 @@ endif
 endif
 INSTALLER_DIR   = unix
 endif
 endif
 endif # MOZ_PKG_FORMAT
 
 PACKAGE       = $(PKG_BASENAME)$(PKG_SUFFIX)
 
+# By default, the SDK uses the same packaging type as the main bundle,
+# but on mac it is a .tar.bz2
+SDK_SUFFIX    = $(PKG_SUFFIX)
+SDK           = $(PKG_BASENAME).sdk$(SDK_SUFFIX)
+
 MAKE_PACKAGE	= $(error What is a $(MOZ_PKG_FORMAT) package format?);
 
 CREATE_FINAL_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
   --mode="go-w" -f
 UNPACK_TAR       = tar -x
 
 ifeq ($(MOZ_PKG_FORMAT),TAR)
 PKG_SUFFIX	= .tar
 MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - $(MOZ_PKG_APPNAME) > $(PACKAGE)
 UNMAKE_PACKAGE	= $(UNPACK_TAR) < $(UNPACKAGE)
+MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk > $(SDK)
 endif
 ifeq ($(MOZ_PKG_FORMAT),TGZ)
 PKG_SUFFIX	= .tar.gz
 MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - $(MOZ_PKG_APPNAME) | gzip -vf9 > $(PACKAGE)
 UNMAKE_PACKAGE	= gunzip -c $(UNPACKAGE) | $(UNPACK_TAR)
+MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | gzip -vf9 > $(SDK)
 endif
 ifeq ($(MOZ_PKG_FORMAT),BZ2)
 PKG_SUFFIX	= .tar.bz2
 MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - $(MOZ_PKG_APPNAME) | bzip2 -vf > $(PACKAGE)
 UNMAKE_PACKAGE	= bunzip2 -c $(UNPACKAGE) | $(UNPACK_TAR)
+MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
 endif
 ifeq ($(MOZ_PKG_FORMAT),ZIP)
 PKG_SUFFIX	= .zip
 MAKE_PACKAGE	= $(ZIP) -r9D $(PACKAGE) $(MOZ_PKG_APPNAME)
 UNMAKE_PACKAGE	= $(UNZIP) $(UNPACKAGE)
+MAKE_SDK = $(ZIP) -r9D $(SDK_BASENAME).sdk.zip $(MOZ_APP_NAME)-sdk
 endif
 ifeq ($(MOZ_PKG_FORMAT),DMG)
 ifndef _APPNAME
 ifdef MOZ_DEBUG
 _APPNAME	= $(MOZ_APP_DISPLAYNAME)Debug.app
 else
 _APPNAME	= $(MOZ_APP_DISPLAYNAME).app
 endif
@@ -160,16 +169,18 @@ UNMAKE_PACKAGE	= \
     cp $(UNPACKAGE) $(MOZ_PKG_APPNAME).tmp.dmg && \
     hdiutil unflatten $(MOZ_PKG_APPNAME).tmp.dmg && \
     { /Developer/Tools/DeRez -skip plst -skip blkx $(MOZ_PKG_APPNAME).tmp.dmg > "$(MOZ_PKG_MAC_RSRC)" || { rm -f $(MOZ_PKG_APPNAME).tmp.dmg && false; }; } && \
     rm -f $(MOZ_PKG_APPNAME).tmp.dmg; \
   fi; \
   $(NULL)
 # The plst and blkx resources are skipped because they belong to each
 # individual dmg and are created by hdiutil.
+SDK_SUFFIX = .tar.bz2
+MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
 endif
 
 # dummy macro if we don't have PSM built
 SIGN_NSS		=
 ifneq (1_,$(if $(CROSS_COMPILE),1,0)_$(UNIVERSAL_BINARY))
 ifdef MOZ_PSM
 SIGN_NSS		= @echo signing nss libraries;
 
@@ -415,8 +426,29 @@ ifdef INSTALL_SDK # Here comes the hard 
 	$(RM) -f $(DESTDIR)$(sdkdir)/lib $(DESTDIR)$(sdkdir)/bin $(DESTDIR)$(sdkdir)/sdk/include $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/sdk/idl $(DESTDIR)$(sdkdir)/idl
 	ln -s $(sdkdir)/sdk/lib $(DESTDIR)$(sdkdir)/lib
 	ln -s $(installdir) $(DESTDIR)$(sdkdir)/bin
 	ln -s $(includedir)/stable $(DESTDIR)$(sdkdir)/sdk/include
 	ln -s $(includedir)/unstable $(DESTDIR)$(sdkdir)/include
 	ln -s $(idldir)/stable $(DESTDIR)$(sdkdir)/sdk/idl
 	ln -s $(idldir)/unstable $(DESTDIR)$(sdkdir)/idl
 endif # INSTALL_SDK
+
+make-sdk:: stage-package
+	@echo "Packaging SDK..."
+	$(RM) -rf $(DIST)/$(MOZ_APP_NAME)-sdk
+	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/bin
+	(cd $(DIST)/$(MOZ_PKG_APPNAME) && tar $(TAR_CREATE_FLAGS) - .) | \
+	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/bin && tar -xf -)
+	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/sdk
+	(cd $(DIST)/sdk && tar $(TAR_CREATE_FLAGS) - .) | \
+	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/sdk && tar -xf -)
+	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/include
+	(cd $(DIST)/include && tar $(TAR_CREATE_FLAGS) - .) | \
+	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/include && tar -xf -)
+	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/idl
+	(cd $(DIST)/idl && tar $(TAR_CREATE_FLAGS) - .) | \
+	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/idl && tar -xf -)
+	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/lib
+# sdk/lib is the same as sdk/sdk/lib
+	(cd $(DIST)/sdk/lib && tar $(TAR_CREATE_FLAGS) - .) | \
+	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/lib && tar -xf -)
+	cd $(DIST) && $(MAKE_SDK)
--- a/xulrunner/build.mk
+++ b/xulrunner/build.mk
@@ -79,8 +79,11 @@ installer:
 	@echo "XULRunner doesn't have an installer yet."
 	@exit 1
 
 package:
 	@$(MAKE) -C xulrunner/installer
 
 install:
 	@$(MAKE) -C xulrunner/installer install
+
+sdk:
+	@$(MAKE) -C xulrunner/installer make-sdk
--- a/xulrunner/installer/Makefile.in
+++ b/xulrunner/installer/Makefile.in
@@ -107,43 +107,9 @@ endif
 	-e "s|%NSPR_NAME%|$(NSPR_NAME)|" \
 	-e "s|%NSPR_VERSION%|$(NSPR_VERSION)|" > $@
 	chmod 644 $@
 
 install:: $(pkg_config_files)
 	@echo pkg_config_file: $(pkg_config_files)
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(libdir)/pkgconfig
 
-#
-# Package the SDK directory
-#
-
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-SDK_APPNAME = $(MOZ_APP_NAME)
-else
-SDK_APPNAME = $(MOZ_PKG_APPNAME)
-endif
-SDK_BASENAME = $(SDK_APPNAME)-$(MOZ_PKG_VERSION).$(AB_CD).$(MOZ_PKG_PLATFORM)
-SDK = $(SDK_BASENAME).sdk$(PKG_SUFFIX)
-
-ifeq ($(MOZ_PKG_FORMAT),TAR)
-MAKE_SDK = $(CREATE_FINAL_TAR) - gecko-sdk > $(SDK)
-else
-ifeq ($(MOZ_PKG_FORMAT),TGZ)
-MAKE_SDK = $(CREATE_FINAL_TAR) - gecko-sdk | gzip -vf9 > $(SDK)
-else
-ifeq ($(MOZ_PKG_FORMAT),BZ2)
-MAKE_SDK = $(CREATE_FINAL_TAR) - gecko-sdk | bzip2 -vf > $(SDK)
-else
-# default to zip
-MAKE_SDK = $(ZIP) -r9D $(SDK_BASENAME).sdk.zip gecko-sdk
-endif
-endif
-endif
-
-make-sdk:
-	@echo "Packaging SDK..."
-	@rm -rf $(DIST)/gecko-sdk
-	@mkdir $(DIST)/gecko-sdk
-	@cd $(DIST)/sdk && tar $(TAR_CREATE_FLAGS) - * | (cd ../gecko-sdk; tar -xf -)
-	cd $(DIST) && $(MAKE_SDK)
-
 libs:: make-sdk