Skip to content

Commit

Permalink
Revert "Merge pull request mozilla-b2g#22867 from yurenju/pull/22765"
Browse files Browse the repository at this point in the history
This reverts commit 5f51ff8, reversing
changes made to 67f0e56.
  • Loading branch information
rvandermeulen committed Aug 15, 2014
1 parent 0cc4f10 commit 203aca9
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 166 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ manifest.appcache
/profile-gaia-test-b2g/
/profile-gaia-test-firefox/
/profile.tar.gz
/b2g_sdk/
/.xulrunner-url
/xulrunner/
/xulrunner-sdk*/
/tools/test-agent/node_modules
/test-output.xml
/mocha-test-results.html
Expand Down
181 changes: 76 additions & 105 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,20 @@
# #
###############################################################################
# #
# b2g desktop download and location configuration (formerly xulrunner) #
# XULrunner download and location configuration #
# #
# USE_LOCAL_XULRUNNER_SDK : if you have a local b2g desktop installation #
# and want to use it #
# USE_LOCAL_XULRUNNER_SDK : if you have a local XULrunner installation and #
# wants to use it #
# #
# XULRUNNER_DIRECTORY : if you use USE_LOCAL_XULRUNNER_SDK, this is #
# where your local b2g desktop installation is #
# Note: a full firefox build is good enough #
# where your local XULrunner installation is #
# #
# Submakes will get XULRUNNER_DIRECTORY and XPCSHELLSDK as absolute paths. #
# XULRUNNER_BASE_DIRECTORY : if you don't use USE_LOCAL_XULRUNNER_SDK, this #
# is where you want the automatic XULrunner #
# download to uncompress. #
# #
# Submakes will get XULRUNNER_DIRECTORY, XULRUNNERSDK and XPCSHELLSDK as #
# absolute paths. #
# #
###############################################################################

Expand All @@ -64,7 +68,7 @@ MAKEFLAGS=-r
# Headless bot does not need the full output of wget
# and it can cause crashes in bot.io option is here so
# -nv can be passed and turn off verbose output.
WGET_OPTS?=-c -nv
WGET_OPTS?=-c
GAIA_DOMAIN?=gaiamobile.org

DEBUG?=0
Expand Down Expand Up @@ -242,75 +246,47 @@ SEP_FOR_SED=\\\\
MSYS_FIX=/
endif

# The b2g_sdk target arranges to get b2g desktop downloaded and set up.
# This is platform dependent code, so a mite complicated.
# Note: this used to be just xulrunner, hence the use of that name throughout,
# but xulrunner doesn't include everything we need

# Configuration for pre-built or already downloaded b2g (or alternative)
ifdef USE_LOCAL_XULRUNNER_SDK

ifndef XULRUNNER_DIRECTORY
$(error XULRUNNER_DIRECTORY must be set if USE_LOCAL_XULRUNNER_SDK is set)
endif

# Some guesswork to figure out where the xpcshell binary really is
# Most of this is to accommodate the variety of setups used
# by different platforms, build systems and TBPL configurations
# including Firefox, xulrunner and other builds
XPCSHELL_GUESS = $(firstword $(wildcard \
$(XULRUNNER_DIRECTORY)/B2G.app/Contents/MacOS/xpcshell \
$(XULRUNNER_DIRECTORY)/bin/XUL.framework/Versions/Current/xpcshell \
$(XULRUNNER_DIRECTORY)/bin/xpcshell* \
))
ifneq (,$(XPCSHELL_GUESS))
XPCSHELLSDK := $(abspath $(XPCSHELL_GUESS))
XULRUNNERSDK := $(wildcard $(XPCSHELLSDK)/run-mozilla.sh)
endif

# Configuration for a downloaded b2g desktop
else

# Determine the host-dependent bundle to download
B2G_SDK_VERSION := 34.0a1
B2G_SDK_DATE := 2014/08/2014-08-12-04-02-01

XULRUNNER_BASE_DIR ?= b2g_sdk
XULRUNNER_DIRECTORY ?= $(XULRUNNER_BASE_DIR)/$(B2G_SDK_VERSION)-$(notdir $(B2G_SDK_DATE))
XULRUNNER_DIRECTORY := $(abspath $(XULRUNNER_DIRECTORY))
# The install-xulrunner target arranges to get xulrunner downloaded and sets up
# some commands for invoking it. But it is platform dependent
# IMPORTANT: you should generally change the directory name when you change the
# URL unless you know what you're doing
XULRUNNER_SDK_URL=http://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/2014/07/2014-07-04-03-02-08-mozilla-central/xulrunner-33.0a1.en-US.
XULRUNNER_BASE_DIRECTORY?=xulrunner-sdk-33
XULRUNNER_DIRECTORY?=$(XULRUNNER_BASE_DIRECTORY)/xulrunner-sdk
XULRUNNER_URL_FILE=$(XULRUNNER_BASE_DIRECTORY)/.url

ifeq ($(SYS),Darwin)
B2G_SDK_EXT := dmg
B2G_SDK_OS := mac64
XPCSHELLSDK := $(abspath $(XULRUNNER_DIRECTORY)/B2G.app/Contents/MacOS/xpcshell)
# For mac we have the xulrunner-sdk so check for this directory
# We're on a mac
XULRUNNER_MAC_SDK_URL=$(XULRUNNER_SDK_URL)mac-
ifeq ($(ARCH),i386)
# 32-bit
XULRUNNER_SDK_DOWNLOAD=$(XULRUNNER_MAC_SDK_URL)i386.sdk.tar.bz2
else
# 64-bit
XULRUNNER_SDK_DOWNLOAD=$(XULRUNNER_MAC_SDK_URL)x86_64.sdk.tar.bz2
endif
XULRUNNERSDK=$(abspath $(XULRUNNER_DIRECTORY)/bin/XUL.framework/Versions/Current/run-mozilla.sh)
XPCSHELLSDK=$(abspath $(XULRUNNER_DIRECTORY)/bin/XUL.framework/Versions/Current/xpcshell)

else ifeq ($(findstring MINGW32,$(SYS)), MINGW32)
B2G_SDK_EXT := zip
B2G_SDK_OS := win32
XPCSHELLSDK := $(abspath $(XULRUNNER_DIRECTORY)/b2g/xpcshell.exe)
# For windows we only have one binary
XULRUNNER_SDK_DOWNLOAD=$(XULRUNNER_SDK_URL)win32.sdk.zip
XULRUNNERSDK=
XPCSHELLSDK=$(abspath $(XULRUNNER_DIRECTORY)/bin/xpcshell)

# Otherwise, assume linux
else
B2G_SDK_EXT := tar.bz2
# Otherwise, assume linux
# downloads and installs locally xulrunner to run the xpchsell
# script that creates the offline cache
XULRUNNER_LINUX_SDK_URL=$(XULRUNNER_SDK_URL)linux-
ifeq ($(ARCH),x86_64)
B2G_SDK_OS := linux-x86_64
XULRUNNER_SDK_DOWNLOAD=$(XULRUNNER_LINUX_SDK_URL)x86_64.sdk.tar.bz2
else
B2G_SDK_OS := linux-i686
endif
XPCSHELLSDK := $(abspath $(XULRUNNER_DIRECTORY)/b2g/xpcshell)
XULRUNNER_SDK_DOWNLOAD=$(XULRUNNER_LINUX_SDK_URL)i686.sdk.tar.bz2
endif

B2G_SDK_URL_BASE := https://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/$(B2G_SDK_DATE)-mozilla-central
B2G_SDK_FILE_NAME := b2g-$(B2G_SDK_VERSION).multi.$(B2G_SDK_OS).$(B2G_SDK_EXT)
B2G_SDK_URL := $(B2G_SDK_URL_BASE)/$(B2G_SDK_FILE_NAME)
B2G_SDK_URL_FILE := $(XULRUNNER_DIRECTORY)/.b2g.url

endif # Firefox build workaround

# XULRUNNERSDK used to be run-mozilla.sh, but some builds don't include it
# Without that, Linux needs to reference the directory containing libxul.so
ifeq (,$(XULRUNNERSDK)$(findstring Darwin,$(SYS))$(findstring MINGW32_,$(SYS)))
XULRUNNERSDK := LD_LIBRARY_PATH="$(dir $(XPCSHELLSDK))"
XULRUNNERSDK=$(abspath $(XULRUNNER_DIRECTORY)/bin/run-mozilla.sh)
XPCSHELLSDK=$(abspath $(XULRUNNER_DIRECTORY)/bin/xpcshell)
endif

# It's difficult to figure out XULRUNNERSDK in subprocesses; it's complex and
Expand Down Expand Up @@ -407,7 +383,7 @@ ifneq ($(GAIA_OUTOFTREE_APP_SRCDIRS),)
$(shell mkdir -p outoftree_apps \
$(foreach dir,$(GAIA_OUTOFTREE_APP_SRCDIRS),\
$(foreach appdir,$(wildcard $(dir)/*),\
&& ln -sf $(appdir) outoftree_apps/)))
&& ln -sf $(appdir) outoftree_apps/)))
endif

GAIA_LOCALES_PATH?=locales
Expand All @@ -424,7 +400,7 @@ GAIA_KEYBOARD_LAYOUTS?=en,pt-BR,es,de,fr,pl,zh-Hans-Pinyin,en-Dvorak
ifeq ($(SYS),Darwin)
MD5SUM = md5 -r
SED_INPLACE_NO_SUFFIX = /usr/bin/sed -i ''
DOWNLOAD_CMD = /usr/bin/curl -OLsS
DOWNLOAD_CMD = /usr/bin/curl -OL
TAR_WILDCARDS = tar
else
MD5SUM = md5sum -b
Expand Down Expand Up @@ -510,7 +486,7 @@ export BUILD_CONFIG

define app-makefile-template
.PHONY: $(1)
$(1): b2g_sdk pre-app | $(STAGE_DIR)
$(1): $(XULRUNNER_BASE_DIRECTORY) pre-app | $(STAGE_DIR)
@if [[ ("$(2)" =~ "${BUILD_APP_NAME}") || ("${BUILD_APP_NAME}" == "*") ]]; then \
if [ -r "$(2)$(SEP)Makefile" ]; then \
echo "execute Makefile for $(1) app" ; \
Expand All @@ -530,7 +506,7 @@ endef
include build/common.mk

# Generate profile/
$(PROFILE_FOLDER): preferences pre-app post-app test-agent-config offline contacts extensions b2g_sdk .git/hooks/pre-commit create-default-data
$(PROFILE_FOLDER): preferences pre-app post-app test-agent-config offline contacts extensions $(XULRUNNER_BASE_DIRECTORY) .git/hooks/pre-commit create-default-data
ifeq ($(BUILD_APP_NAME),*)
@echo "Profile Ready: please run [b2g|firefox] -profile $(CURDIR)$(SEP)$(PROFILE_FOLDER)"
endif
Expand All @@ -556,11 +532,11 @@ app-makefiles: $(APP_RULES)
LANG=POSIX # Avoiding sort order differences between OSes

.PHONY: pre-app
pre-app: b2g_sdk $(STAGE_DIR)
pre-app: $(XULRUNNER_BASE_DIRECTORY) $(STAGE_DIR)
@$(call run-js-command,pre-app)

.PHONY: post-app
post-app: app-makefiles pre-app b2g_sdk
post-app: app-makefiles pre-app $(XULRUNNER_BASE_DIRECTORY)
@$(call run-js-command,post-app)

# Keep old targets just for people/scripts still using it
Expand Down Expand Up @@ -626,47 +602,41 @@ reference-workload-heavy:
reference-workload-x-heavy:
test_media/reference-workload/makeReferenceWorkload.sh x-heavy

.PHONY: xpcshell_sdk xulrunner_sdk print-xulrunner-sdk
xpcshell_sdk:
@echo $(XPCSHELLSDK)

xulrunner_sdk:
@echo $(XULRUNNERSDK)

.PHONY: print-xulrunner-sdk
print-xulrunner-sdk:
@echo "$(XULRUNNER_DIRECTORY)"

B2G_SDK_TMP := .b2g.tmp
.INTERMEDIATES: $(B2G_SDK_TMP)
.PHONY: b2g_sdk
b2g_sdk:
@echo "Test SDK directory: $(XULRUNNER_DIRECTORY)"
$(XULRUNNER_BASE_DIRECTORY):
@echo "XULrunner directory: $(XULRUNNER_DIRECTORY)"
ifndef USE_LOCAL_XULRUNNER_SDK
ifneq ($(B2G_SDK_URL),$(shell test -d $(XULRUNNER_DIRECTORY) && cat $(B2G_SDK_URL_FILE) 2> /dev/null))
rm -rf $(XULRUNNER_DIRECTORY)
mkdir -p "$(XULRUNNER_DIRECTORY)"
@echo "Downloading B2G SDK..."
$(DOWNLOAD_CMD) "$(B2G_SDK_URL)"
ifeq ($(B2G_SDK_EXT),dmg)
# it's a nasty mac disk image
@mkdir -p $(B2G_SDK_TMP)
hdiutil attach $(B2G_SDK_FILE_NAME) -readonly -nobrowse -mount required -mountpoint $(B2G_SDK_TMP)
cp -Rf $(B2G_SDK_TMP)/* "$(XULRUNNER_DIRECTORY)"
ln -sf "$(XULRUNNER_DIRECTORY)/B2G.app/Contents/MacOS" "$(XULRUNNER_DIRECTORY)/b2g"
umount $(B2G_SDK_TMP)
else ifeq ($(B2G_SDK_EXT),tar.bz2)
tar xjf "$(B2G_SDK_FILE_NAME)" -C "$(XULRUNNER_DIRECTORY)"
ifneq ($(XULRUNNER_SDK_DOWNLOAD),$(shell test -d $(XULRUNNER_DIRECTORY) && cat $(XULRUNNER_URL_FILE) 2> /dev/null))
# must download the xulrunner sdk
rm -rf $(XULRUNNER_BASE_DIRECTORY)
@echo "Downloading XULRunner..."
$(DOWNLOAD_CMD) $(XULRUNNER_SDK_DOWNLOAD)
ifeq ($(findstring MINGW32,$(SYS)), MINGW32)
mkdir "$(XULRUNNER_BASE_DIRECTORY)"
@echo "Unzipping XULRunner..."
unzip -q xulrunner*.zip -d "$(XULRUNNER_BASE_DIRECTORY)" && rm -f xulrunner*.zip
else
unzip -q "$(B2G_SDK_FILE_NAME)" -d "$(XULRUNNER_DIRECTORY)"
endif
@rm -rf $(B2G_SDK_TMP) $(B2G_SDK_FILE_NAME)
@echo $(B2G_SDK_URL) > $(B2G_SDK_URL_FILE)
endif # B2G SDK is up to date
mkdir $(XULRUNNER_BASE_DIRECTORY)
tar xjf xulrunner*.tar.bz2 -C $(XULRUNNER_BASE_DIRECTORY) && rm -f xulrunner*.tar.bz2 || \
( echo; \
echo "We failed extracting the XULRunner SDK archive which may be corrupted."; \
echo "You should run 'make really-clean' and try again." ; false )
endif # MINGW32
@echo $(XULRUNNER_SDK_DOWNLOAD) > $(XULRUNNER_URL_FILE)
endif # XULRUNNER_SDK_DOWNLOAD
endif # USE_LOCAL_XULRUNNER_SDK
test -f $(XPCSHELLSDK)

# Generate profile/prefs.js
preferences: profile-dir b2g_sdk
preferences: profile-dir $(XULRUNNER_BASE_DIRECTORY)
@$(call run-js-command,preferences)

# Generate $(PROFILE_FOLDER)/extensions
Expand Down Expand Up @@ -917,10 +887,10 @@ hint: node_modules/.bin/jshint
@echo Running jshint...
@./node_modules/.bin/jshint $(JSHINT_ARGS) $(JSHINTED_PATH) $(LINTED_FILES) || (echo Please consult https://github.com/mozilla-b2g/gaia/tree/master/build/jshint/README.md to get some information about how to fix jshint issues. && exit 1)

csslint: b2g_sdk
csslint: $(XULRUNNER_BASE_DIRECTORY)
@$(call run-js-command,csslint)

jsonlint: b2g_sdk
jsonlint: $(XULRUNNER_BASE_DIRECTORY)
@$(call run-js-command,jsonlint)

# Erase all the indexedDB databases on the phone, so apps have to rebuild them.
Expand Down Expand Up @@ -958,7 +928,7 @@ install-gaia: $(PROFILE_FOLDER) push
# on your phone, and you have adb in your path, then you can use the
# push target to update the gaia files and reboot b2g
.PHONY: push
push: b2g_sdk
push: $(XULRUNNER_BASE_DIRECTORY)
@$(call run-js-command,push-to-device)

# Copy demo media to the sdcard.
Expand Down Expand Up @@ -1006,7 +976,7 @@ purge:
$(ADB) shell rm -r $(MSYS_FIX)/system/b2g/webapps
$(ADB) shell 'if test -d $(MSYS_FIX)/persist/svoperapps; then rm -r $(MSYS_FIX)/persist/svoperapps; fi'

$(PROFILE_FOLDER)/settings.json: b2g_sdk profile-dir pre-app post-app
$(PROFILE_FOLDER)/settings.json: $(XULRUNNER_BASE_DIRECTORY) profile-dir pre-app post-app

# push $(PROFILE_FOLDER)/settings.json and $(PROFILE_FOLDER)/contacts.json (if CONTACTS_PATH defined) to the phone
install-default-data: $(PROFILE_FOLDER)/settings.json contacts
Expand Down Expand Up @@ -1040,11 +1010,12 @@ clean:

# clean out build products and tools
really-clean: clean
rm -rf b2g-* .b2g-* b2g_sdk node_modules b2g modules.tar js-marionette-env
rm -rf xulrunner-* .xulrunner-* node_modules b2g modules.tar js-marionette-env

.git/hooks/pre-commit: tools/pre-commit
test -d .git && cp tools/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit || true


build-test-unit: $(NPM_INSTALLED_PROGRAMS)
@$(call run-build-test, $(shell find build/test/unit/*.test.js))

Expand Down
18 changes: 4 additions & 14 deletions bin/gaia-marionette
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,16 @@ fi

if [ -z "$XULRUNNER_DIRECTORY" ] ; then
# the xulrunner directory isn't in the environment
XULRUNNER_DIRECTORY=$(ls -d "$DIR"/../b2g_sdk/* | sort -nr | head -n1 2> /dev/null)
XULRUNNER_DIRECTORY=`ls -d "$DIR/../xulrunner-sdk"*/xulrunner-sdk | sort -nr | head -n1 2> /dev/null`
fi

if [ ! -d "$XULRUNNER_DIRECTORY" ] ; then
echo "Couldn't find B2G. Please execute this file from 'make' or install B2G yourself."
exit 1
fi

if [ -z "$XPCSHELLSDK" ] ; then
XPCSHELLSDK=$(find "$XULRUNNER_DIRECTORY" -type f -name xpcshell | sort -nr | head -n1 2> /dev/null)
exit 1
fi

if [ ! -e "$XPCSHELLSDK" ] ; then
echo "Couldn't find B2G. Please execute this file from 'make' or install B2G yourself."
if [ -z "$XULRUNNER_DIRECTORY" ] ; then
echo "Couldn't find XULrunner. Please execute this file from 'make' or install XULrunner yourself."
exit 1
fi

# find xpcshell and put it in the path
XPCSHELL_DIR=$(dirname "$XPCSHELLSDK")
XPCSHELL_DIR=$(dirname $(find "$XULRUNNER_DIRECTORY"/bin -type f -name "xpcshell" | head -n 1));


VERBOSE_OPTS=""
Expand Down
18 changes: 4 additions & 14 deletions bin/gaia-perf-marionette
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,16 @@ fi

if [ -z "$XULRUNNER_DIRECTORY" ] ; then
# the xulrunner directory isn't in the environment
XULRUNNER_DIRECTORY=$(ls -d "$DIR"/../b2g_sdk/* | sort -nr | head -n1 2> /dev/null)
XULRUNNER_DIRECTORY=`ls -d "$DIR/../xulrunner-sdk"*/xulrunner-sdk | sort -nr | head -n1 2> /dev/null`
fi

if [ ! -d "$XULRUNNER_DIRECTORY" ] ; then
echo "Couldn't find B2G. Please execute this file from 'make' or install B2G yourself."
exit 1
fi

if [ -z "$XPCSHELLSDK" ] ; then
XPCSHELLSDK=$(find "$XULRUNNER_DIRECTORY" -type f -name xpcshell | sort -nr | head -n1 2> /dev/null)
exit 1
fi

if [ ! -e "$XPCSHELLSDK" ] ; then
echo "Couldn't find B2G. Please execute this file from 'make' or install B2G yourself."
if [ -z "$XULRUNNER_DIRECTORY" ] ; then
echo "Couldn't find XULrunner. Please execute this file from 'make' or install XULrunner yourself."
exit 1
fi

# find xpcshell and put it in the path
XPCSHELL_DIR=$(dirname "$XPCSHELLSDK")
XPCSHELL_DIR=$(dirname $(find "$XULRUNNER_DIRECTORY"/bin -type f -name "xpcshell" | head -n 1));

if [ -z "$APPS" ] ; then
echo "APPS isn't defined. Cannot continue."
Expand Down
Loading

0 comments on commit 203aca9

Please sign in to comment.