This repository was archived by the owner on Nov 10, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathMakefile
More file actions
220 lines (185 loc) · 8.24 KB
/
Makefile
File metadata and controls
220 lines (185 loc) · 8.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
.PHONY: build clean profile prosthesis b2g appinfo locales run package test help
-include local.mk
SYS = $(shell uname -s)
ARCH = $(shell uname -m)
ifneq (,$(findstring MINGW32_,$(SYS)))
SYS = WINNT
endif
DOWNLOAD_CMD = wget -c
# The platform of the B2G build.
# Options include 'win32', 'mac64', 'linux64', and 'linux', and the default is
# the current platform. The reliability of this option is unclear. Setting it
# to 'mac64' on non-Mac is known to fail, because mozinstall doesn't know how to
# install from a DMG on a non-Mac platform. But setting it to one of the Linux
# values on the other Linux platform works and is the main use case for it
# (i.e. to create the dual-binary Linux packages).
ifndef B2G_PLATFORM
ifeq (WINNT, $(SYS))
B2G_PLATFORM = win32
else
ifeq (Darwin, $(SYS))
B2G_PLATFORM = mac64
else
ifeq (Linux, $(SYS))
ifeq (x86_64, $(ARCH))
B2G_PLATFORM = linux64
else
B2G_PLATFORM = linux
endif
endif
endif
endif
endif
B2G_VERSION=1.2
ADDON_NAME=fxos_1_2_simulator
# compute addon version out of package.json
# matches xx.yy[pre,a,b]zz version patterns
ADDON_VERSION=$(shell grep version addon/package.json | perl -p -e 's/.*([0-9]+\.[0-9]+(pre|a|b)?[0-9]*(dev)?(\.[0-9]{8})).*/\1/')
XPI_NAME=$(ADDON_NAME)-$(ADDON_VERSION)-$(B2G_PLATFORM).xpi
FTP_ROOT_PATH=/pub/mozilla.org/labs/fxos-simulator
UPDATE_PATH=$(B2G_VERSION)/$(B2G_PLATFORM)
UPDATE_LINK=https://ftp.mozilla.org$(FTP_ROOT_PATH)/$(UPDATE_PATH)/$(XPI_NAME)
UPDATE_URL=https://ftp.mozilla.org$(FTP_ROOT_PATH)/$(UPDATE_PATH)/update.rdf
# The type of the B2G build. It can be "nightly", in which case you may set
# B2G_ID to the ID of the build (default: the most recent nightly build);
# or "specific", in which case you must set B2G_URL to the URL of the build.
B2G_TYPE ?= specific
# The ID of the nightly B2G build.
# Sometimes this is based on the latest stable nightly for Unagi according to
# https://releases.mozilla.com/b2g/promoted_to_stable/ (private URL).
# B2G_ID
# Use the current last known revision that sucessfully builds on Windows.
B2G_URL_BASE = https://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/2014-01-06-00-40-01-mozilla-b2g26_v1_2/
# Currently, all B2G builds are custom so we can optimize for code size and fix
# bugs in B2G or its nightly build environments (like 844047 and 815805).
# Platform-specific Defines
ifeq (win32, $(B2G_PLATFORM))
# The URL of the specific B2G build.
B2G_URL ?= $(B2G_URL_BASE)b2g-26.0.multi.win32.zip
B2G_BIN_DIR = b2g
else
ifeq (mac64, $(B2G_PLATFORM))
B2G_URL ?= $(B2G_URL_BASE)b2g-26.0.multi.mac64.dmg
DOWNLOAD_CMD = /usr/bin/curl -O
B2G_BIN_DIR = B2G.app/Contents/MacOS
else
ifeq (linux64, $(B2G_PLATFORM))
B2G_URL ?= $(B2G_URL_BASE)b2g-26.0.multi.linux-x86_64.tar.bz2
B2G_BIN_DIR = b2g
else
ifeq (linux, $(B2G_PLATFORM))
B2G_URL ?= $(B2G_URL_BASE)b2g-26.0.multi.linux-i686.tar.bz2
B2G_BIN_DIR = b2g
endif
endif
endif
endif
ifdef B2G_PLATFORM
B2G_PLATFORM_ARG = --platform $(B2G_PLATFORM)
endif
ifdef B2G_TYPE
B2G_TYPE_ARG = --type $(B2G_TYPE)
endif
ifdef B2G_ID
B2G_ID_ARG = --id $(B2G_ID)
endif
ifdef B2G_URL
B2G_URL_ARG = --url $(B2G_URL)
endif
ifdef BIN
BIN_ARG = -b $(BIN)
endif
ifdef PROFILE
PROFILE_ARG = --profiledir $(PROFILE)
endif
ifdef TEST
TEST_ARG = -f $(TEST)
endif
unix_to_windows_path = \
$(shell echo '$(1)' | sed 's/^\///' | sed 's/\//\\/g' | sed 's/^./\0:/')
# windows_to_unix_path = \
# $(shell echo '$(1)' | sed 's/\\/\//g' | sed 's/://')
export LOCALES_FILE=${PWD}/build/languages.json
export LOCALE_BASEDIR ?= $(PWD)/gaia-l10n
# Gaia expects these to be Windows-style paths on Windows.
ifeq (win32, $(B2G_PLATFORM))
LOCALES_FILE := $(call unix_to_windows_path,$(LOCALES_FILE))
LOCALE_BASEDIR := $(call unix_to_windows_path,$(LOCALE_BASEDIR))
endif
build: profile b2g appinfo
clean:
rm -rf addon/data/$(B2G_PLATFORM)
rm -rf addon/template
rm -f gaia/build/custom-prefs.js
rm -f gaia/build/custom-settings.json
$(MAKE) -C gaia clean
python build/make-b2g.py $(B2G_TYPE_ARG) $(B2G_PLATFORM_ARG) $(B2G_ID_ARG) $(B2G_URL_ARG) --clean
profile:
cp build/override-prefs.js gaia/build/custom-prefs.js
cp build/override-settings.json gaia/build/custom-settings.json
# We can't set DESKTOP=1 until bug 930104 reach all branches we are targeting
# In the meantime, we set DESKTOP=1 for `make preferences` to make prefs
# in a debug profile and then copy them to the regular profile below.
NOFTU=1 GAIA_APP_TARGET=production $(MAKE) -C gaia
DESKTOP=1 NOFTU=1 GAIA_APP_TARGET=production $(MAKE) -C gaia preferences
python build/override-webapps.py
# As we do not use DESKTOP=1 for extensions target, helper addons aren't installed into the profile
cd gaia/tools/extensions/desktop-helper/ && zip -r ../../../profile/extensions/desktop-helper\@gaiamobile.org.xpi *
cd gaia/tools/extensions/activities/ && zip -r ../../../profile/extensions/activities\@gaiamobile.org.xpi *
# Remove junks gaia build system creates
rm -rf gaia/profile/startupCache gaia/profile/places.* gaia/profile/permissions.sqlite gaia/profile/defaults
# Strip dictionaries to reduce xpi size
zip -d gaia/profile/webapps/keyboard.gaiamobile.org/application.zip js/imes/latin/dictionaries/*
# Remove firefox addons that mess up with the simulator
rm -rf gaia/profile/extensions/{browser-helper@gaiamobile.org,gaia-build@gaiamobile.org,httpd@gaiamobile.org,httpd,screen-reader-simulator@gaiamobile.org}
rm -rf addon/template
mkdir -p addon/template
mv gaia/profile addon/template/
# As preferences target is executed with DESKTOP=1, it is installed in another debug profile
cp gaia/profile-debug/user.js addon/template/profile/
cp addon-sdk/app-extension/bootstrap.js addon/template/
cp addon-sdk/app-extension/install.rdf addon/template/
mkdir -p addon/template/profile/extensions
cd prosthesis && zip -r b2g-prosthesis\@mozilla.org.xpi content components defaults locale modules chrome.manifest install.rdf
mv prosthesis/b2g-prosthesis@mozilla.org.xpi addon/template/profile/extensions
# The 'prosthesis' target was folded into the 'profile' target, so it is just
# an alias to that target now.
prosthesis: profile
appinfo: profile b2g
python build/make-appinfo.py --gecko addon/data/$(B2G_PLATFORM)/$(B2G_BIN_DIR)/ --gaia gaia/ --data addon/data/ --package addon/package.json
b2g:
python build/make-b2g.py $(B2G_TYPE_ARG) $(B2G_PLATFORM_ARG) $(B2G_ID_ARG) $(B2G_URL_ARG)
rm -rf addon/data/$(B2G_PLATFORM)/$(B2G_BIN_DIR)/gaia
locales:
python build/make-locales.py
run:
cd addon-sdk && . bin/activate && cd ../addon && cfx run --templatedir template/ $(BIN_ARG) $(PROFILE_ARG)
package:
cd addon-sdk && . bin/activate && cd ../addon && cfx xpi --templatedir template/ --strip-sdk $(PRODUCTION_ARG)
production: PRODUCTION_ARG=--update-link $(UPDATE_LINK) --update-url $(UPDATE_URL)
production: locales build package
release: addon/$(ADDON_NAME).xpi addon/$(ADDON_NAME).update.rdf
@if [ -z $(SSH_USER) ]; then \
echo "release target requires SSH_USER env variable to be defined."; \
exit 1; \
fi
ssh $(SSH_USER)@stage.mozilla.org 'mkdir -m 775 -p $(FTP_ROOT_PATH)/$(UPDATE_PATH)'
chmod 664 addon/$(ADDON_NAME).xpi addon/$(ADDON_NAME).update.rdf
scp -p addon/$(ADDON_NAME).xpi $(SSH_USER)@stage.mozilla.org:$(FTP_ROOT_PATH)/$(UPDATE_PATH)/$(XPI_NAME)
ssh $(SSH_USER)@stage.mozilla.org 'cd $(FTP_ROOT_PATH)/$(UPDATE_PATH)/ && ln -fs $(XPI_NAME) $(ADDON_NAME)-$(B2G_PLATFORM)-latest.xpi'
scp -p addon/$(ADDON_NAME).update.rdf $(SSH_USER)@stage.mozilla.org:$(FTP_ROOT_PATH)/$(UPDATE_PATH)/update.rdf
test:
cd addon-sdk && . bin/activate && cd ../addon && cfx test --verbose --templatedir template/ $(BIN_ARG) $(TEST_ARG) $(PROFILE_ARG)
help:
@echo 'Targets:'
@echo " build: [default] build, download, install everything;\n"\
" combines the profile, appinfo and b2g make targets"
@echo ' clean: remove files created during the build process'
@echo ' profile: make the Gaia profile and its prosthesis addon'
@echo ' appinfo: create a static json file describing the gecko and gaia version we are shipping in the addon'
@echo ' b2g: download and install B2G'
@echo ' locales: pull/update l10n repositories for specified locales'
@echo ' run: start Firefox with the addon installed into a new profile'
@echo ' package: package the addon into a XPI'
@echo ' test: run automated tests'
@echo ' help: show this message'