author | John Ford <jhford@mozilla.com> |
Fri, 07 Sep 2012 15:13:55 -0700 | |
changeset 110916 | 8253d8caa1b8e19e472caa22b04912bca14ca46e |
parent 110915 | e8ab640432796e598dcfb521241c2aa12ccc52fa |
child 110917 | 611507d8da4c2faeeba4556e1c587e5ad88ea8e3 |
push id | 1708 |
push user | akeybl@mozilla.com |
push date | Mon, 19 Nov 2012 21:10:21 +0000 |
treeherder | mozilla-beta@27b14fe50103 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ted |
bugs | 776783 |
milestone | 18.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
b2g/gaia/Makefile.in | file | annotate | diff | comparison | revisions | |
b2g/gaia/run-b2g.c | file | annotate | diff | comparison | revisions |
new file mode 100644 --- /dev/null +++ b/b2g/gaia/Makefile.in @@ -0,0 +1,56 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DEPTH = @DEPTH@ +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +GAIA_PATH := gaia/profile + + +# We don't have a wrapper script on Windows yet +ifneq ($(OS_ARCH),WINNT) +PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX) +CSRCS = run-b2g.c + +DEFINES += \ + -DB2G_NAME=\"$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)\" \ + -DGAIA_PATH=\"$(GAIA_PATH)\" \ + $(NULL) + +# This is needed to avoid making run-b2g depend on mozglue +WRAP_LDFLAGS := +endif + +GENERATED_DIRS += $(DIST)/bin/$(GAIA_PATH) + +ZIP_URL := https://github.com/mozilla-b2g/gaia/zipball/master + +include $(topsrcdir)/config/rules.mk + + +libs:: + # For now, let's fetch a copy of Gaia over http + rm -rf master.zip mozilla-b2g-gaia-* +ifeq ($(OS_ARCH),Darwin) + curl -L -o master.zip $(ZIP_URL) +else + # Github redirects to https. If https is busted, we still want a copy of Gaia + wget -O master.zip $(ZIP_URL) || \ + wget -O master.zip --no-check-certificate $(ZIP_URL) +endif + unzip master.zip + mv mozilla-b2g-* $(topsrcdir)/gaia + + # Below here is how Gaia gets built + # The Gaia build system freaks out when N > 1 for -jN + $(MAKE) -j1 -C $(GAIADIR) clean + $(MAKE) -j1 -C $(GAIADIR) profile GAIA_DOMAIN=desktop-builds.$(MOZ_APP_NAME).mozilla.org + (cd $(GAIADIR)/profile && tar $(TAR_CREATE_FLAGS) - .) | (cd $(abspath $(DIST))/bin/$(GAIA_PATH) && tar -xf -) + + +
new file mode 100644 --- /dev/null +++ b/b2g/gaia/run-b2g.c @@ -0,0 +1,47 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <libgen.h> + +#ifndef B2G_NAME +#define B2G_NAME "b2g-bin" +#endif +#ifndef GAIA_PATH +#define GAIA_PATH "gaia/profile" +#endif +#define NOMEM "Could not allocate enough memory" + +void error(char* msg){ + fprintf(stderr, "ERROR: %s\n", msg); +} + +int main(int argc, char* argv[], char* envp[]){ + char* cwd = NULL; + char* full_path = NULL; + char* full_profile_path = NULL; + printf("Starting %s\n", B2G_NAME); + cwd = realpath(dirname(argv[0]), NULL); + full_path = (char*) malloc(strlen(cwd) + strlen(B2G_NAME) + 2); + if (!full_path) { + error(NOMEM); + return -2; + } + full_profile_path = (char*) malloc(strlen(cwd) + strlen(GAIA_PATH) + 2); + if (!full_profile_path) { + error(NOMEM); + return -2; + } + sprintf(full_path, "%s/%s", cwd, B2G_NAME); + sprintf(full_profile_path, "%s/%s", cwd, GAIA_PATH); + free(cwd); + printf("Running: %s -profile %s\n", full_path, full_profile_path); + fflush(stdout); + fflush(stderr); + execle(full_path, full_path, "-profile", full_profile_path, NULL, envp); + error("unable to start"); + perror(argv[0]); + free(full_path); + free(full_profile_path); + return -1; +}